STM32F401 async serial events

Hello,

I have a STM32F401 Nucleo board and I use the async serial read with a SERIAL_EVENT_RX_CHARACTER_MATCH event. I have some problems withe the behavior of this event. I do not know if I found an error in the HAL or if this the correct behavior.

  1. For me, a SERIAL_EVENT_RX_CHARACTER_MATCH event means, that the callback function will be called and the async serial read will abort (IRQ will be automatically disabled withe the first SERIAL_EVENT_RX_CHARACTER_MATCH event). Is this correct?

  2. But at the moment, the SERIAL_EVENT_RX_CHARACTER_MATCH occurs, the callback function is called ans the serial IRQ is still enabled. So I get more than one function callback. The IRQ will be disabled if the buffer is full. But then I get no SERIAL_EVENT_RX_COMPLETE event. So it means in every case, the IRQ will be only disabled if the receive buffer ist full. Or should I disable the IRQ by myself (e.g. withe serial_rx_abort_asynch() call )? Is this behavior correct?

Hi,

it might be useful to see the code references, to see STM32F4 how it handles character match. It should be this line: https://github.com/ARMmbed/mbed-hal-st-stm32f4/blob/master/source/serial_api.c#L641

From the documentation for RX IRQ handler:

/** The asynchronous TX and RX handler.
 *
 * @param obj The serial object
 * @return Returns event flags if an RX transfer termination condition was met; otherwise returns 0
 */
int serial_irq_handler_asynch(serial_t *obj);

This means that any event is terminating the receiving.

Please report this to https://github.com/ARMmbed/mbed-hal-st-stm32f4

Tanks for reply, and sorry for the missing code. I reported this to https://github.com/ARMmbed/mbed-hal-st-stm32f4/issues/38

Thanks you very much ! we will have a look at the bug