Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
I2C Fastmode on lm4f Stellaris #343
I managed to implement FastMode in lm4f devices overloading the function:
This should FIX #282 and be totally backward compatible.
Moreover there was a big delay in the red/write function. Using delayMicroseconds and the define SLOWMODE_DELAYUS is now set to the lowest always working time (From 1ms to 0.2ms).
All the performance data and some code explanation can be found in the link on top of my README.md file.
I only have a lm4f120h5qr and the sensors on a GY-80 so it may require to be tested on the other lm4f board.
To my surprise, Energia 12 supports fast I²C at 400 kHz (Fast-mode) as slave without any specific configuration.
The master was an Arduino board with a modified Wire library including
Like any other protocol, I²C standard is quite confusing as it features many sub-standards.
According to the official I²C-bus specification and user manual Rev. 6 — 4 April 2014, there are four modes:
Are you also considering the four modes, including Fast-mode Plus and High-speed mode?
I've never used IIC as slave, but is nice to know it can be easily used between two stellaris!
I didn't considered the other two fast mode but thanks to the documentation you linked me I have right now.
According to the Driver Library documentation of the function I2CMasterInitExpClk (http://www.ti.com/lit/ug/spmu298/spmu298.pdf [18.104.22.168]) neither of the two can be directly used with the driverlib.
Fast Mode Plus can be implemented simply by setting the right value in the I2CMTPR register. So I did it and tested with my usual GY-80 sensors.
High-Speed mode is not as simple. The datasheet states:
I don't really need this kind of speed (And I don't know if my sensors supports it) but I'll look into it...
Congratulations! Everything works as expected.
Here are the top speeds...
... and the details provided by my logic analyser
Next step: combine it with the clock stretching from #375!
Combining your modified Wire library with the two clock-stretching #375 related functions
I've never used the clock stretch but at a first glance it might be missing
in the end of the resume() function. Obviously I'm far from sure since all the documentation I've found is about using I2CMasterTimeoutSet.
I hope this may help.