I have two applications bootloader and UserApp. In bootloader, I am using UART to print my trace logs using LPUART_DRV_SendDataBlocking API. Before jumping to UserApp, I am doing all deinit calls
But after that , I do not get any print from UserApp (it appears as if UserApp is not running at all from serial terminal, but I suspect UART is not working.)
To have an experiment, I changed a UART call from LPUART_DRV_SendDataBlocking to LPUART_DRV_SendData (no blocking) then with above deinitializations, I can see proper debug logs getting printed from application.
Can you please help me on, how I can still use LPUART_DRV_SendDataBlocking and can get proper logs from application as well ?
I feel, I am missing something in the process of deinitiazation in bootloader before jumping to UserApp.
More details about the setup :
-Board S32K148 EVB
-Flashing a binary (having bootloader as well as UserApp) in one go with JLink.exe
- For UART logs , I am using Teraterm and OpenSDA micro USB
LPUART_DRV_SendDataBlocking uses OSIF_SemaWait function which will turn on SysTick.
Can you add S32_SysTick->CSR = 0; before jumping to application code?
Let me know if it worked.
This is really awesome and perfect solution for my issue. It worked.
I was suspecting Semaphore in Blocking call but was not aware about root cause could be systick. Is there any possible HAL API to stop systick ? Can I possibly stop clock in bootloader before jumping from bootloader to UserApp ?
I am reinitializeing clock in UserApp. This is just an additional query.
Your reply will definitely add value to my knowledge. Thank you.
Unfortunately there is no API for turning off Systick, but setting CSR to 0 has the same result.
There is no function to turn off the clocks, but when the clock is initialized, it resets all clocks.
To avoid errors during initialization, all clock consuming peripherals(comm, timers) must be deinitialized before exiting the bootloader.