cancel
Showing results for 
Search instead for 
Did you mean: 

In MCU STM32F103RETxLQFP64, UART program stop system

HarishKumarSingh
Associate II

To,

Sir or Madam

I am making a embedded system with MCU STM32F103RETxLQFP64. In this MCU pin PC10 and PC11 is multipurpose pin. I use it for UART.


In project, PC10 and PC11 is used as GPIOs. I change functionality of pin. I used pin PC10 for UART4_TX and pin PC11 for UART4_RX. In cubeMX, I change functionality of pin and enable interrupt for reception. I generate code from cubeMX. In program I found UART4 initialization, transmission and reception function. I wrote program for UART communication.


System do not start after change of PC10 and PC11 functionality. On power on of system, program flow do not go to main() function.


Please give guidance to implement UART4 in this MCU.

4 REPLIES 4

And where does it go?

In disassembly view in debugger, where does PC (program counter) point?

JW

Program flow reach to main () function. System break during system clock configuration. I did not do any change for system clock. Program flow go as follow.
 
SystemClock_Config -> HAL_RCC_OscConfig -> RCC_Delay(1);
 
In RCC_Delay function, system break. Please see attachment. I attached picture of break from IDE.
 
Following files change in drivers.

stm32f1xx_it.h
+ Interrupt handler declare

main.c
+ UART4 intilization (baudrate)

stm32f1xx_hal_msp.c
+ UART4 hardware initilizaiton (pin)
+ UART4 hardware deinitialization

stm32f1xx_it.c
+ UART4 interrupt function

stm32f1xx_hal_uart.h
+ UART reception callback funtion decleartion

stm32f1xx_hal.c
+ HARL version update from 1.7 to 1.8

stm32f1xx_hal_adc.c , stm32f1xx_hal_adc_ex.c
+ ADC time detection program

stm32f1xx_hal_uart.c
+ function to receive data in blocking mode and non blocking mode
+ function to receive data in interrupt mode and DMA mode

Please give guidance to use UART 4.

 

From this description it's hard to judge where's the problem. It may be RCC_Delay() (? look into that function) or it may be any interrupt - check if VTOR is set properly and if you have the proper interrupt table. Alternatively try to disable all interrupts as a test.

JW

Watch the interrupt priorities, and avoid using delays in interrupts and call-backs.

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