Stm32 Verificar Interrupcao Pendente

Posted on

I am trying to transmit and receive data via UART/USART on stm32L476 discovery board to terminal on PC. I am able to transmit the data to PC, but I am not able to receive any.

My code is as follows:

Please let me know if you know the problem.I have tried removing the resistor connected to the Joystick which is also connected to the receive pin of USART2.

Bence Kaulics

STM32F0 Interrupt Debugging. The pin is pulled up (10k) externally and can be shorted to GND via a push button. If I probe the pin, I can see it toggle as I press the button. Further, if I poll the pin using a GPIOReadInputDataBit it is toggling correctly as I press the button. All my other interrupts that are configured by the same routine work fine. STM32Cube Building Blocks As would be expected, the STM32Cube embedded software is structured into a set of layers of increasing abstraction: Start up code and low level hardware interfaces are found in the bottom layer, and pre-configured examples are found in the top layer - with peripheral drivers, component drivers and middleware found in the layers in between. STM32Cube with FreeRTOS for ARM Cortex MCUs. Overview STM32Cube is free embedded software from ST that provides all the drivers and middleware components necessary to get up and running quickly on STM32 ARM Cortex-M microcontrollers. STM32Cube includes FreeRTOS. Highlights Comprehensive driver support; Graphics, USB, TCP/IP and FAT middleware.

3,3727 gold badges22 silver badges44 bronze badges
user8398475user8398475

2 Answers

You seem to be missing GPIO configuration.

Stm32 Verificar Interrupcao Pendente O

For this particular MCU, USART2 RX alternate function can be assigned to either PA3 or PD6. TX is either PA2 or PD5. Pick the variant you need and initialize the pins - in both cases it's AF7. Also make sure the clocks for USART and GPIO are enabled.

PendenteJacek ŚlimokJacek ŚlimokStm32 verificar interrupcao pendente y
1,5752 gold badges7 silver badges25 bronze badges

As it is, your code blocks until 10 bytes are received or 5 seconds timeout has elapsed. Then you are trying to read 1 byte in the array, but your read is out of bounds.To check that the UART works correctly you could try a very simple echo like this:

Guillaume MichelGuillaume Michel

Not the answer you're looking for? Browse other questions tagged stm32uartusartstm32ldiscovery or ask your own question.

$begingroup$

Issue:

I'm having an impossible time debugging why one of my interrupts isn't working. I'm trying to setup a hardware interrupt on PA3, but as soon as I initialize it, the interrupt triggers and then it never triggers again.

Hardware:

The pin is pulled up (10k) externally and can be shorted to GND via a push button. If I probe the pin, I can see it toggle as I press the button. Further, if I poll the pin using a GPIO_ReadInputDataBit it is toggling correctly as I press the button. All my other interrupts that are configured by the same routine work fine.

Software:

I'm including the code below, but I'm mostly hoping someone can help explain how to debug the interrupt handler. I don't know much about it beyond configuring it which had been working fine until this hiccup. (SWA_Button is the one that's not working, while all the others are fine). Am I missing something really obvious?

*** UPDATE:

I just noticed that it seems PB3 is what is triggering that interrupt. How is the interrupt handler supposed to differentiate between an interrupt on PB3 and PA3?

spizzak
spizzakspizzak
4072 gold badges7 silver badges17 bronze badges
$endgroup$

1 Answer

$begingroup$

I've found the issue. It turns out it is not possible to trigger off the same pin on multiple GPIO ports. I was overwriting my PA3 interrupt with a PB3 one.

spizzakspizzak
4072 gold badges7 silver badges17 bronze badges
$endgroup$

Not the answer you're looking for? Browse other questions tagged stm32interrupts or ask your own question.