Page 1 of 1

i2c Slave Mode - for I2CV2

Posted: Wed Dec 02, 2015 3:32 pm
by steved
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 565 times

I've got some other test software if anyone wants it.

Re: i2c Slave Mode - for I2CV2

Posted: Sat Dec 09, 2017 9:17 am
by aGuegu
Have you got a github repo for this?

Re: i2c Slave Mode - for I2CV2

Posted: Sat Dec 09, 2017 9:54 am
by steved
aGuegu wrote:Have you got a github repo for this?

No