I create e new project for a custom board using KSDK + PEx and then I add MQX like this Training: Training Class: MQX RTOS for Kinetis SDK, Kinetis Design Studio (6 labs, including TCP/IP)
Looking the way HAL and FSL work I think is not any more necessary create a BSP. PEx take care of the hardware configuration. So I went in this way.
Then I create tasks OK, RS232 for debug is Ok, interrupts for GPIO when MCU is wake and for LLWU when is in STOP and everithing is working.
But I need to change my clock from run (48Mhz in startup) to low power to (4Mhz and stop in LLS) mode and I note when I change my clock using:
CLOCK_SYS_SetConfiguration(&clockMan1_InitConfig1); // Will run in 4Mhz for Low power mode
the _time_delay() function from MQX not work as expectec taking much more time to execute, I think because the clock #1 I´m running in lower clock.
then I call:
POWER_SYS_SetMode(1U, kPowerManagerPolicyAgreement); // put in STOP mode LLS
And is in LLS just fine.
My question is:
How can I tell to MQX that the clock changed to calculate the _time_delay() correctly? I know that is in _bsp_pre_init() that MQX receive the clock config and make the adjustments, but when I change clock I need to update, I try recall _bsp_pre_init() or some internal function that bsp_pre/_init calls and the _time_delay() get work, but I not some other strange behaviors. Some one have a good way to do this?
MQX for KSDK