where's app_i2c_shared_demo ?

If you have a simple question and just want an answer.
User avatar
bowerymarc
Active Member
Posts: 40
Joined: Mon Dec 30, 2013 7:29 am

where's app_i2c_shared_demo ?

Post by bowerymarc »

I'm having a bit of trouble using module_i2c_shared, and there's no documentation or demo app that I can find. Where's app_i2c_shared_demo?


User avatar
infiniteimprobability
XCore Legend
Posts: 1126
Joined: Thu May 27, 2010 10:08 am

Post by infiniteimprobability »

There isn't currently an app/example for that, however, perhaps this might help (attached file below).

To use module_i2c_shared you need to call through C (rather than XC) to workaround the compiler parallel usage check. The compiler correctly identifies passing the same ports to different logical cores as a dangerous thing to do (it could cause a runtime exception). However this version of i2c uses a lock to safely access them, so in this case it's OK to trick the compiler. This is done by calling via C.

One or both of the cores calling i2c needs to go via C. In the attached example, they both call via C.

Hopefully it's simple enough to follow..

SOme notes:

- module_i2c_shared listed in Makefile modules

- init_i2c called before the write function in task1

- read of i2c in task2 is delayed with a rather generous 1 second wait
You do not have the required permissions to view the files attached to this post.