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).
I've got some other test software if anyone wants it.
i2c Slave Mode - for I2CV2
Moderators: RoccoMarco, barthess
i2c Slave Mode - for I2CV2
- Attachments
-
- F072_Disco_I2C_Master_for_slave_271115.zip
- Master end of test program, running on 32F072 Discovery
- (15.8 KiB) Downloaded 291 times
-
- F051_Disco_I2C_Slave_021215.zip
- Slave mode test/demo for I2CV2, running on 32F051 Discovery
- (20.11 KiB) Downloaded 312 times
Who is online
Users browsing this forum: No registered users and 18 guests