Skip to content

Commit

Permalink
Fixed I2C sending 2 bytes instead of 1. Closing #949
Browse files Browse the repository at this point in the history
  • Loading branch information
tobbeanton committed Jun 9, 2022
1 parent 144e094 commit 61e33e0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/drivers/src/i2c_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,10 @@ static void i2cdrvEventIsrHandler(I2cDrv* i2c)
{
// Disable TXE to allow the buffer to flush and get BTF
I2C_ITConfig(i2c->def->i2cPort, I2C_IT_BUF, DISABLE);
// If an instruction is not here an extra byte gets sent, don't know why...
// Is is most likely timing issue but STM32F405 I2C peripheral is bugged so
// this is the best solution so far.
__DMB();
}
}
}
Expand Down Expand Up @@ -619,7 +623,7 @@ static void i2cdrvClearDMA(I2cDrv* i2c)

static void i2cdrvDmaIsrHandler(I2cDrv* i2c)
{
if (DMA_GetFlagStatus(i2c->def->dmaRxStream, i2c->def->dmaRxTCFlag)) // Tranasfer complete
if (DMA_GetFlagStatus(i2c->def->dmaRxStream, i2c->def->dmaRxTCFlag)) // Transfer complete
{
i2cdrvClearDMA(i2c);
i2cNotifyClient(i2c);
Expand Down

0 comments on commit 61e33e0

Please sign in to comment.