Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

Multiple *different* spi devices

spi

Best Answer John West, 15 January 2014 - 01:47 PM

So I finally got a logic analyzer.  I learned a lot, but not what was the cause of this.  I have tried different places on the breadboard, different pins, even switched back and forth between an NP+2 and the mini.

 

So, it turns out that it seems like wires.  Now, I can't tell you why.  But when I switched from the solid wires to the breadboard prototyping wires, things worked!  I'm not even kidding.  While I was using solid wires, I did notice some flaking, but never really thought about wire type.  When I say flaking, I mean different results depending on how bent different wires were, or even if I was just touching them or not.  Even now I can put back a solid wire on the mosi line and things will stop working.  It doesn't make sense.  I'll experiment more, but for now, like I say, having all prototype wires immediately let me have the shift register, lcd and oled display all working great.

 

Wire types?  Who knew... some days even more than others I realize how ignorant I am :).

Go to the full post


  • Please log in to reply
5 replies to this topic

#1 John West

John West

    Advanced Member

  • Members
  • PipPipPip
  • 51 posts

Posted 10 January 2014 - 03:08 PM

So I'm playing around with two different spi devices.  One is a shift register, and the other is an LCD display with an SPI controller.  I'm having general issues with getting more than one SPI device working.

 

I thought it was the LCD display at first, but now I realize it might be something electrical.  I replaced the LCD display with a different type of shift register and I'm getting the same issues.

 

The issues are that 1) the LEDs light inconsistently on the first shift register.  Also, if I touch the wires to the second shift register, I get inconsistent results on the first shift register. 

 

My question, broadly, is, does the Netduino (I'm using the mini) support multiple different SPI devices sharing the MOSI line (with different slave lines of course)?  Do they have to have certain similar characteristics (clock speed, etc)?  Are there best practices for wiring them up?

 

I have gotten multiple 74hc595 (sp?) shift registers working with different slave lines before, so I know this is doable in theory.  I'm just wondering if now that I'm trying different type of SPI devices if there are some best practices/recommendations I've missed...

 

Thanks for any insight anyone has...



#2 hanzibal

hanzibal

    Advanced Member

  • Members
  • PipPipPip
  • 1287 posts
  • LocationSweden

Posted 10 January 2014 - 08:58 PM

Yes, the Netduino can certainly talk to multiple SPI slaves, but you must serialize your data transfers. Basically, you create several SPI configurations and swap between these when interfacing to one or the other slave devices using different !CS pins.

 

In a multi-threaded environment, you must make sure that transfers are not interrupting each other. If necessary, use the lock statement to protect your SPI configuration swapping mechanism.

 

There are several implementations available, here's one for you:

 

http://netmftoolbox....rdware.MultiSPI



#3 John West

John West

    Advanced Member

  • Members
  • PipPipPip
  • 51 posts

Posted 11 January 2014 - 04:38 PM

I've got the multi spi software logic handled.  This is something electrical that I just can't figure out.  I can run an OLED display as one slave and an lcd as another at the same time.  And the mbi5026 shift register works by itself.  But put either/or of the displays along with the mbi5026 and the shift register doesn't work.  I think it's some kind of interference or collision with signals, but don't know what. 

 

Interestingly enough, though, sometimes when I just touch the clock wire going to the mbi, it goes wonky.  But I've tried another mbi to make sure it wasn't a bad chip.  And again, by itself, it works great (I'm blinking 14 leds, in case anyone was curious). 

 

Sometimes I can connect a wire to another spi device while the leds are blinking and lock them into being lit.  This lets me me know it's not a voltage thing.  It's like one of the spi signals no longer reaches the device, so it doesn't update.

 

I think I know what someone is going to say... I need to get some type of logic analyzer, don't I?  I'll create another question for that... meanwhile, if anyone has any thoughts on this problem (a resistor or capacitor somewhere, maybe), I'd appreciate it.

 

Thx.



#4 hanzibal

hanzibal

    Advanced Member

  • Members
  • PipPipPip
  • 1287 posts
  • LocationSweden

Posted 15 January 2014 - 02:06 AM

It sounds a bit like the mbi5026 does not honor it's !cs input really well. Have you tried using different Netduino pins for the mbi5026 !cs line or tried adding a pullup resistor on it? The latter might very well do the trick.

#5 John West

John West

    Advanced Member

  • Members
  • PipPipPip
  • 51 posts

Posted 15 January 2014 - 01:47 PM   Best Answer

So I finally got a logic analyzer.  I learned a lot, but not what was the cause of this.  I have tried different places on the breadboard, different pins, even switched back and forth between an NP+2 and the mini.

 

So, it turns out that it seems like wires.  Now, I can't tell you why.  But when I switched from the solid wires to the breadboard prototyping wires, things worked!  I'm not even kidding.  While I was using solid wires, I did notice some flaking, but never really thought about wire type.  When I say flaking, I mean different results depending on how bent different wires were, or even if I was just touching them or not.  Even now I can put back a solid wire on the mosi line and things will stop working.  It doesn't make sense.  I'll experiment more, but for now, like I say, having all prototype wires immediately let me have the shift register, lcd and oled display all working great.

 

Wire types?  Who knew... some days even more than others I realize how ignorant I am :).



#6 hanzibal

hanzibal

    Advanced Member

  • Members
  • PipPipPip
  • 1287 posts
  • LocationSweden

Posted 17 January 2014 - 09:53 PM

Those must have been some really bad wires, at these small currents and short distances, one would think such things should not matter, but there you go. Glad you solved it!







Also tagged with one or more of these keywords: spi

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.