multiple SPI devices

Post any hardware related questions about your WiShield 1.0 here.

Re: multiple SPI devices

Postby howard » Sun Jul 11, 2010 2:19 pm

Hello,

same problem, multiple slaves on spi with wishield :

I have change scp1000::init to make the sensor work on another pin (7) slave as explained here: http://www.arduino.cc/cgi-bin/yabb2/YaB ... 1227719581
If i disable Wifi.init() and Wifi.run() the sensor works but when i enable these two methods, it doesn't.

The problem comes certainly from the double initialization of spi interface ?
I have look into wishield spi initilization and i think i must disable the scp1000 init and modify something into (but how please?) :

spi.h here ?
Code: Select all
#ifdef USE_DIG8_INTR
#define SPI0_Init()                  DDRB  |= SPI0_SS_BIT|SPI0_SCLK_BIT|SPI0_MOSI_BIT|LEDConn_BIT;\
                              DDRB  &= ~(SPI0_MISO_BIT|ZG2100_INTR);\
                              PORTB = SPI0_SS_BIT;\
                              SPCR  = 0x50;\
                              SPSR  = 0x01
#else
#define SPI0_Init()                  DDRB  |= SPI0_SS_BIT|SPI0_SCLK_BIT|SPI0_MOSI_BIT|LEDConn_BIT;\
                              DDRB  &= ~SPI0_MISO_BIT;\
                              PORTB = SPI0_SS_BIT;\
                              SPCR  = 0x50;\
                              SPSR  = 0x01
#endif

//ZG2100 SPI HAL
#define ZG2100_SpiInit               SPI0_Init

or into zg_init into g2100c :
Code: Select all
void zg_init()
{
   U8 clr;

   ZG2100_SpiInit();
   clr = SPSR;
   clr = SPDR;

   intr_occured = 0;
   intr_valid = 0;
   zg_drv_state = DRV_STATE_INIT;



Thanks in advance,
howard
 
Posts: 2
Joined: Thu Jun 24, 2010 6:35 am

Re: multiple SPI devices

Postby keebler71 » Fri Oct 08, 2010 8:14 am

Good news and bad news... I ran into the same problem when trying to log SCP1000 data to an uSD card via SPI. From other forums (I think the arduino forums but can't find the post now) the concensus was that the SCP1000 does not play well with others on the same SPI bus. Specifically, it appears to ignore its CS pin and spew junk on the MISO bus when it should be quiet. This is consistent with why either part would work fine on its own but not when on the same bus. That is the bad news.

The good news is I eventually got it working by setting aside 4 more pins and using them as a dedicated SPI bus for the SCP1000. I did have to write my own bit-bang SPI code but it was actually pretty easy - in fact I think I just copied the code on the wikipedia entry for SPI and converted it to arduino-ese. Hope this helps!
keebler71
 
Posts: 1
Joined: Fri Oct 08, 2010 8:07 am

Re: multiple SPI devices

Postby linstead » Sat Nov 06, 2010 8:26 am

Glad to hear you got it working keebler71 - I'd given up on it. I've had a look at the code on the Wikipedia page for SPI but can't work out how to turn it into arduino code that works with the SCP1000. Can you share your code so I can use it as an example to follow?

Thanks,

C.
linstead
 
Posts: 3
Joined: Fri Jul 31, 2009 6:05 am

Previous

Return to WiShield 1.0

Who is online

Users browsing this forum: No registered users and 1 guest