Associate
June 15, 2019
Question
Problem: i2c with DMA
- June 15, 2019
- 2 replies
- 1053 views
To exchange data with my display I am using the i2c protocol. I decided to exchange data with the DMA but I have problems. Without DMA everything works perfectly. Communication does not go well with Dma. The configuration is the default, and the only difference in the code is the name of the 'transmit' and 'receive' ending with DMA. What can the problem be due to? I'm going crazy
Configuration DMA
/* I2C1_TX Init */
hdma_i2c1_tx.Instance = DMA1_Stream6;
hdma_i2c1_tx.Init.Channel = DMA_CHANNEL_1;
hdma_i2c1_tx.Init.Direction = DMA_MEMORY_TO_PERIPH;
hdma_i2c1_tx.Init.PeriphInc = DMA_PINC_DISABLE;
hdma_i2c1_tx.Init.MemInc = DMA_MINC_ENABLE;
hdma_i2c1_tx.Init.PeriphDataAlignment = DMA_PDATAALIGN_HALFWORD;
hdma_i2c1_tx.Init.MemDataAlignment = DMA_MDATAALIGN_HALFWORD;
hdma_i2c1_tx.Init.Mode = DMA_NORMAL;
hdma_i2c1_tx.Init.Priority = DMA_PRIORITY_VERY_HIGH;
hdma_i2c1_tx.Init.FIFOMode = DMA_FIFOMODE_DISABLE;
if (HAL_DMA_Init(&hdma_i2c1_tx) != HAL_OK)
{
Error_Handler();
}I attach the library I use to communicate with the display .. very simple
