Hard Fault, after HAL_UART_Receive_DMA() is called.
- September 28, 2017
- 2 replies
- 1562 views
Hello!
I am trying to use USART2 + DMA for Rx/Tx. Tx is working OK already.
For Rx, I would like to use DMA circular mode.I use followings.
STM32L476 nucleoSTM32CubeMX, STM32CubeL4 1.9.0.
After do workaround PLLM problem adding RCC_OscInitStruct.PLL.PLLM = 1;
I called,
HAL_StatusTypeDef HAL_UART_Receive_DMA(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size);
huart == &huart2
pData == &receive_str[0] == 0x2000194c
Size == sizeof(receive_str) == 64
until 63rd character receive there is no problem. I typed 'a' 63 times.
The black backed area is buffer for Receive_DMA.


However, when I type 64th character 'b' Hard Fault raised as following.
'b' exists at receive_str[63] by DMA.


PRECISEERR is 1 , BFAR = 0x20018000.
It looks unwanted memory access to 0x200018000, did not such access.
DMAC is still transfers Rx data correctly.
I typed 'c' 3times, then the buffer is overwriten circulariy as expected.

At the time, I lookd stack.

Does anyone know my mistake, or how to workaround?
Thanks!
#uart-dma