2022-03-15 04:44 AM
I want to send the numbers in order but it only sends the number 0 constantly. When I make the delay 100ms it only sends 0 and 1. When I remove the delay completely, it sends numbers from 1 to 30 in order.
Solved! Go to Solution.
2022-03-15 06:31 AM
Sounds like it's resetting due to a watchdog or other event sometime 200-300ms after reset. That would explain all behavior.
Disable watchdog in option bytes.
Monitor NRST line to verify reset.
Read and clear RCC->CSR bits on startup to determine cause of reset.
2022-03-15 05:15 AM
I woudl try this code with external crystal oscilator. Or measure the USART output with osciloscope or LA (if timing is correct).
2022-03-15 05:54 AM
I tried with external 16MhZ crystal oscilator.
2022-03-15 06:13 AM
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI;
In this code is used internal oscilator. I dont know what you try.
Are some pulses on the Tx output or line hungs to L/H after some time?
2022-03-15 06:24 AM
I tried with external 16MhZ crystal oscilator but now i'm using internal OSC.
2022-03-15 06:31 AM
Sounds like it's resetting due to a watchdog or other event sometime 200-300ms after reset. That would explain all behavior.
Disable watchdog in option bytes.
Monitor NRST line to verify reset.
Read and clear RCC->CSR bits on startup to determine cause of reset.
2022-03-15 06:49 AM
I disabled watchdog in option bytes. It is working now