I2C + DMA, F091RC, loosing packages.
- February 22, 2018
- 2 replies
- 1327 views
Hi!
I'm trying to use the SSD1306 (oled screen) with the STM32F091RC and I2C interface, I managed to integrate the library U8G2 (
https://github.com/olikraus/u8g2/wiki
) 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,
stm32f0xx_hal_msp.c,
stm32f0xx_it.c
and the file from u8g2 where the communications occurs :
u8x8_cad.c
the init chain is:
00 AE
00 D500 8000 A800 3F00 D300 0000 4000 8D00 1400 2000 00 00 A100 C800 DA00 1200 8100 CF00 D900 F100 DB00 4000 2E00 A400 A600 AF00 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.
#i2c-dma-ssd1306