<< return to Pixycam.com

Arduino SPI with SS multi devices

Hello
I have problem connecting Pixy2 and PS2 gamepad using SPI with SS on arduino UNO.
When only one of these devices is connected on the arduino everything works.
When devices are connected at the same time, nothing work. Pixy 2 answers “No response” and the ps2 gamepad send always the same value.
I use two differents pins for SS, pin 10 for gamepad and 9 for Pixy 2.

-Reading Pixy2SPI_SS.h file, I see pixy2 is declared using Mode1 (the doc mention mode3?) SPI.beginTransaction(SPISettings(PIXY_SPI_CLOCKRATE, MSBFIRST, SPI_MODE1)); in open method.

_gamepad using a lower clockrate compared to pixy2.

-Pixy2 and gamepad init() method are declared in the setup

Does somebody know if one of the prevous can explain why these 2 devices don’t work togeteher in SPI mode.

PS: I have tried to connect Pixy2 in I2C and gamepad in SPI with SS and everything works. I would like to connect pixy in SPI to increase data transfer rate even if it works in I2C.

Thank you for your answer.

Jérome

Hello,
You say that when one of these devices is connected it works. But doesn’t work when they are both connected. If the SS is enabled for both devices at the same time (or if the devices think SS is enabled), this would explain this behavior. Have you checked your SS signal, making sure they are enabled only when you are talking to the specific device?

Edward

Hello
Thank you Edward for your quick answer.
I’m going to verify if the 2 SS lines are not activated at the same time.

When you say “or if the devices think SS is enabled”, does it mean that i have to pullup to VCC each SS to avoid a floating voltage. If yes, what is the value of resistor i need to use?

Thank you

Jérome

Hi Jerome,
I meant that you should make sure that your devices have low-going slave selects if you’re using low-going slave selects and vice-versa.

Edward