Hello,
I try to run the SPI connection in hardware mode on arduino Mega
In software no problem, but I have nothing in hardware ...
Software
Hardware
SPI harware ? Arduino Mega
Moderator: Benj
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: SPI harware ? Arduino Mega
Hello,
SPI hardware on an AVR is a bit weird. If you leave the hardware SS pin floating or pulled low then the SPI will go into slave mode and lockup.
So to use AVR hardware SPI you need to pull the hardware SS pin high or use the pin as an output. The easiest way is to use the SS pin to drive the slave CS pin and that way it is always configured as an output.
On the Arduino Mega 2560 the SS pin is pin B0 or Digital 53.
SPI hardware on an AVR is a bit weird. If you leave the hardware SS pin floating or pulled low then the SPI will go into slave mode and lockup.
So to use AVR hardware SPI you need to pull the hardware SS pin high or use the pin as an output. The easiest way is to use the SS pin to drive the slave CS pin and that way it is always configured as an output.
On the Arduino Mega 2560 the SS pin is pin B0 or Digital 53.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- cubitus54
- Flowcode v5 User
- Posts: 110
- Joined: Wed Jun 19, 2013 7:18 am
- Has thanked: 7 times
- Been thanked: 32 times
Re: SPI harware ? Arduino Mega
Hello,
It works: D
I added the line in AVR_CAL_SPI.c:
SPSR = 0x01; // X 2 SPI: 1US transmission @ 16M Arduino Mega.
It would be nice to add the X2 in the software.
It works: D
I added the line in AVR_CAL_SPI.c:
SPSR = 0x01; // X 2 SPI: 1US transmission @ 16M Arduino Mega.
It would be nice to add the X2 in the software.
Flowcode V6.1.2.0(11 05 2015)