cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F4 I2C BTF bit is not set after DMA TX complete

neoirto
Associate II
Posted on December 10, 2012 at 18:29

Hi all,

I noticed that there is an high traffic in I2C2_EV_IRQHandler() with status 0x70080 (EV8 =I2C_EVENT_MASTER_BYTE_TRANSMITTING) after all the bytes was transmitted with success by DMA (but it's the same problem without DMA transfer).

I think the reason is that the TXE is still set, and the BTF is not (hardware will set it after several 0x70080 interrupts).

So, is there a way to force BTF to 1 after DMA IT TC ? Is it a DMA control register parameter to set ?

Even after that (BTF is set now), I noticed several interrupts with same status (0x70084 = EV8_2 = I2C_EVENT_MASTER_BYTE_TRANSMITTED), all of this repeated interrupts are useless for me.

Of course, it's not a problem for a simple TX write operation, because I can disable interrupts after sending the stop condition, but when I want to restart for a RX read sequence, it's alot of interrupts that are fired for nothing.

I think there may be a way to fix it ? don't it ?

#i2c-stm32f4-dma
2 REPLIES 2
Nickname12657_O
Associate III
Posted on December 12, 2012 at 14:45

Hi Stephane,

In the I2C_ITConfig, don't enable the buffer interrupt (I2C_IT_BUF).

If this is already the case, please share the DMA and I2C config for a deeper investigation.

Cheers,

STOne-32

neoirto
Associate II
Posted on December 13, 2012 at 13:51

Hi STOne-32,

And tx for your answer.

In fact I'm re-writing my DMA+INT configuration by reading carefully the datasheet, and I'm a bit confused about initialization sequence, cause it appears I was doing wrong sequence before (strange random freeze, strange status, and I2C_IT_BUF was enable, you were true...).

So could you please tell me if I'm wrong somewhere with the new configuration.

- first init of the dma_channels (with DMA_Cmd( DMAx_Streamx, ENABLE ), and I2C_DMACmd(I2Cx, DISABLE))

- Then, TX I2C transaction begin with I2C_ITConfig(I2Cx, I2C_IT_BUF, DISABLE);

START -> 30001 : send_addr() -> 70082 : and if everything is ok, DMA transfer should begin automaticaly when 70080 ?

But when should I set : I2C_DMACmd(I2C2, ENABLE) ?

I tried at 30001 and after 70082, but I don't catch a DMA_IT_TCIFx interrupt...

I tried with or without clock stretching, other configs, but DMA is never ended ??