|
Re: I2C implementation on the cRIO
Well, folks, I'm getting funny results.
I'm still not sure if the cRIO writes 8 bytes and reads 8 bytes every time. I suspect that it only writes and reads as much as it needs to.
The I2C driver I wrote for the tiny26 works when I test it by hand. (I use pushbuttons to generate the signal, and LEDs to display the signal. There's some stuff in there for debouncing as well.) However, when I hook it up to the cRIO, it works intermittently. Sometimes the cRIO even reads a bit or two offset from what the microcontroller is sending. Sometimes it gives me gibberish (aka does something else I don't yet understand). Most of the time it fails and returns an error.
Unfortunately, until I have access to a newer oscope and more than one set of leads, I can't really look at the signal. Unless I monitor the signal using two GPIO on the digital sidecar. I haven't looked into that yet, but if the digital module is fast enough to output this, then it should be fast enough to input it as well.
My best guess of what is happening is that the cRIO is running the I2C clock a bit too fast for the tiny26, and so most of the time it doesn't work.
Any other guesses?
Does anyone have info on how fast the bus is (as implemented here), and what options like "I2C register" and "compatibility mode" actually do?
I think "compatibility mode" means it deals with ACK and NACK. I have no clue why you WOULDN'T want these features - they are your error checking.
The I2C register input - and I'm only guessing here - might be a message that is sent immediately prior to the read request. I don't know it's actually two messages, or some hybrid form of read and write that isn't in the I2C spec. Maybe this is something from SMBus?
__________________
-- Marshal Horn
|