I need to use my Arduino Uno (ATmega328) as an SPI slave and have still have access to at least 5 PWM pins. The only issue is that this means I will have to use pin 10 (Slave select / PB2) as the fifth PWM pin because pin 11 (MOSI / PB3) is definitely not an option and it appears that the moment I initiate SPI in slave mode it stops PWMing pin 10 and simply turns it off. Would it be possible to somehow restore PWM access to this pin? I do not need this pin for slave select, I can rather use a plain IO and just attach and detach SPI upon interrupts from it thereby emulating slave select.
Arduino pin 10 for PWM whilst SPI slave
arduinoatmegaavrpwmspi
Related Topic
- Redefining Slave-Reset-Pin in MegaISP on ATmega2560
- Electronic – Do I need SS for SPI single-slave communication
- Electronic – Design review: SPI, ISP and multiple slaves
- Electronic – Arduino PWM pin vs digital pin PWM simulation
- 8 bit SPI Microcontorller interface with 16 bit SPI slave
- Electronic – SPI slave without MISO pin
- Electronic – No CS pin available on components (external ADCs) with SPI interface to choose one
Best Answer
The ATmega328p datasheet section 18.3.1 states
where using the SPI in slave with out a SS would likely have issues with sync'ing the first bit of the data. Where if that is not a problem then I would suggest that perhaps a Leonardo would solve your problem. It has 8 PWM's, none on the SPI. Whereas its SPI SS is wired to the RXLED and not to a header. Otherwise the Mega would have all what you want.