AnsweredAssumed Answered

I2C  + DMA, F091RC, loosing packages.

Question asked by Alejandro Bizzotto on Feb 22, 2018
Latest reply on Apr 21, 2018 by Alejandro Bizzotto


I'm trying to use the SSD1306 (oled screen) with the STM32F091RC and I2C interface, I managed to integrate the library U8G2 (Home · olikraus/u8g2 Wiki · GitHub ) in Eclipse with GNU MCU Eclipse and the setup provided by CubeMX for I2C. With the 'normal' transmission routines HAL_I2C_Master_Transmit() it works normal, I can draw things there.

But when I try to replace it by HAL_I2C_Master_Transmit_DMA(), seems to be some looses between the DMA and the I2C.

If I run this with the debugging interface, put a breakpoint in the HAL_I2C_Master_Transmit_DMA() instruction, and look with the scope, I get what is supposed to be each time (because there is a time in between each iteration while I hit the button again), but if I let him run free while I record with the scope again, the received chain is not the same, many packages are lost. I'm testing this with the initializing chain and only in the 'command' section of the transmission, to have it a bit more under control.

Seems to me like the DMA is not waiting for the transaction to finish on the I2C, instead he sends the next value to the interface while he is not ready, it's this possible? any other ideas?

attached are main.c,



and the file from u8g2 where the communications occurs :



the init chain is:

00 AE
00 D5
00 80
00 A8
00 3F
00 D3
00 00
00 40
00 8D
00 14
00 20
00 00
00 A1
00 C8
00 DA
00 12
00 81
00 CF
00 D9
00 F1
00 DB
00 40
00 2E
00 A4
00 A6
00 AF
00 10


when I use HAL_I2C_Master_Transmit(), I can see it all in the scope, if I use HAL_I2C_Master_Transmit_DMA() instead, I will only see:

00 00

00 A6


but this also depends on what is happening on main, with a more complicated setup (the rest of the peripherals I want to use for the application, the data is different.