Hello,
I built a project with KL03z board using MCUXpresso IDE, now I have to migrate to KDS. I encountered some problems during the process, so I decided to build from scratch and troubleshoot step by step.
One major problem is that the processor seems to run at a lower frequency ( I used the same TPM configuration btw) and this damages the functionality of the project. There is at least 7 microseconds between two flags when the TPM handler has nothing to do but clear the flag and toggle a pin. If I have more instructions that must be done between two flags this period grows longer.
So, I used the following function ( no TPM used) to toggle a pin an check the frequency with an oscilloscope ;
void delay( unsigned int time_del)
{
time_del *= X;
while (time_del--)
{
;
}
}
While using MCUXpresso, the value X is around 4.35 to count a million in one second, while in KDS I had to reduce it to 0.7 which is almost 6 times slower than the previuos case.
I thought maybe it's running in VLPR mode ( I think it doesn't switch from Normal Run unless configuered otherwise) and tried to disable other power modes and had no improvement.
Surely I'm missing something but I can't figure out what it is, so any sort of help would be highly appreciated
MSanad
Solved! Go to Solution.
Hi @ErichStyger
Thank you for your reply, your answers are of a great help, and sorry for late reply I just went back to lab.
I tried 'volatile' but that didn't seem to be the source of my problem.
After some invistigation I found my mistake, I just had to select the "HIRC clock" as the main clock.
In MCUXpresso there was the function " BOARD_BootClockRUN();" which did the job.
Without using processor expert in KDS, seems the board selects a lower frequency clock. So, Just typed down:
MCG -> MC |= MCG_MC_HIRCEN(1);
MCG -> C1 = MCG_C1_CLKS(0) ;
and it all went well
Hi @Msanad ,
I'm not sure if the code piece you gave here is real or not.
If this is real code, then no wonder that you see a huge difference. And you really never (never!) should write such a thing. Because the compiler simply can optimize it away. If you really want to keep it in place, use 'volatile' for it.
In essence to your question: KDS has an older gcc compiler, while the one in MCUXpresso is newer and optimizes a bit more. But if your turn on optimizations (e.g. -O3) for KDS, you will see the same.
I hope this helps.
Erich
Hi @ErichStyger
Thank you for your reply, your answers are of a great help, and sorry for late reply I just went back to lab.
I tried 'volatile' but that didn't seem to be the source of my problem.
After some invistigation I found my mistake, I just had to select the "HIRC clock" as the main clock.
In MCUXpresso there was the function " BOARD_BootClockRUN();" which did the job.
Without using processor expert in KDS, seems the board selects a lower frequency clock. So, Just typed down:
MCG -> MC |= MCG_MC_HIRCEN(1);
MCG -> C1 = MCG_C1_CLKS(0) ;
and it all went well
Hello,
Unfortunately, the KDS IDE is no longer supported, the new IDE is MCUXpresso. I apologize if this may cause an inconvenience.
Best regards,
Pavel