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.
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 .
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...
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:
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.
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.
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 .
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!