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.
I am trying to get an I2C LCD working with my ND Plus 2. This is an ongoing project that has been running successfully on an original Netduino Plus "1".
The LCD, SCL/SDA pullups (4.7k) and some other buttons, etc for my project are all part of a prototype shield
The shield and software works fine on my ND Plus ("1" not 2). That is, the exact same shield, LCD and software.
I have jumpered the new SCL/SDA pins to A4/A5
I am using firmware v18.104.22.168 on the ND2 Plus
I2C.Execute is returning 0 every time it gets called. The rest of the application appears to be running OK (just no LCD output!). Is there something else I need to do to migrate my I2C functionality from the original ND Plus to the "2" (other than the new I2C pins, that is)
I second bi qin's suggestion of taking an actual look at the waveform. I want to add this from my recent experience if it's useful:
* I was needing a ds1307, and put it on the special sda/scl lines. what could be simpler, right? well it didn't work
* I fiddled with it for quite a while but miraculously my scope arrived later that day. guess what -- no output whatsoever. hmm.
* I flashed my NP2 with firmware 22.214.171.124, and guess what? worked perfectly.
* I flashed back to 126.96.36.199, and it failed. Hmm
Ultimately in my case, I had to hook my device to the a4/a5 and bitbang i2c (I have an in-between shield that does not pass through the newer pins), which also worked fine for me, and so I haven't gotten back to looking at the firmware issue.
so, do look at the waveform -- it might not be you.
I found some odd issues with I2C logic in the controller used for the NP2+. The I2C state machine in this part has a locking condition, which is stated in the datasheet and errata for this part, but without and debugger and a scope it can be hard to determine if this is the issue. I did verified that this is in fact a real issue with the latest firmware, thanks to ziggurat29's posts about how to compile the source.
Thanks for your reply, but have already jumpered the new SCL/SDA pins to A4/A5, so it should be working.
Perhaps I'm missing the point here, but why are you at all bridging the I2C pins - is it because you use some kind of shield with fixed wiring?
If you're otherwise not using A4/A5 from your Netdino, they could easily be in a default configuration where they have a strong negative effect on the I2C data line. You could try configuring them as digital inputs and see if that helps.
...The I2C state machine in this part has a locking condition, which is stated in the datasheet and errata for this part, but without and debugger and a scope it can be hard to determine if this is the issue. I did verified that this is in fact a real issue with the latest firmware...
Mmm! thanks, yogotie, for figuring that out and reporting it, along with your change to fix it. To bad we don't have a process by which to submit patches (or even a reliable way to get the current and historic firmware source).
A4/A5... is it because you use some kind of shield with fixed wiring?
In a sense, yes. I have a shield based on a arduino protoshield, which I made for use with the original netduino plus. My application ended up running out of memory, and then right on cue, along came the plus 2. So I am using a board that was made for the old layout.
... bi qin's suggestion of taking an actual look at the waveform
I don't have an oscilloscope so I cannot test anything with that. I have decided to make a new shield and use Mario's design (here: http://tinyclr.it/th...lcd-module.aspx), which uses straightforward digital I/O on the netduino rather than I2C. As a plus, since it uses a shift register IC, I end up with a design with an LCD that I can buy for $3 instead of a $15 I2C one.
If you're otherwise not using A4/A5 from your Netduino, they could easily be in a default configuration where they have a strong negative effect on the I2C data line. You could try configuring them as digital inputs and see if that helps.
I will give that a try, as it would be good to know if it works, even though I am going to use the shift register solution.
Yes, Mario's SPI driven LCD Boost library using s shift reg is probably the badest boy in town right now. It would be nice if you came back with a post on how that turns out for you. I've been looking to use his lib myself one of these days...
I changed up the driver ever so slightly to use NooM's i2c method, set a few things public and I can now write without a problem on my N+2 with the latest firmware. I have a couple i2c devices on the bus (the LCD and a PWM controller) but now that the LCD works the PWM doesn't appear to be working.
EDIT: Whichever device I call first seems to work, haven't gotten'em both working on i2c. Figures.
EDIT # 2 - Seems to be a timing + voltage spike when the power supply turns on + threading issue, probably can all work together fine.
Thanks Qi, my original board already had pullups on the I2C lines. I have gotten the shift register to work OK, took a little while because I had accidentally swapped the wire from the shift register MR pin & R4 (they were each connected to the wrong wire on the transistor). Once I figured that out it worked straight away :-)
Here's the fritzing diagram for those who are interested. The shift register part is 100% based on Mario's breadboard layout here.
The resistors on the protoshield board and accompanying headers on the stripboard are pullups for three pushbuttons used to control a menu on the LCD, so if all you are doing is making an LCD you can ignore them.
This layout is definitely not the best, there are a number of mistakes which I will eventually need to fix:
[*]The LCD has a female header block soldered onto the bottom which connects to the male header block at the right-hand side, which means the contrast adjustment is underneath the LCD! I may end up just soldering the pot to the bottom of the board on my next revision (or move it). [*]There are a few more wires (the yellow ones) then there needs to be, on my next revision I will try to line up the LCD control wires with Q4,5,6 on the shift register to make it a little simpler. [*]And of course the board is fairly widely spaced out as its a version 1, it could be a little more compact. Hopefully I can squeeze it into a protoshield size eventually. [/list]
Everybody seem to use a potentiometer for brightness and/or contrast. Why not use PWM instead?
Sure, it eats two more pins but personally I find it more elegant and you could easily implement ambient light auto-compensation with a photoresistor wired to the ADC.
I use the NP2 and the V188.8.131.52.
If I get it right, I have to use a pull up resistor on both wire to the positive potential. The I2C Output is 3.3V . Can i connect the pull ups to 5V or is it still better to connect the resistors to 3.3V ?
I just found a thread in the board that answer my question. So i think the Outputs are in the Open Collector mode and so the high signal must generate via pull up resistors. So I can pull up to 5V. I think this must be fine
I just got ND+2 and SainSmart IIC/I2C/TWI Serial 2004 LCD but am having problems getting it to work. My wiring diagram between the LCD and ND+2 is pretty simple: Vcc -> 5V, Gnd -> Gnd, SDA -> SD and SCA -> SC. I did not tie the A4 and A5 pins though. Do I have to do that? Also do I need pullup resistors for the SDA and SCA connections? I use the LCD library from http://microliquidcr...l.codeplex.com/ but no luck. If anyone has successfully get the ND+2 and said LCD to work, please help me by sending your wiring diagram and sample code with the library that you use. Many thanks.