2020-01-27 11:32 PM
Hello,
I manage to operate all UART/USART DMA's except for LPUART.
For some reason, only with LPUART, I fail to start DMA transaction.
Is it because it's request are from DMA2 instead of DMA1 (all UART's are connceted to DMA1, except for LPUART, which is connected to DMA2) ?
I also call __HAL_RCC_DMA2_CLK_ENABLE in init, yet it still fail to operate LPUART1.
The LPUART is fully operational is both polling and interrupt.
Just DMA is not functional.
#define USARTx LPUART1
#define USARTx_CLK_ENABLE() __HAL_RCC_LPUART1_CLK_ENABLE()
#define USARTx_RX_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
#define USARTx_TX_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
#define DMAx_CLK_ENABLE() __HAL_RCC_DMA2_CLK_ENABLE()
#define USARTx_FORCE_RESET() __HAL_RCC_LPUART1_FORCE_RESET()
#define USARTx_RELEASE_RESET() __HAL_RCC_LPUART1_RELEASE_RESET()
/* Definition for USARTx Pins */
#define USARTx_TX_PIN GPIO_PIN_9
#define USARTx_TX_GPIO_PORT GPIOA
#define USARTx_TX_AF GPIO_AF4_LPUART1
#define USARTx_RX_PIN GPIO_PIN_10
#define USARTx_RX_GPIO_PORT GPIOA
#define USARTx_RX_AF GPIO_AF4_LPUART1
/* Definition for USARTx's DMA */
#define USARTx_TX_DMA_STREAM DMA2_Stream0
#define USARTx_RX_DMA_STREAM DMA2_Stream1
#define USARTx_TX_DMA_CHANNEL DMA_REQUEST_LPUART1_TX
#define USARTx_RX_DMA_CHANNEL DMA_REQUEST_LPUART1_RX
/* Definition for USARTx's NVIC */
#define USARTx_DMA_TX_IRQn DMA2_Stream0_IRQn
#define USARTx_DMA_RX_IRQn DMA2_Stream1_IRQn
#define USARTx_DMA_TX_IRQHandler DMA2_Stream0_IRQHandler
#define USARTx_DMA_RX_IRQHandler DMA2_Stream1_IRQHandler
/* Definition for USARTx's NVIC */
#define USARTx_IRQn LPUART1_IRQn
#define USARTx_IRQHandler LPUART1_IRQHandler
2020-01-28 12:01 AM
Which mcu?
Is the LPUART fully operational in "manual" (polled) mode?
Read out and check the relevant DMA, (DMAMUX if applicable), LPUART, and GPIO registers' content.
JW
2020-01-28 12:31 AM
Yes, I forgot to mention that , sorry,
The LPUART is fully operational is both polling and interrupt.
Just DMA is not functional.
Thanks