635 views
in GUI Development by
I have a problem configuring UART3 DMA when using Embedded wizard-generated code

this function will not be triggered when it receives a msg in RX.

can anyone tell me why that happened

the same code works well in STMCube IDE I did all other configurations in both

.

void HAL_UARTEx_RxEventCallback(UART_HandleTypeDef *huart, uint16_t Size)
{
    if (huart->Instance == USART3)
    {
        EwPrint( "%%%%%%%%%%%%%%%%%%%%%%%\n" );

        memcpy (MainBuf, RxBuf, Size);

        HAL_UARTEx_ReceiveToIdle_DMA(&UART3_Handle, RxBuf, RxBuf_SIZE);
        for(int i=0;i<RxBuf_SIZE;i++)
                {
                    RxBuf[i]=0;
                }
        __HAL_DMA_DISABLE_IT(&hdma_usart3_rx, DMA_IT_HT);
    }
}

1 Answer

0 votes
by
I assume, that some interrupt handlers regarding USART3 and/or DMA are missing.
Please compare with the application HAL_UARTEx_RxEventCallback() is called correctly.

If all interrupt handlers are there, you can check with the debugger, if they are called after receiving data from USART3.
by
all interrupt handlers are there but not called after receiving data from USART3.
by
Which target platform are you using?
Is there any difference in pin and interrupt configuration between the Embedded Wizard application and the USART3 test application regarding the USART3 pins?
by
I am using STM32l4R9

when using  Embedded Wizard is only the issue, otherwise, it works fine.
by
I assume that it is STM32l4R9 EvalBoard.

In the STM32L4R9-MB1314-Evalboard BuildEnvironment USART3 is used in polling mode.
Did you adapt the USART3 initialisation regarding DMA and interrupts?
Please confirm, that all needed DMAs and interrupts are configured and enabled.
As I wrote, you have to compare the complete USART3 initialisation with the working example.
Maybe different uart handles are used during initialisation and interrupt handling.
by
I compare both working example with my GUI example. The interrupt handlers are same
by

Basically Embedded wizard-generated code does not influence any USART configuration.
If you are using STM32l4R9 Evaluation Board, normally USART3 is used, in case of STM32l4R9 Discovery Board it is normally USART2.
If you are using STM32CubeMX with USART configured there additional configuration code is generated. In this case the configuration code and MspInit/DeInit code have to be removed in ew_bsp_console.c.

I can imagine following reasons, if HAL_UARTEx_RxEventCallback() is not called:

  1. incomplete or incorrect UART or DMA configuration
  2. different USART or DMA handles are used in configuration and interrupt handling
  3. wrong UART unit is selected
  4. UARTEx_Rx or DMA interrupt is not enabled
    (you can check with a breakpoint in USARTx_IRQHandler() or USARTx_DMA_RX_IRQHandler())
  5. weak definition of HAL_UARTEx_RxEventCallback() is not overwritten
    (you also can check this by debugger after one of the mentioned breakpoints is hit)
  6. UART or interrupt configuration is accidently overwritten after correct configuration (maybe during configuration of other port pins).

     

Ask Embedded Wizard

Welcome to the question and answer site for Embedded Wizard users and UI developers.

Ask your question and receive answers from the Embedded Wizard support team or from other members of the community!

Embedded Wizard Website | Privacy Policy | Imprint

...