ARMmbed / mbed-hal-st-stm32f4

mbed HAL for ST STM32F4-series microcontrollers
Other
7 stars 21 forks source link

serial_irq_handler_asynch() only terminat RX IRQs on SERIAL_EVENT_RX_COMPLETE event #38

Open weisleder opened 8 years ago

weisleder commented 8 years ago

Hi, I might have found an error in the serial_irq_handler_asynch(). This only terminat the IRQ if a SERIAL_EVENT_RX_COMPLETE event occurred.

Please have a look at: http://forums.mbed.com/t/stm32f401-async-serial-events/1269 and https://github.com/ARMmbed/mbed-hal-st-stm32f4/blob/master/source/serial_api.c#L645-L655.

So if a SERIAL_EVENT_RX_CHARACTER_MATCH occurred, I get the event but the IRQ is still enabled until a SERIAL_EVENT_RX_COMPLETE is occurred: https://github.com/ARMmbed/mbed-hal-st-stm32f4/blob/master/source/serial_api.c#L635-L643

And than if I use serial_irq_handler_asynch() with SERIAL_EVENT_RX_CHARACTER_MATCH event, than I never get a SERIAL_EVENT_RX_COMPLETE event. Because of this: https://github.com/ARMmbed/mbed-hal-st-stm32f4/blob/master/source/serial_api.c#L659.

But if I have a look to the implementation for the FRDM-K64F Board: https://github.com/ARMmbed/mbed-hal-ksdk-mcu/blob/master/source/serial_api.c#L339-L356 I think they will return also a SERIAL_EVENT_RX_COMPLETE if I used a SERIAL_EVENT_RX_CHARACTER_MATCH with async read. And they abort the async read on every event: https://github.com/ARMmbed/mbed-hal-ksdk-mcu/blob/master/source/serial_api.c#L487-L490

0xc0170 commented 8 years ago

Thanks for reporting, we will investigate.

ciarmcom commented 8 years ago

ARM Internal Ref: IOTSFW-2271