i2c Slave Mode - for I2CV2

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderators: RoccoMarco, barthess

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

i2c Slave Mode - for I2CV2

Postby steved » Wed Dec 02, 2015 3:32 pm

I've implemented slave mode I2C for the I2CV2 peripheral, building on genosensor's original implementation for I2CV1. Not yet exhaustively tested (and I'm less than convinced about the error handling); posting here in case anyone else wishes to join in. Tested on 32F051, 32F746. I've also included the current code for I2CV1, which has been extensively used on a 32F407.
Couple of "extras":
1. The I2CV2 peripheral recovers OK from a timeout, so the driver doesn't enter a locked state in this situation (i.e. no need to reset).
2. There's an optional receive callback on each byte received, with the option to terminate or continue the transfer. This can be useful when waiting for a peripheral to become ready, without the need for mltiple bus transactions. Use of this callback forces interrupt-driven receive, even if DMA is enabled. (If the callback is NULL, both transmit and receive use DMA).
ChibiOS_I2C_Master_Slave_011215.zip
ST I2C drivers supporting slave mode, for both I2CV1 and I2C V2
(40.74 KiB) Downloaded 344 times

I've got some other test software if anyone wants it.
Attachments
F072_Disco_I2C_Master_for_slave_271115.zip
Master end of test program, running on 32F072 Discovery
(15.8 KiB) Downloaded 286 times
F051_Disco_I2C_Slave_021215.zip
Slave mode test/demo for I2CV2, running on 32F051 Discovery
(20.11 KiB) Downloaded 307 times

User avatar
aGuegu
Posts: 29
Joined: Thu Dec 07, 2017 4:15 am
Has thanked: 1 time
Been thanked: 5 times

Re: i2c Slave Mode - for I2CV2

Postby aGuegu » Sat Dec 09, 2017 9:17 am

Have you got a github repo for this?

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

Re: i2c Slave Mode - for I2CV2

Postby steved » Sat Dec 09, 2017 9:54 am

aGuegu wrote:Have you got a github repo for this?

No


Return to “STM32 Support”

Who is online

Users browsing this forum: No registered users and 12 guests