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.

justinbobo

Member Since 26 Feb 2013
Offline Last Active Aug 04 2017 11:23 PM
-----

Topics I've Started

N+2 I2C clock doesn't run

29 January 2015 - 09:16 PM

I'm trying to command a EA DOGXL160 LCD display with my N+2 via I2C but I can't seem to get it to work. I've finally tried putting my scope on the SCL line and found that it just stays high. Based on another thread dealing with an unrelated issue, I tried this code:

 

OutputPort q = new OutputPort(Pins.GPIO_PIN_SCL, true);
            q.Write(false);
            q.Dispose();
 
and stepped through it. It does indeed go low on the second line, then goes back high after it's disposed. So I think that means my pullup resistors are okay since the Netduino CAN pull the clock line down, right? But FWIW, I have 4.7k resistors on there. (And I have tried commenting out those three lines in case they were somehow causing SCL to stay high after the OutputPort was disposed.) Just for grins, I tried swapping to 1k resistors because the datasheet for the display says there's already internal resistance ("600-100 ohm or more") on the I2C lines. Same result.
 
I've gotten I2C to work before on a N+2 with an expander (MCP23008 if I remember correctly) but I can't seem to find that code. I do recall running into issues with 4.1 firmware, but those problems were resolved when I flashed 4.2.2.2. I was still running 4.2.2.2 when I started troubleshooting this issue.
 
I have several N+2s lying around. I tried swapping them out in case it was a hardware issue. No dice.
 
I was originally using the I2CBus class. (2 reasons: that's what I got to work with the expander a year or two ago, and the display requires different I2C addresses for send/receive and command/data.) It would throw an exception when it tried to write the initialization commands. Stepping through the code, the exception was thrown when bytes written was 0. That's when I pulled out the scope.
 
So after getting nowhere with that other than finding that SCL wasn't moving, I decided to get rid of I2CBus and use MultiI2C from the NETMF toolbox. No change. (Well, now it no longer throws an exception when it tries to write, but according to the scope, it's not writing.)
 
Next, I tried upgrading everything from 4.2 to 4.3.1 and using VS Express 2012 instead of 2010. No change.
 
I also tried using A4/A5 instead of SDA/SCL with both firmware versions.
 
I'm assuming that the SCL line should be toggling all the time, but in case I'm wrong and it only runs when data is being sent, I put my Write command in a for loop that runs 100 times just to make sure that I wasn't just missing the change on my scope because it went by too quickly. I also tried hooking my scope up to the SDA line while it ran through that loop. Still just stayed high.
 
Here's my code. Removed unrelated variable declarations for clarity/readability. I left the for loop in there.
 
            OutputPort q = new OutputPort(Pins.GPIO_PIN_SCL, true);
            q.Write(false);
            q.Dispose();
            
            MultiI2C writeCommand = new MultiI2C(0x78);
            MultiI2C readStatus = new MultiI2C(0x79);
            MultiI2C writeData = new MultiI2C(0x7A);
            MultiI2C readData = new MultiI2C(0x7B);
 
            
            byte[] initialize = new byte[] { 0xF1, 0x67, 0xC0, 0x40, 0x50, 0x2B, 0xEB, 0x81, 0x5F, 0x89, 0xAF };
                    //These are all initialization commands from the datasheet
                    for (int i = 0; i < 100; i++)
                    {
                        writeCommand.Write(initialize);
                        Debug.Print(i.ToString());
                    }                   
 
I don't think it has anything to do with it, but in the interest of being thorough, here's the datasheet for the display: http://www.lcd-modul...dogxl160-7e.pdf

 

Sorry this is so long, just trying to give as much info as possible. Any ideas where I should go from here?


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.