cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F4 USART IRQ Problem

DBrow
Associate II

I am using USART2 (with IRQ) of STM32F4 for MIDI Receive (31250 bd, 8 Bit, 1Start/Stop Bit). A MIDI Message has normally 3 Bytes following directly on each other, which gives each Byte a duration of ca. 320us.

In 1 of 10-30 events one Byte (always Byte 2 or 3) is missing and the ORE Bit is on. This is strange because USART2 IRQ has highest priority, and the IRQ Routine takes max. 30us (measured not estimated). No other routine blocks this IRQ.

I checked the USART2-In port of the STM32F4 with my Logic Analyser. On the Analyser all 3 Bytes are present (if ORE Bit is on).

Has anybody an idea??

3 REPLIES 3
S.Ma
Principal

Dig 1: what is the clock source min-max tolerance and its impact on baud rate innacuracy? Please specify SYSCLK value in MHz

Dig 2: Show us the interrupt routine code extract.

Dig 3: Use oscilloscope to look at signal level and quality. Always use scope before lyzer...

Check NVIC Grouping settings to ensure you are actually PREEMPTING other interrupts and not simply defining the order of servicing at the dispatch/tail-chaining point.

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

Yes, I did not define priority grouping. I changed it to: NVIC_SetPriorityGrouping(0); and now it works. Thank you very much for help!