From: Mark Y. <mya...@gm...> - 2006-06-24 21:34:01
|
I've been looking into the I2c communication and it seems to me that I can probably write my own little I2c communication program, so I had a couple of questions. On the robostix side I2c communication is fasilitated by TWI. TWI seems to have its own protocal, so if I issued a command by using something like char buf[1]; buf[0] = 0x01; write(i2c-bus,buf,1); What triggers would i expect to see through the TWI interface. Would I have to standardize my writes to the i2c driver with the TWI interface? Mark |
From: Dave H. <dhy...@gm...> - 2006-06-24 21:39:43
|
HI Mark, > I've been looking into the I2c communication and it seems to me that I can > probably write my own little I2c communication program, so I had a couple of > questions. > > On the robostix side I2c communication is fasilitated by TWI. TWI seems to > have its own protocal, so if I issued a command by using something like > > char buf[1]; > buf[0] = 0x01; > write(i2c-bus,buf,1); > > What triggers would i expect to see through the TWI interface. Would I have > to standardize my writes to the i2c driver with the TWI interface? If only it were that simple. See the datasheet. There's a big state machine you need to run. It is possible to simplify the i2c stuff if you opt to not use interrupts and ignore lots of error conditions. I've written a fully-interrupt driven slave code for the robostix which you're free to use. There is also gumstix side code written as well. There is also a bunch of AVR related code (including i2c master and slave code) over here: http://hubbard.engr.scu.edu/avr/avrlib/index.html -- Dave Hylands Vancouver, BC, Canada http://www.DaveHylands.com/ |
From: Mark Y. <mya...@gm...> - 2006-06-24 22:20:33
|
I guess I'm about to ask you 10 million and 1 questions that prove how little I know about anything, but oh well..... On the gumstix side, how would issue a start? Or is that done on a device level, such that if I set the I2c driver to a specific device and then write to the I2c driver file it will take care of that on its own? Mark On 6/24/06, Dave Hylands <dhy...@gm...> wrote: > > HI Mark, > > > I've been looking into the I2c communication and it seems to me that I > can > > probably write my own little I2c communication program, so I had a > couple of > > questions. > > > > On the robostix side I2c communication is fasilitated by TWI. TWI seems > to > > have its own protocal, so if I issued a command by using something like > > > > char buf[1]; > > buf[0] = 0x01; > > write(i2c-bus,buf,1); > > > > What triggers would i expect to see through the TWI interface. Would I > have > > to standardize my writes to the i2c driver with the TWI interface? > > If only it were that simple. See the datasheet. There's a big state > machine you need to run. It is possible to simplify the i2c stuff if > you opt to not use interrupts and ignore lots of error conditions. > > I've written a fully-interrupt driven slave code for the robostix > which you're free to use. There is also gumstix side code written as > well. > > There is also a bunch of AVR related code (including i2c master and > slave code) over here: > http://hubbard.engr.scu.edu/avr/avrlib/index.html > > -- > Dave Hylands > Vancouver, BC, Canada > http://www.DaveHylands.com/ > > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job > easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > gumstix-users mailing list > gum...@li... > https://lists.sourceforge.net/lists/listinfo/gumstix-users > |
From: Dave H. <dhy...@gm...> - 2006-06-24 23:33:51
|
HI Mark, > I guess I'm about to ask you 10 million and 1 questions that prove how > little I know about anything, but oh well..... > > On the gumstix side, how would issue a start? Or is that done on a device > level, such that if I set the I2c driver to a specific device and then write > to the I2c driver file it will take care of that on its own? Yep. The driver deals with all of the low-level details. -- Dave Hylands Vancouver, BC, Canada http://www.DaveHylands.com/ |
From: Mark Y. <mya...@gm...> - 2006-06-24 23:31:20
|
How consistent is the bus... i.e if I send something from the robostix side, will I get a bunch of NACK s or will it be enough simply send one. Mark On 6/24/06, Mark Yatskar <mya...@gm...> wrote: > > I guess I'm about to ask you 10 million and 1 questions that prove how > little I know about anything, but oh well..... > > On the gumstix side, how would issue a start? Or is that done on a device > level, such that if I set the I2c driver to a specific device and then write > to the I2c driver file it will take care of that on its own? > > Mark > > > On 6/24/06, Dave Hylands <dhy...@gm...> wrote: > > > > HI Mark, > > > > > I've been looking into the I2c communication and it seems to me that I > > can > > > probably write my own little I2c communication program, so I had a > > couple of > > > questions. > > > > > > On the robostix side I2c communication is fasilitated by TWI. TWI > > seems to > > > have its own protocal, so if I issued a command by using something > > like > > > > > > char buf[1]; > > > buf[0] = 0x01; > > > write(i2c-bus,buf,1); > > > > > > What triggers would i expect to see through the TWI interface. Would I > > have > > > to standardize my writes to the i2c driver with the TWI interface? > > > > If only it were that simple. See the datasheet. There's a big state > > machine you need to run. It is possible to simplify the i2c stuff if > > you opt to not use interrupts and ignore lots of error conditions. > > > > I've written a fully-interrupt driven slave code for the robostix > > which you're free to use. There is also gumstix side code written as > > well. > > > > There is also a bunch of AVR related code (including i2c master and > > slave code) over here: > > http://hubbard.engr.scu.edu/avr/avrlib/index.html > > > > -- > > Dave Hylands > > Vancouver, BC, Canada > > http://www.DaveHylands.com/ <http://www.davehylands.com/> > > > > Using Tomcat but need to do more? Need to support web services, > > security? > > Get stuff done quickly with pre-integrated technology to make your job > > easier > > Download IBM WebSphere Application Server v.1.0.1 based on Apache > > Geronimo > > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > > _______________________________________________ > > gumstix-users mailing list > > gum...@li... > > https://lists.sourceforge.net/lists/listinfo/gumstix-users > > > > |
From: Dave H. <dhy...@gm...> - 2006-06-24 23:39:52
|
Hi Mark, > How consistent is the bus... i.e if I send something from the robostix side, > will I get a bunch of NACK s or will it be enough simply send one. Are you talking about the NACK's that occur after each byte? The i2c protocol says that you're supposed to send a NACK when you don't want to receive any more data. The linux driver does this automatically. If you're interested in this level of detail, I suggest that you read the i2c specification and/or the SMBus specification. You can find out more about i2c over here: http://www.i2c-bus.org/I2C_Bus.15.0.html?&no_cache=1 -- Dave Hylands Vancouver, BC, Canada http://www.DaveHylands.com/ |
From: Mark Y. <mya...@gm...> - 2006-06-24 23:54:15
|
I don't think i was very precise with my NACK question. In the case that the master fails to recieve a signal, a NACK will be returned in like 8 clock cycles (Im not sure about 8 but w.e). So the question is: is the data transmission consistent, i.e will data packets dissapear and I will get back NACKs when I just sent a byte of data or will it be like I sent a byte and get an ACK (if the where I am sending is expecting data) no matter what? On 6/24/06, Dave Hylands <dhy...@gm...> wrote: > > Hi Mark, > > > How consistent is the bus... i.e if I send something from the robostix > side, > > will I get a bunch of NACK s or will it be enough simply send one. > > Are you talking about the NACK's that occur after each byte? The i2c > protocol says that you're supposed to send a NACK when you don't want > to receive any more data. The linux driver does this automatically. > > If you're interested in this level of detail, I suggest that you read > the i2c specification and/or the SMBus specification. > > You can find out more about i2c over here: > http://www.i2c-bus.org/I2C_Bus.15.0.html?&no_cache=1 > > -- > Dave Hylands > Vancouver, BC, Canada > http://www.DaveHylands.com/ > > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job > easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > gumstix-users mailing list > gum...@li... > https://lists.sourceforge.net/lists/listinfo/gumstix-users > |
From: Dave H. <dhy...@gm...> - 2006-06-25 00:06:35
|
Hi Mark, > I don't think i was very precise with my NACK question. > > In the case that the master fails to recieve a signal, a NACK will be > returned in like 8 clock cycles (Im not sure about 8 but w.e). So the > question is: is the data transmission consistent, i.e will data packets > dissapear and I will get back NACKs when I just sent a byte of data or will > it be like I sent a byte and get an ACK (if the where I am sending is > expecting data) no matter what? I don't understand what you mean by consistent. i2c doesn't specify any NACKs other than the ones I mentioned (where it uses a NACK on a byte by byte basis). i2c has no notion of retrying. You need to build this layer yourself if you want (although this would only work for devices where you can control both sides). i2c also has no notion of message integrity. SMBus introduces a CRC, but the way its implemented only partially ensures message integrity. -- Dave Hylands Vancouver, BC, Canada http://www.DaveHylands.com/ |
From: Mark Y. <mya...@gm...> - 2006-06-25 00:26:28
|
Dave, ok. Thanks. That actually does answer my question. Mark On 6/24/06, Dave Hylands <dhy...@gm...> wrote: > > Hi Mark, > > > I don't think i was very precise with my NACK question. > > > > In the case that the master fails to recieve a signal, a NACK will be > > returned in like 8 clock cycles (Im not sure about 8 but w.e). So the > > question is: is the data transmission consistent, i.e will data packets > > dissapear and I will get back NACKs when I just sent a byte of data or > will > > it be like I sent a byte and get an ACK (if the where I am sending is > > expecting data) no matter what? > > I don't understand what you mean by consistent. > > i2c doesn't specify any NACKs other than the ones I mentioned (where > it uses a NACK on a byte by byte basis). > > i2c has no notion of retrying. You need to build this layer yourself > if you want (although this would only work for devices where you can > control both sides). > > i2c also has no notion of message integrity. SMBus introduces a CRC, > but the way its implemented only partially ensures message integrity. > > -- > Dave Hylands > Vancouver, BC, Canada > http://www.DaveHylands.com/ > > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job > easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > gumstix-users mailing list > gum...@li... > https://lists.sourceforge.net/lists/listinfo/gumstix-users > |