I2C Slave mode support?

ChibiOS public support forum for all topics not covered by a specific support forum.

Moderators: RoccoMarco, lbednarz, utzig, tfAteba, barthess

User avatar
Giovanni
Site Admin
Posts: 14457
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: I2C Slave mode support?

Postby Giovanni » Sat Oct 11, 2014 7:12 am

If you plan to port to 3.0 then you may consider putting it in the community repository that barthess and Tectu are restructuring.

Files in that repository will be distributed with normal ChibiOS releases.

Giovanni

genosensor
Posts: 65
Joined: Thu Oct 03, 2013 1:06 am
Location: Santa Cruz, California
Has thanked: 1 time
Been thanked: 1 time

Re: I2C Slave mode support?

Postby genosensor » Mon Oct 13, 2014 6:44 am

Note:
I missed the i2cslave.h file in github commit last Friday.
It's there (in the I2Cmultimaster branch) now.

Regarding 3.0:
Could you point me to document that summarizes the new features and major changes?
Is it more or less feature frozen at this point?
Perhaps, if I knew more about 3.0, I could justify switching to it.

Regarding 2.6 stable:
I forward ported to the latest release because I was getting requests from other users to do so.
And, I wanted to stay current for our own project.
I will continue to support the I2C multimastering driver in 2.6.
The multimastering driver is intended to be backward compatible with the existing master-only driver.
Others have confirmed this.
What, at this point, prevents inclusion of the multimastering driver into the stable release?
Please consider it.
If there's some feature of the existing driver that the multimastering version is not supporting,
please let me know.

User avatar
Giovanni
Site Admin
Posts: 14457
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: I2C Slave mode support?

Postby Giovanni » Mon Oct 13, 2014 8:01 am

Hi,

3.0 is pretty much finished, and interfaces are unlikely to change, there is an article in the documentation section about changes.

Basically, drivers must not use "ch" APIs nor include "ch.h", OSAL functions must be used instead. For example "osalSysLock()" instead of "chSysLock()". This ensures that the HAL can be used with any RTOS implementing an OSAL or even without RTOS.

Giovanni

steved
Posts: 825
Joined: Fri Nov 09, 2012 2:22 pm
Has thanked: 12 times
Been thanked: 135 times

Re: I2C Slave mode support?

Postby steved » Mon Oct 13, 2014 8:46 am

I ported genosensor's work to 3.0 for the 32F4 - posted earlier in this thread.
Has been working solidly for over a month now as an I2C slave; haven't tried multimaster.
The interface works for me.
I do need to revisit it though - possibly its an F4 problem, but is very sensitive to glitches on SCLK, which lock things up. (Fundamentally a hardware problem, but I still don't think it should lock up!) Also (IIRC) didn't recover if received data wasn't properly terminated with a STOP condition.

genosensor
Posts: 65
Joined: Thu Oct 03, 2013 1:06 am
Location: Santa Cruz, California
Has thanked: 1 time
Been thanked: 1 time

Re: I2C Slave mode support?

Postby genosensor » Mon Oct 13, 2014 8:57 am

Steved,

That's good to hear. We've been using the driver in a multimastering network for a few months now. No code changes for quite some time.

What chip did you test with?
(does it use the older V1 I2C module, or the updated V2?)

Where have you posted the code?

Thanks.

genosensor
Posts: 65
Joined: Thu Oct 03, 2013 1:06 am
Location: Santa Cruz, California
Has thanked: 1 time
Been thanked: 1 time

Re: I2C Slave mode support?

Postby genosensor » Mon Oct 13, 2014 9:03 am

Giovanni,

Is this the article you mean?

http://www.chibios.org/dokuwiki/doku.ph ... rom_2_to_3

Is there any documentation on the OSAL layer?


Can you speak to the issues preventing inclusion of the I2C multimastering driver into 2.6?

User avatar
Giovanni
Site Admin
Posts: 14457
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: I2C Slave mode support?

Postby Giovanni » Mon Oct 13, 2014 9:11 am

There is no documentation yet for 3.0, see /os/hal/osal/rt/osal.h for details about the API.

2.6.x is in maintenance mode, nothing will be added there, only bugs fixed.

Giovanni

steved
Posts: 825
Joined: Fri Nov 09, 2012 2:22 pm
Has thanked: 12 times
Been thanked: 135 times

Re: I2C Slave mode support?

Postby steved » Mon Oct 13, 2014 9:23 am

genosensor wrote:What chip did you test with?
(does it use the older V1 I2C module, or the updated V2?)

Where have you posted the code?

Working with the 32F4 ATM, which is the V1 I2C module. Will need to port to the 32F0 (V2 I2C) at some point.

Code here: http://forum.chibios.org/phpbb/viewtopic.php?f=2&t=1502&start=20#p17146

steved
Posts: 825
Joined: Fri Nov 09, 2012 2:22 pm
Has thanked: 12 times
Been thanked: 135 times

Re: I2C Slave mode support?

Postby steved » Thu Nov 20, 2014 2:37 pm

Found a bug in the port of genosensor's I2C slave/multimaster routines to Chibi 3 - a missing critical section.

Updated routines attached.

Have also made what I hope are improvements in master mode - easily reversible with a #define if necessary.

Haven't tested multimaster mode at all.
Attachments
ST_I2C_V1.zip
(25.52 KiB) Downloaded 293 times

genosensor
Posts: 65
Joined: Thu Oct 03, 2013 1:06 am
Location: Santa Cruz, California
Has thanked: 1 time
Been thanked: 1 time

Re: I2C Slave mode support?

Postby genosensor » Sun Dec 28, 2014 7:04 am

Thanks for spotting these omissions.
I've updated the 2.6 multimaster I2C driver in my github repo on the branch "I2Cmultimaster"

Code: Select all

git clone https://github.com/brentr/ChibiOS-RT.git
cd ChibiOS-RT
git checkout I2Cmultimaster


Return to “General Support”

Who is online

Users browsing this forum: No registered users and 48 guests