2023-10-30 03:37 AM
Hello,
I'm struggling with a really strange issue. I'm trying to make UART RX working on a STM32G4 custom board.
I've followed the UART Interrupt tutorial. (https://wiki.st.com/stm32mcu/wiki/Getting_started_with_UART)
I've tested it with Nucleo-G431RB and it works fine.
Now I'm running the exact same code on my custom board and I have nothing, when using the debugger I can see that the interrupt is never fired. I've check hardware connections and everything seems OK.
I've also tried to implement UART_Receive by polling mode => I can see in the debugger that characters are received, so Hardware is OK.
Can someone help me with this issue ?
Thanks
Solved! Go to Solution.
2023-10-31 04:04 AM
The waveform you've posted above is 2 bytes (0x4D 0x0A), that would explain the overrun.
Here is a generic checklist to troubleshoot "interrupt does not fire" problems.
JW
2023-10-31 04:43 AM
I've setup an interrupt on a GPIO and it doesn't fire also.
2023-10-31 06:25 AM
Then you have disabled interrupts globally, or your program entirely runs in some other interrupt of same or higher priority, or your program never reached the code enabling the interrupts.
If you pause execution, where does the PC (Program Counter) point to?
JW
2023-10-31 06:38 AM - edited 2023-10-31 06:38 AM
It points to the if statement of the while(1) loop in main.c.
The program never reaches HAL_EXTI_IRQHandler. (I tried to toggle a GPIO in it)
2023-10-31 06:43 AM
Looking at EXTI registers. the bit 5 of EXTI_FTSR1 is well set and when applying a 0 level on this pin the bit 5 of EXTI_PR1 is set to 1.
2023-10-31 06:47 AM
EXTI ?
Start by establishing the EXTIxx_IRQHandler() that's called by the NVIC, you are then responsible for calling into the HAL which then calls your function.
2023-10-31 07:06 AM
EXTI9_5_IRQHandler what should points to this function ?
2023-10-31 09:04 AM
I found a solution by adding "#define USER_VECT_TAB_ADDRESS" to the beginning of system_stm32g4xx.c. The interrupt vector table was not set correctly.
So what I did wrong when I've generate the code with MXCube ?
And why my old code was working on the Nucleo and not on my custom board ?
2023-10-31 09:46 AM
Did you power-cycle your board since first programming?
Maybe this - empty FLASH resulting in starting bootloader thus remapping the System memory instead of User FLASH at 0x0000'0000?
JW
2023-10-31 09:58 AM
What do you mean by power-cycle ? Just cut off power and re-power ? if so, yes i did it multiple times.
Anyways, thanks for your precious help, both of you.