AnsweredAssumed Answered

UART DMA INT is not working

Question asked by Asaad on Jun 16, 2016

I'm facing a strange problem with UART DMA int in a FreeRTOS-based project.
When I call the DMA setup function (below) from a given FreeRTOS task, it works just fine and the ISR is executed. However, when I call it from a different task, the DMA ISR is not executed at all. Although all DMA interrupts are enabled and the DMA channel itself is enabled.. ( I can see the registers in uVision debug mode). Below you can see register values. I don't know why the ISR is not executed. The DMA transfers only 2 bytes (instead of 10) and then stops. I double checked the DMA settings they are the same in both tasks..


/* Streaming DMA 1 (port-to-port) setup */
void PortPortDMA1_Setup(UART_HandleTypeDef* huartSrc, UART_HandleTypeDef* huartDst, uint8_t num)
    /* UART RX DMA (DMA1 Ch1) */
    if (huartSrc->Instance == USART1) {
    } else if (huartSrc->Instance == USART2) {
    } else if (huartSrc->Instance == USART3) {
    } else if (huartSrc->Instance == USART4) {
    } else if (huartSrc->Instance == USART5) {
    } else if (huartSrc->Instance == USART6) {
    } else if (huartSrc->Instance == USART7) {
    } else if (huartSrc->Instance == USART8) {
    /* DMA interrupt init */
    HAL_NVIC_SetPriority(DMA1_Ch1_IRQn, 1, 0);
    /* Start DMA stream */ 
    dmaStreamDst[0] = huartDst;
    huartSrc->State = HAL_UART_STATE_READY;
    HAL_UART_Receive_DMA(huartSrc, (uint8_t *)(&(huartDst->Instance->TDR)), num);
    /* Lock the ports */
    portStatus[GetPort(huartSrc)] = STREAM;
    portStatus[GetPort(huartDst)] = STREAM;
    /* Initialize counter */
    DMAStream1count = 0;