Hello folks,
I've followed this post with attention.
I'm working on STM32F401 and very interested in ChibiOS, which seems to fit exactly my needs.
I have to use both I2C Master and I2C Slave on the same board.
What I understood is that I2C Slave isn't supported yet in official release (2.6.6).
I've tried the .zip file attached earlier in this topic, but it seems to be designed for the future 3.0 release, is it right ?
Does this mean that only ChibiOS developpers can try and troubleshoot the I2CSlave for now, or is there any way to have it integrated to a beta release of Chibi ?
Thank you for your work & help,
NB
I2C Slave mode support?
Moderators: RoccoMarco, lbednarz, utzig, tfAteba, barthess
- 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?
Hi,
If you download ChibiStudio preview 8 you will find both 2.6.6 and 3.0.0. Alternatively you can get 3.0 from the repository.
3.0.0 is almost ready for release and it is usable right now.
Giovanni
If you download ChibiStudio preview 8 you will find both 2.6.6 and 3.0.0. Alternatively you can get 3.0 from the repository.
3.0.0 is almost ready for release and it is usable right now.
Giovanni
Re: I2C Slave mode support?
Hi,
I'm getting i2c working, but i2cSlave mode remains a bit confusing to me, despite of the comments embedded in the code.
Would anyone have some lines of example on how to setup and use I2CSlaveMsg & callbacks for receiving & replying ?
This would be of great help ...
Thank you,
NB
I'm getting i2c working, but i2cSlave mode remains a bit confusing to me, despite of the comments embedded in the code.
Would anyone have some lines of example on how to setup and use I2CSlaveMsg & callbacks for receiving & replying ?
This would be of great help ...
Thank you,
NB
-
- 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?
I've attached examples of using the I2C slave API via low-level callbacks and via the i2cslave thread based API.
These examples both output status text via the DCC facilities of the STM microprocessors.
Start by cloning my git repo at: https://github.com/ChibiOS/ChibiOS-RT.git
checkout the I2Cmultimaster branch from that repo
Unzip the attached debugput.zip in the os/various subdirectory of that branch
Then, unzip the i2cslave.zip projects somewhere else.
You may have to alter the paths in their Makefiles.
They assume the chibios lives in $(HOME)/chibios
[ actually in $HOME/$(CHIBIOS) ]
I know that the latest versions of openocd support DCC output with gcc, but I'm not sure about other tools.
If the DCC stuff becomes a stumbling block for you, just alter the examples to use a dedicated serial port instead.
I'd recommend using the thread based API defined in i2cslave.h unless you are extremely memory constrained.
It is really a library built on top of the driver's low-level call back API.
All this is 2.6 based. I've not tested it on 3.0.
I've willing to help if you want to try to port it to 3.0.
Hope this helps.
These examples both output status text via the DCC facilities of the STM microprocessors.
Start by cloning my git repo at: https://github.com/ChibiOS/ChibiOS-RT.git
checkout the I2Cmultimaster branch from that repo
Unzip the attached debugput.zip in the os/various subdirectory of that branch
Then, unzip the i2cslave.zip projects somewhere else.
You may have to alter the paths in their Makefiles.
They assume the chibios lives in $(HOME)/chibios
[ actually in $HOME/$(CHIBIOS) ]
I know that the latest versions of openocd support DCC output with gcc, but I'm not sure about other tools.
If the DCC stuff becomes a stumbling block for you, just alter the examples to use a dedicated serial port instead.
I'd recommend using the thread based API defined in i2cslave.h unless you are extremely memory constrained.
It is really a library built on top of the driver's low-level call back API.
All this is 2.6 based. I've not tested it on 3.0.
I've willing to help if you want to try to port it to 3.0.
Hope this helps.
- Attachments
-
- debugput.zip
- Debugging output via ARM's DCC mechanism
google "arm dcc" - (6.16 KiB) Downloaded 265 times
-
- i2cslave.zip
- Updated I2C multimaster (master and slave) API examples
- (15.38 KiB) Downloaded 318 times
Re: I2C Slave mode support?
Thank you for the quick reply.
I'm actually trying to use the i2cSlave with ChibiOS V3.0, as mentioned by steved. I'm running on 32F401.
The examples you're providing genosensor will run only under V2.6. I guess they won't help me a lot with 3.0.
Porting them to V3.0 would be a good idea, but I first have to understand how the things are working on V3.0.
I'm actually trying to use the i2cSlave with ChibiOS V3.0, as mentioned by steved. I'm running on 32F401.
The examples you're providing genosensor will run only under V2.6. I guess they won't help me a lot with 3.0.
Porting them to V3.0 would be a good idea, but I first have to understand how the things are working on V3.0.
-
- 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?
Found a bug today with I2C slave support.
During bus contention, the chip may generate a "BUSY" event.
The driver interprets this as an unknown error when it should just ignore it.
This results in its reporting spurious arbitration failures and "unknown" I2C errors then contention on the bus occurs.
I've updated my git repo with a fix for this at:
The most important bit is to add this case to the big switch in i2c_llc_serve_event_interrupt():
During bus contention, the chip may generate a "BUSY" event.
The driver interprets this as an unknown error when it should just ignore it.
This results in its reporting spurious arbitration failures and "unknown" I2C errors then contention on the bus occurs.
I've updated my git repo with a fix for this at:
Code: Select all
git clone https://github.com/brentr/ChibiOS-RT.git
cd ChibiOS-RT
git checkout I2Cmultimaster
The most important bit is to add this case to the big switch in i2c_llc_serve_event_interrupt():
Code: Select all
case 0: /* quietly ignore "uninteresting" events (i.e. i2c bus busy) */
qEvt(0x0000);
break;
- 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:
-
- 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?
I'm only maintaining the I2Cv1 version under Chibios 2.6
Hopefully, user steved will be can port the fix to the versions he's maintaining.
Hopefully, user steved will be can port the fix to the versions he's maintaining.
Re: I2C Slave mode support?
genosensor wrote:Hopefully, user steved will be can port the fix to the versions he's maintaining.
It's on the list (at least, until I forget). Probably in the next couple of weeks.
Might not be necessary with I2CV2 - the interface does seem a lot simpler, to the point that I feel the current driver might be over-complicated.
Who is online
Users browsing this forum: No registered users and 42 guests