cancel
Showing results for 
Search instead for 
Did you mean: 

USART frame detect IRQ. How?

Haddock
Associate III

I'm modifying code for a Atmega AVR to a STM32L03 and encounter ISR(USART1_START_vect). It is a function that is called when the UART receives a start frame. I'm a newbie to this STM32-processor but I have googled and checked in inc-files but I cannot find any suitable code. I'm using HAL for now.

Have anyone a suggestion?

Thanx

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Håkan Nalén​ ,

If you need a simple EXTI example, you can refer to this wiki article: Getting started with EXTI.

Several ready to use examples are also available in the STM32CubeL0 package. You can refer to some of them here.

-Amel

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.

View solution in original post

14 REPLIES 14

What does your code do with such an interrupt?

If you want to detect the pin is active, perhaps use an EXTI interrupt​.

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

> when the UART receives a start frame

Define "start frame".

> I have googled and checked in inc-files

Read the Reference Manual (RM) to your STM32.

JW

I have two UART ports. Both can occupy an interpreter and each port sets a flag that says "I now own the interpreter". That flag is set in this ISR().

I suppose a Frame detect IRQ coming when the hardware pin change state.

I must read about the EXTI interrupt..

I suppose a Frame detect IRQ coming when the hardware pin change state in the beginning of the transfer.

If it's this

0693W00000WLQbcQAH.pngthen as Clive said above, EXTI may be a direct equivalent. However, for the purpose you've described, IMO it's better to "flip the switch" upon reception of the first byte on given UART.

JW

The note from 328PB is exactly what I want to happen in STM32-mcu.

The EXTI line 26 o 28 is activated in project.ioc file. I found the file stm320xx_hal_exti.c and what I can see this is the file that deals with EXTI.

Because I'm a newbie regarding this processor I searching for the interrupt function. Is it HAL_EXTI_IRQHandler() ?

If U have another Tips & Trix/manual for the processor and how to make a sw design in this target I would appreciate a tip. I found Target Device Docs and Resources in the Help menu i the IDE...

Thanx

Piranha
Chief II

> I have two UART ports. Both can occupy an interpreter and each port sets a flag that says "I now own the interpreter". That flag is set in this ISR().

And why cannot it be done when the data is received?

Haddock
Associate III

You are probably right. I can set the flag after the first byte has been received. The uart-ports has their own buffer but there is only one input buffer for the interpreter. I can set the flag in Rx-complete IRQ for the specific port.

Thanx. It is a simple solution and I get less IRQ:s.

Hi @Håkan Nalén​ ,

If you need a simple EXTI example, you can refer to this wiki article: Getting started with EXTI.

Several ready to use examples are also available in the STM32CubeL0 package. You can refer to some of them here.

-Amel

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.