LPUART_DRV_SendDataBlocking in bootloader not allowing User application to print logs

cancel
Showing results for 
Search instead for 
Did you mean: 

LPUART_DRV_SendDataBlocking in bootloader not allowing User application to print logs

331 Views
akshaykul89
Contributor III

Hello,

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

ex. 

LPUART_DRV_AbortSendingData(INST_LPUART1);
LPUART_DRV_Deinit(INST_LPUART1);
INT_SYS_DisableIRQGlobal();
EDMA_DRV_Deinit();
RTC_DRV_Deinit(RTCTIMER1);

JumpToUserApplication(<given address>);

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

Tags (2)
3 Replies

219 Views
raresvasile
NXP Employee
NXP Employee

Hello,

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.

Thanks,

Rares

219 Views
akshaykul89
Contributor III

Hello Rares,

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.

Regards,

Akshay K.

0 Kudos

219 Views
raresvasile
NXP Employee
NXP Employee

Hi Akshay,

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.

Best regards,

Rares

0 Kudos