Toolchain:
IAR Embeded Workbench ARM
Toolchain version:
9.20.2
MbedOS version:
6.9.0
Target:
nucleo-L476RG
Hi,
I found that bufferedserial skip character after I reduce system clock from 80MHz to 16MHz.
For example, When I send characters like “123456789”, sometimes bufferedserial skip a character like “12356789”.
What I was do to reduce clock is below.
- Change clock CLOCK_SOURCE setting from USE_PLL_MSI to USE_PLL_HSI in mbed_config.h
- Configure SetSysClock_PLL_HSI(void) in system_clock.c as below.
- Change RCC_ClkInitStruct.SYSCLKSource from RCC_SYSCLKSOURCE_PLLCLK to RCC_SYSCLKSOURCE_HSI
- Change FLASH_LATENCY setting from FLASH_LATENCY_4 to FLASH_LATENCY_0
- Call SystemCoreClockUpdate() function before setting uart baudrate.
I found the points things below during I debug this problem.
- To enter uart interrupt handler is delay because a processing time of LPTIM interrupt handler is long.(around 80us to 90us)
- The uart interrupt handler execute reading character from RDR and push data to rxbuf, so uart skip a character if to enter uart interrupt handler is delay.
- LPTIM interrupt handler calls __disable_irq, so uart interrupt handler can’t start process until prosess of finishing LPTIM interrupt handler.
- hal_critical_section_enter function that calls __disable_irq is weak function.
Can I remove __disable_irq flom the hal_critical_section_enter function?
Could you give me advice to avoid bufferedserial skip character?
Thank you, Soichiro.