cancel
Showing results for 
Search instead for 
Did you mean: 

HAL_UART_TxCpltCallback callback not serviced on completion

kudiarasum
Associate II
Posted on December 29, 2015 at 16:26

I

am developing application for

stm32l0 using CUBEmx and keil, my intention is to

 

transmit command to modem and receive

 

response , so I have used to Transmit data and receive data through UART RX DMA.

I am able to transmit data through hlpuart1 ,

huart2

successfully , but unable to get

 

HAL_UART_TxCpltCallback on data reception ,

I have enabled breakpoint and checked Rx and Tx buffer , as expected transmitted data in TxBuffer

received in RXBuffer, But

callback has not serviced.

Main loop

               

if(current_state == IDLE){

                                                                current_state = TRANSMITTING;

                                                                HAL_UART_Receive_DMA(&hlpuart1,RxBuffer,6);

                                                                HAL_UART_Transmit(&hlpuart1,TxBuffer,sizeof(TxBuffer),1000);

                                                                HAL_Delay(5000);

                                                  HAL_UART_Transmit(&huart2,RxBuffer,6,1000);

                                                while(current_state != RECV_READY)   (Control stalled here because current stare  not cleared  by

HAL_UART_TxCpltCallback

)

  

                                                {

                                                }

                                                HAL_UART_Transmit(&huart2,TxBuffer,6,1000);

                                                current_state = IDLE;

                                 }

void HAL_UART_TxCpltCallback(UART_HandleTypeDef *huart)

{

               

current_state = RECV_READY;

}

Any one can throw some light where I made mistake

#stm32l0 #uart2-dma-interrupt
6 REPLIES 6
Amel NASRI
ST Employee
Posted on December 29, 2015 at 17:47

Hi murugesan.kudiarasu,

HAL_UART_TxCpltCallback is invoked when you are in interrupt mode or DMA mode.

In polling mode using HAL_UART_Transmit, this callback is not needed.

-Mayla-

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

kudiarasum
Associate II
Posted on December 30, 2015 at 06:57

Hi Mayla,

Thank for correcting me, By mistake i have used  HAL_UART_TxCpltCallback instead of  HAL_UART_RxCpltCallback ,  already configured DMA to receive data Through LPUART_RX in CubeMX,

Even now the callback is not serving on receive complete.

kudiarasum
Associate II
Posted on December 30, 2015 at 07:00

Hi ,

I have attached the latest source (main.c) file

________________

Attachments :

main.c : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I1CZ&d=%2Fa%2F0X0000000bjq%2F.jxak7oMpny8nxhMqb0TgpSr10nkDDeFEaf.1rzosqU&asPdf=false
Amel NASRI
ST Employee
Posted on December 30, 2015 at 11:15

Himurugesan.kudiarasu,

Is theUARTx_IRQHandler added in your file stm32l0xx_it.c file:

void
USARTx_IRQHandler(
void
)
{
HAL_UART_IRQHandler(&UartHandle);
}

-Mayla-

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Posted on December 31, 2015 at 13:51

Expectations dictate that this should be volatile

uart_current_state current_state = IDLE;

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..