cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L031F6P6 HAL_I2C_Mem_Write_DMA NOT working

guwono.septijo
Associate II

** HAL_I2C_Mem_Write_DMA not work.. **

trying to drive OLED SSD1306 0,96 inch (I2C) from STM32L031F6P6

using HAL_I2C_Mem_Write (NO DMA), worked OK

>> HAL_I2C_Mem_Write(  &hi2c1, SSD1306_I2C_ADDR, 0x40, 1, &SSD1306_Buffer[SSD1306_WIDTH * i], SSD1306_WIDTH, 100);

already set DMA in Cube : I2C1_TX Dma1Channel2 MemoryToPeripheral Priority=Low

tried to set RX too (I2C1_RX Dma1Channel3 PeripheralToMemory Priority=Low) with no luck too

already try to add 4K7 Pull Up resistor on SCL and SDA

>>  i2cstate = HAL_I2C_Mem_Write_DMA(&hi2c1, SSD1306_I2C_ADDR, 0x40, 1, &SSD1306_Buffer[SSD1306_WIDTH * i], SSD1306_WIDTH);

>>  while(HAL_I2C_GetState(&hi2c1) != HAL_I2C_STATE_READY);

( i2cstate always set to HAL_I2C_STATE_RESET )

anyone ? thanks...

1 REPLY 1

Make sure the DMA clock is enabled, and that the rx/tx DMA are correctly linked to the peripheral, along with IRQ Handlers, and calls into HAL

STM32Cube_FW_L0_V1.10.0\Projects\STM32L031K6-Nucleo\Examples\I2C\I2C_TwoBoards_ComDMA\Src\stm32l0xx_hal_msp.c

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..