Go Down

Topic: 32u4 SPI MASTER (Read 200 times) previous topic - next topic


I have a custom board with atmega32u4 based on feather from adafruit. I'm using SPI as master with rfm69. I'm trying to use PB0 (\SS) as an input with a tilt switch to sleep the MCU when the tilt switch is active (switched to GND with a pull-up resistor tied to 3.3v).
It's seems I can read PB0 state but the system can't achive sleep mode.
I can sleep the MCU in another situations, but when the PB0 low the MCU wakes up.
I'm quite confused how to manage this pin as an input.
I read that there is no problem working PB0 as an output with SPI MASTER.
Is there any special setup for this pin working with SPI MASTER??
Can I work with PB0 as an input with SPI MASTER??
Thank you.


Is there any special setup for this pin working with SPI MASTER??
Yes, SS must be an output to actually use the SPI interface as master. If it's an input the SPI subsystem acts as a slave, activating the SPI subsystem if SS goes low (described in section 17.1.2 of the datasheet).

You should not use this pin as an input while the SPI system is active.
A circumvention for your problem may be to turn SPI off while going asleep but that's not a clean solution.


Hi Pylon,
Thank you for your reply.
I will use PB0-/SS as an output.
I could not find clearly this issue in the datasheet... well... I will try to read it again.

Go Up