Skip to main content
T J
Senior III
February 5, 2017
Solved

I2C HAL_I2C_ERROR_AF is set and the 2nd byte is not transmitted.

  • February 5, 2017
  • 2 replies
  • 1405 views
Posted on February 05, 2017 at 08:44

using CubeMX V4.18.0. and uV5,  stole parts from the '091 examples

I can see the ACK from the slave device, on the Oscilloscope

but

trying to send 0x68, 0x0E,0x00,0x00 as a packet

it sends 1 byte the 0x68 and stops.

while(HAL_I2C_Master_Transmit(&hiic2_Rtc, (uint16_t)I2C_ADDRESS, (uint8_t*)data, TXBUFFERSIZE, 10) != HAL_OK)

exits with HAL_I2C_ERROR_AF  ,  after just one byte

I am probably doing something wrong.

mbed works properly on the port.

what s the best advice for running the IIC port on a STM32F091 ?

    This topic has been closed for replies.
    Best answer by T J
    Posted on February 07, 2017 at 06:34

    I found the problem, and the fix

        int     I2C_ADDRESS = DS3231_I2C_ADRS <<1;

      after I corrected the address shift, it all worked.

    2 replies

    T J
    T JAuthorBest answer
    Senior III
    February 7, 2017
    Posted on February 07, 2017 at 06:34

    I found the problem, and the fix

        int     I2C_ADDRESS = DS3231_I2C_ADRS <<1;

      after I corrected the address shift, it all worked.

    Alexander Rykovanov
    Visitor II
    June 10, 2017
    Posted on June 10, 2017 at 21:33

    Thank you!

    Didn't undertand my IO expander didn't start to work.