Hi everyone!
i bought couple of Pro Micros as in features description on SparkFun there was info it has SPI which i mostly use in my projects. It turned out that there is no SS (Slave Select) pin broken out! Apart from the question: who was smart enough to omit this important pin, the question now is how to manage to use this board as SPI Slave device. Hardware SS pin is necessary to put Pro Micro in slave mode. So the closer look at the board look like this:
It looks like i do not need to desolder the resistor (330 R), just solder the wire as in the photo (green wire). So the hardware part is easy but my question to you guys is: How to enable SS functionality? Normally this pin is used to control LED and is showing data transfer over USB. So it means that some built-in code is taking over the control over this pin. What if i set this pin as input in Arduino IDE? How to do it? Should i use C language code for that or just:
DDRB &= 0b11111110 //to set PB0 pin direction bit to zero - input mode
PORTB |=0b00000001 //to set PB0 pin pullup resistor
What if i use USB serial in my sketch? Will the firmware override pin PB0 and cause SPI slave mode will not be possible to use?
I tried to find the answers on the net but no luck. No clear answer.
Do you know that SPI is one of the best comm protocol available in microcontrolers world? It would be a shame not to have possibility to use it on Pro Micro - and i’m not talking about Master mode though SS can by emulated by the sketch easily. The problem is to use hardware SS for slave mode.
Please let’s make some good reference here. I’m sure lot of people would love to see the final solution:)
Thank you.
You can use any pin you want for SS, as there is no set pin for that. You just need to specify in your code what pin you’re using.
I’ve never tried to use an Pro Micro (or any other Arduino) as a SPI slave so I can’t really assist with that, but you might have a look at the links below to see if they offer any advice that might point you in the right direction.
- [[Arduino as SPI Master and Slave Demo Code](https://forum.arduino.cc/index.php?topic=184527.0)
- [[LEONARDO SPI - pinouts correct? can it be a slave?](https://forum.arduino.cc/index.php?topic=255594.0)
- [[SPI - Serial Peripheral Interface - for Arduino](http://www.gammon.com.au/spi)
[/list]](http://www.gammon.com.au/spi)](https://forum.arduino.cc/index.php?topic=255594.0)](https://forum.arduino.cc/index.php?topic=184527.0)
If i want to use Pro micro as a SPI MASTER then SS may be any pin i like. I agree. But what i need is to use is as SLAVE. Already said that:) I want to use hardware SPI. Can you explain me where you get the information that in slave mode i can use different pin that PB0 (SS)? This is hardware SPI slave select pin. I can not change it. In sparkfun product description there is information that the board fetures SPI communication… Well it seem it is not fully true. It like you bought a car and after that you realized that there is no reverse gear! Is reverse gear something you should ask for when buying a car? Or it is something mandatory? So when i see that there is SPI onboard why should i dig to check if i can use it in both modes - MASTER or SLAVE?
Guys you are selling these devices so please provide solution as it is clearly bad design.
Have you seen the picture i attached in my previous post? How about it? I can easily solder a wire. Please tell me if the firmware you guys put as bootloader allow me to control PB0 (SS) pin to configure it as INPUT_PULLUP so the HARDWARE SPI SLAVE mode can be activated?
You are the vendor, right?