Question
Going to STOP while waiting for UART TX DMA to complete
Posted on July 04, 2016 at 04:06
Dear forum, I am trying to transfer a block of bytes from RAM to UART2 using DMA on STM32F042. I found the HAL function HAL_UART_Transmit_DMA, so I want to go to stop right after that, like this:
int_disable();
while ((block = getBlock(&n))) { /* while not End-Of-Data... */ int_enable(); extern UART_HandleTypeDef huart2; HAL_UART_Transmit_DMA(&huart2, (uint8_t*)block, n); HAL_PWR_EnterSTOPMode(PWR_MAINREGULATOR_ON, PWR_STOPENTRY_WFI); int_disable(); } int_enable(); I read the reference manual DMA section, but I cannot figure out whether I need to enable the UART2 before going to sleep. I would imagine that going to WFI will work fine, since DMA interrupt is getting fired... Thanks for reading. #low-power #dma