High speed I2C?
KenBash
Posts: 68
I've been using the I2C functions to drive·the ·4 channel 16 bit DAC8574 chip for quite a while now and it works great. However... I have a new application needing higher speed analog.·
The chip is capable of going from standard speed ( 100kbs clock rate ) up to 3.4 mhz high speed mode.
I don''t see any provision for switching speed modes in the current I2cObject.
I've ttried searching the Parallax web, but didn't find anything specific on this.
·Has anyone already done a high speed I2c com function for chips like this?··· I'll bit bang it if necessary , but it would be nice not to have to.
Thanks,
Ken Bash
<subject added by moderator>
Post Edited By Moderator (Paul Baker (Parallax)) : 1/11/2008 8:45:42 PM GMT
The chip is capable of going from standard speed ( 100kbs clock rate ) up to 3.4 mhz high speed mode.
I don''t see any provision for switching speed modes in the current I2cObject.
I've ttried searching the Parallax web, but didn't find anything specific on this.
·Has anyone already done a high speed I2c com function for chips like this?··· I'll bit bang it if necessary , but it would be nice not to have to.
Thanks,
Ken Bash
<subject added by moderator>
Post Edited By Moderator (Paul Baker (Parallax)) : 1/11/2008 8:45:42 PM GMT
Comments
I KNEW you'd be one to answer and I know that·like a lot of us out here, I ·appreciate the effort you put into it.
I guess I'll look into doing an assembly function to make this work.
If I get something reliable... I'll post the code.
Thanks for the help.
Ken Bash
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
" Anything worth doing... is worth overdoing. "
··············································· ( R.A.H. )
····································
http://forums.parallax.com/attachment.php?attachmentid=51206
Note: there are also Mike's femtobasic routines in the zip, but that's for reference only...
Well it's the spdiFemto.spin file.... But from line 227 on it contains an I2C driver in machine code..
T'was some weeks ago... Sorry, I got confused with this - never used the NNVAR...
That's *not* my I2C code! I think I said that, and I realy have to credit Mike's work.
I just cut out the most obvious SD-code (I think).
I am using it a 400kHz and I do not have the impression that it is making problems.
Just coming back from a fair of model-engine builders where I wanted to demonstrate my Prop-based ignition. But I failed to get the motor running I have built the system for as a demonstration-platform. I didn't get enough compression to get the motor running. I didn't get the valves tight enough (*not* my first ones). Anyhow, still a success.
I hope that I will find the time now to make an I2C-routine in ASM using Mike's code as a start.
Nick
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Never use force, just go for a bigger hammer!
The DIY Digital-Readout for mills, lathes etc.:
YADRO
I know this is not the way to "test" a piece of software. I'd be nice to get an answer to why it wouldn't work at 400KHz since the timings seemed to be just adequate for the I2C EEPROM specs, but I don't have a scope nor access to one. I don't think it would be noise since I was using a Demo Board with an extra EEPROM on it with short leads and a bypass capacitor on the breadboard next to the EEPROM. Anyway, I made the bus speed configurable and made 100KHz the default.
Did you use waitcnt after a write?
I just used a writeWait after every write and that worked well.
If you invest some time in coding a real blockwrite (in Spin), the writeWait isn't such a penalty and it also waits exactly as long as the device needs (IIRC, the time might vary, read the datasheet).
Of course, that would be even faster in ASM.
Nick
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Never use force, just go for a bigger hammer!
The DIY Digital-Readout for mills, lathes etc.:
YADRO