SPI - multiple devices with slave select

15 Mar 2010

Hi, I wonder if someone could please clarify something regarding SPI;

 

Im running multiple slaves of a single SPI port by using a slave select bus. This is a pretty standard layout and works well. My question is when your using devices that run on different SPI formats (polarity and phase) IE the mobileLCD which of the top of my head runs on format 1 spi.format(8,1) and a ADXL345 which runs on format 3 spi.format(8,3). I have already had this working but after doing some slight rewiring the LCD appears not to function when i reset the SPI format.

When you set up a second SPI on the same port, does the MBed automatically switch between the 2 (or more) formats, or does the format become associated with the port and would need to be changed again before communication with another device?

thanks, martin.

15 Mar 2010

Depends on the implementation, but I suspect you need to reset the format each time.

16 Mar 2010

Hi Martin,

 

I'm running an AD345 on SPI, but get a lot of noise from the MBED even when running without the USB and on batteries - about +/- 10 counts or more at times.  Did you have a similar problem? I've tried moving away from the PC and decoupling the AD345 but it doesn't seem to make much difference.  The scope shows a lot of spiky noise about.

 

Tim

10 Apr 2013

if any body have verilog code for spi slave?please send to me