Go Down

Topic: SPI SSD1306 and nrf24L01+ not getting along (Read 1 time) previous topic - next topic

Rural

Feb 21, 2015, 01:36 am Last Edit: Feb 21, 2015, 01:58 am by Rural
I have two modules connected to an Arduino Pro Mini over SPI, an SSD1306 128x64 display and a nrf24L01+ wireless module. Individually, both work wonderfully. With both on the hardware SPI bus the nrf24L01+ seems to work fine, but the SSD1306 display is useless except for displaying garbage. I've tried several different sketches to try to tease out what is wrong. If a sketch sends any information via the nrf24L01+, and therefore the SPI bus, garbage results on the display. The nrf24L01+ is connected to the Arduino with SCK->13, MOSI->11, MISO->12), the nrf24L01+ with CS->7 and CE->7, the SSD1306 with CS->10 and A0->9. (I'm not really sure what A0 is.)

Doing a bit of reading on the Arduino implementation of SPI, it looks like I may have to use software SPI for this. Sound about right?

Update: I tried using the same configuration (didn't move any wires around) with software SPI. I get approximately the same affect. It seems like the display doesn't honour the CS signal, and treats all data sent over the SPI bus as something it should act upon.

MarkT

That's not uncommon to encounter non-conformant SPI devices alas - you may be able to add an external gate or two to handle this.

I've just been interfacing to a chip with SPI that's as you'd expect except that the CS is
active high...  At least that's not actually anti-social.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

groundFungus

You might need to check which mode the SPI clock is set to for each device.  There are 4 modes which determine the clock polarity and phase.

DaveO

Not certain if this is related, but I was using a Mega 2560 where the CS is pin 53.

If I wanted 2 different SPI devices to run ( in my case an Ethernet module, and an SD Card module ) the trick was to :

1. share all the SPI pins between the 2 devices, except the CS pin.

2. set a seperate CS pin for each device - do not use the default CS pin for either device

3. Set the ( now unused ) default CS pin 53 ( 53 on the Mega 2560 ) as an Output / High in the setup

4. each time I wanted to use the EtherCard library on the ethernet module, I had to start with 'ether.begin ...', otherwise the ethernet module would just not work.



Rural

Thanks for the suggestion Dave. I've got a variety of SPI displays on the way. If none of them work as I hope, I'll try something like what you suggest.

Groundfungus, I'll look into that. Since it doesn't seem like the mode is something that can be changed on a SPI device, it would sure be nice if the mode was listed somewhere on the seller's product page.


groundFungus

The data sheet should have a timing diagram that shows clock polarity (clock idle state) and the polarity of the sampling edge if the mode isn't specified elsewhere.

Go Up