I'm using FastLED with a custom board built around the ATMega32u4. When I set it to use Software SPI, everything works fine, but when I use hardware SPI it just hangs whenever it tries to write out the data (FastLED.show()).
I originally mocked this up on an Arduino Pro Micro and it worked fine there. That makes me think that it's a hardware issue but, as I mentioned, SPI output does work, but only when bit-banged. Which really doesn't make much sense.
I tested this by also just using the built in SPI classes and I get the same thing. No luck with hardware SPI.
Anyone else ever see something like this?
The schematic of my circuit is below.
enter image description here
-
Have you checked SCK/MOSI with an oscilloscope to verify if some signal was sent?jfpoilpret– jfpoilpret2014年08月11日 06:32:45 +00:00Commented Aug 11, 2014 at 6:32
1 Answer 1
According to ATmega32u4 datasheet, section 17.2.1 (SPI / SS Pin Functionality / Master Mode:
If SS is configured as an input, it must be held high to ensure Master SPI operation.
In your circuit, SS pin (#8 on package), also labeled as "(SS/PCINT0) PB0", is left unconnected.
Is it possible that PB0 is also configured as input somewhere in your program or libraries? In this case, it should be connected to Vcc.
-
YOU ARE MY FAVORITE PERSON RIGHT NOW!! I was testing on a Pro Micro and it just happened to have that pin connected to VCC through an LED and resistor. So, it made it work. pinMode(0, OUTPUT) made it all work again :) THANKS!Adam Haile– Adam Haile2014年08月11日 17:11:02 +00:00Commented Aug 11, 2014 at 17:11
-
Just to add. Instead of connecting to vcc you can also just enable the internal pull-up resistor.Gerben– Gerben2014年08月11日 18:38:30 +00:00Commented Aug 11, 2014 at 18:38
-
Or just configure the pin is OUTPUT which is the easiest way, and it enables you to use that pin for something else. That's probably the best option.jfpoilpret– jfpoilpret2014年08月11日 19:40:40 +00:00Commented Aug 11, 2014 at 19:40