Skip to content
Snippets Groups Projects
Select Git revision
  • master default protected
1 result

i2c.c

Blame
    • Damien George's avatar
      3eff8128
      stm32/i2c: Fix generation of restart condition for hw I2C on F0/F7. · 3eff8128
      Damien George authored
      Before this patch I2C transactions using a hardware I2C peripheral on F0/F7
      MCUs would not correctly generate the I2C restart condition, and instead
      would generate a stop followed by a start.  This is because the CR2 AUTOEND
      bit was being set before CR2 START when the peripheral already had the I2C
      bus from a previous transaction that did not generate a stop.
      
      As a consequence all combined transactions, eg read-then-write for an I2C
      memory transfer, generated a stop condition after the first transaction and
      didn't generate a stop at the very end (but still released the bus).  Some
      I2C devices require a repeated start to function correctly.
      
      This patch fixes this by making sure the CR2 AUTOEND bit is set after the
      start condition and slave address have been fully transferred out.
      3eff8128
      History
      stm32/i2c: Fix generation of restart condition for hw I2C on F0/F7.
      Damien George authored
      Before this patch I2C transactions using a hardware I2C peripheral on F0/F7
      MCUs would not correctly generate the I2C restart condition, and instead
      would generate a stop followed by a start.  This is because the CR2 AUTOEND
      bit was being set before CR2 START when the peripheral already had the I2C
      bus from a previous transaction that did not generate a stop.
      
      As a consequence all combined transactions, eg read-then-write for an I2C
      memory transfer, generated a stop condition after the first transaction and
      didn't generate a stop at the very end (but still released the bus).  Some
      I2C devices require a repeated start to function correctly.
      
      This patch fixes this by making sure the CR2 AUTOEND bit is set after the
      start condition and slave address have been fully transferred out.