2016-12-21 07:03 AM
Hi all,
I'm new on ST device, i'm trying to test the I2C bus but I can't understand how it works.. I do not want to use the HAL library but manage directly the register, but the I2C Interface on ST produce the state of transmission (0x08,0x10,0x28...) like other uC? or it manages all the transmission?
Thanks.
Lorenzo.
2016-12-24 05:16 AM
Ok I'll try with another device on the bus, but the correct code for master trasmission are:
1. Load the slave Adress on the I2C1->TXDR or I2C1->CR2 'SADD' register?
2. Set the start bit
Thanks.
Lorenzo
Merry christmas
2016-12-24 05:23 AM
If talking to a non MCU based slave device, a simple SW I2C could probably get you going and test if the HW is fine (by sweeping all slave addresses to find out which one is acknowledged. HW I2C is mandatory when clock stretching is needed, managed under interrupt or to behave as slave function.
Otherwise, this will get you started :
2016-12-25 05:48 AM
Lorenzo - why not just bit-bang out the I2C specification ? Have done this in the past with assorted microcontroller and is very clean and straight forward to understand the interface.
Have a review of AN4655 (section 2.5.3 I2C master bit-banging sequence).