2

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 Aug 11 '14 at 6:32
5

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 Aug 11 '14 at 17:11
  • Just to add. Instead of connecting to vcc you can also just enable the internal pull-up resistor. – Gerben Aug 11 '14 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 Aug 11 '14 at 19:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.