cancel
Showing results for 
Search instead for 
Did you mean: 

FMPI2C DMA Not working - STM32F446

schikhal89
Visitor

Hello All, 
I am trying to talk to an FRAM over FMPI2C on the STM32F446 using DMA, but the DMA is not able to "start". 
I am using the Mem_Write_DMA function in stm32f4xx_hal_fmpi2c.c.
When I do a side by side comparison with the Mem_Write_DMA function in I2C there are some differences, For example in I2C, the start, device address and the memory address is sent as a blocking call using I2C_RequestMemoryWrite. For the FMPI2C, the start, device address and the first byte of the memory address (memory address is 16 bit) is sent in a blocking all, and the next byte is sent via the interrupt in FMPI2C_Mem_ISR_DMA. After the second byte is sent, transmission to start the data transfer gets initiated by FMPI2C_TransferConfig. But when it tries to send the data, the interrupt fires again this time just sending 0xFF's which are being loaded in the TXDR register in the previous step
Mem_write_DMA --> Send Device Address & First Byte of Memory Add --> MEM_ISR : Send second byte, make MemAddress - 0xFF --> Interrupt triggers, MEM_ISR: Initiate transfer --> Interrupt Triggers Send 0xff.

My FMPI2C is configured at 10 Khz and is running on HSI = 16 Mhz

I have tried  rewriting the function, to send device and both bytes of memory address in blocking, reenable DMA and setup for transmission. But although I see, that all correct values are loaded in the registers both DMA anf FMPI2C, DMA never kicks in. 
I also tried bootstrapping by force writing a byte from the data register into the TXDR, no luck.

It is mentioned in the datasheet that DMA transaction shall start  when the TXIS bit is set which is the interrupt flag, as opposed to TXE which is in I2C. 

Sorry for the long post, this has been keeping me up for 3 days now. Has anyone run into this issue, or has any ideas.

Much Appreciated!
Thanks

0 REPLIES 0