cancel
Showing results for 
Search instead for 
Did you mean: 

CubeF3 UART DMA HAL_UART_RxCpltCallback(...) only called once

sebastian23
Associate II
Posted on June 19, 2015 at 20:40

Hi,

i'm currently playing arround with the ESP8266 serial wifi module. I'm exchanging data with this module using an UART interface. I'm using an STM32F3 Discovery board.

Generally it's working, the module answer to my requests. The communication with module is controlled by sending AT commands to the module.

When I send an simple ''AT'' to the module it responds with a fixed length answer. I got no problem receiving data from the module for which i know the length of the response.

But there are some responses to an AT command (for example AT+CWLAP ''Show all available APs'') which doesn't have a defined response length.

For receiving these responses i wanted to use a ''single byte receive strategy'' in a state machine.

The state machine is working in the following way:

1) Send AT command to the ESP8266 Module

2) Receive one byte from the response

3) Wait for HAL_UART_RxCpltCallback

4) HAL_UART_RxCpltCallback sets a variable which is used by the state machine to determine that receiving of the single byte is completed. And sets a counter variable to 0. And sets the state machine to ''read next byte'' state.

5) In state reading next byte, increase an counter variable when receiving ready flag is not set. Also the receiving data pointer is increased that next receive command doesn't overwrite before received byte.

6) When the counter variable exceeds a limit (currently 5000000) the state machine goes to the receiving complete state.

I'm reading one byte using:

HAL_UART_Receive_DMA(pESP8266->pUartHandle, m_rxBuffer, 1);

My problem is that HAL_UART_RxCpltCallback is only called once (after receiving the first byte), after sending the next HAL_UART_Receive_DMA command, its never called again.

When i set a breakpoint in the ''receiving complete'' state HAL_UART_GetState() gives back HAL_UART_STATE_BUSY_RX. When i call HAL_UART_GetState() later again, it returns never another state.

Am i missing something?

Has anybody found a way to receive sequences with unknown length using STM32 Cube library?

Any hint is appreciated.

CubeMX tells me i'm using the latest version of the cube library.

Kind regards,

Sebastian

#cubef3-uart-dma-callback
10 REPLIES 10
Posted on May 26, 2018 at 15:50

Unfortunately, my code does not work after closer inspection.