Jump to content
Sign in to follow this  
L.R.A

[Energia Library] I2C_API on Energia

Recommended Posts

*This is untested and needs testing, i don't have access to any I2C devices currently infortunaly, only next week*

 

 

I ran into this while exploring stellaris features:

http://e2e.ti.com/support/microcontrollers/tiva_arm/f/908/t/235926.aspx

 

It's a very nice API to use the 4 I2C modules in the stellarpad.

Since i had some problems with the Wire library, both getting diferent modules to work or get proper data from a srf08/srf10 i decided to implement this on my energia files.

 

It ended up like this:

https://meocloud.pt/link/5ab528a8-fb5a-4be4-b8f3-29d687b1f52a/Energia

This is what you have to add to make it work. It includes a utils/uartstdio

 

Gona test a bit with some I2C sensors i have but it would be nice to someone test them with some other I2C ICs.

 

Any sugestions would be appreciated

 

PS: i just made some tweaks so it works like a library in Energia for the Stellarpad. I take no credit for the API made since it exists for quite some time.

Share this post


Link to post
Share on other sites

Ok now it's tested and working and here it's in the link i pasted in the previous reply. But how do i actualy make a download link for the zip like i see other people do?

 

It includes a working example with srf08. In this one i can get distances over the 70cm and until the max range of it and also i get very stable values (i had this problem with wire library, limited until 70cm and very erratic values).

 

It supports all I2C modules in both 100kbps and 400kbps mode.

The original API includes a search for bus function but it isn't working here.

 

Also i have a problem. It doesnt unable the library to work but it should be done in other way.

 

I had to add in the I2C_Stellaris_API.cpp so i could use multiple modules, any module besides I2C0 has mux

    #define GPIO_PD1_I2C3SDA 0x00030403
    #define GPIO_PD0_I2C3SCL 0x00030003
    #define GPIO_PE4_I2C2SCL 0x00041003
    #define GPIO_PE5_I2C2SDA 0x00041403
    #define GPIO_PA7_I2C1SDA 0x00001C03
    #define GPIO_PA6_I2C1SCL 0x00001803

But this is in "driverlib/pin_map.h". 

Anyone can help me with that?

 

 

TODO (or untested), 

Use multime I2C modules at the same time

Make it work with MAX6956 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×