Hi,
I'm experiencing strange behavior while I debug a custom KL03Z8 board and MCUxpresso v11.0.0. I'm able to program/flash the device, enter to the main() and stop waiting for the resume (F8). I can also do step over actions (F6) but if I restart the execution it stops the debugger unexpectedly and I have no debug information available anymore. Here's the current perspective in this situation.
More hints:
regards,
gaston
It seems to be related to the NMI input (pin13 of MKL03Z8VFG4) and a low voltage level on this pin at power up?
regards,
gaston
Hi,
It is in startup_mkl03z.c. Please find
__attribute__ ((used,section(".FlashConfig"))) const struct {
unsigned int word1;
unsigned int word2;
unsigned int word3;
unsigned int word4;
} Flash_Config = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFE};
When the code is programmed into flash, this config is also write to the place.
Regards,
Jing
Hi Jing,
In my startup_mkl03z4.c I've found
__attribute__ ((used,section(".FlashConfig"))) const struct {
unsigned int word1;
unsigned int word2;
unsigned int word3;
unsigned int word4;
//} Flash_Config = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFF3DFE};
} Flash_Config = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFF39FE}; // NMI disabled
Could you confirm me this is correct to disable the NMI (bit 2 of FTFA_FOPT)? I'm not able to find more information about the data structure and its relation with the flash registers.
regards,
gaston
Thank you Jing but the problem persists even with NMI_DIS = 0.
It works fine if PTB5 is disconnected from a GND pull-down resistor and left in High-Z
Any hints?
gaston
Hi,
Please see reference manual Figure 6-1. Now, FOPT[BOOTPIN_OPT]=0 and BOOTCFG0 pin=0. (Please note that BOOTCFG0 pin share with NMI pin). Then system boot from ROM. Figure 11-2 shows that if boot from ROM, it will disable Timeout detection. So, the ROM code will loop forever.
If you want to pull down the NMI/BOOTCFG0 pin, you can set FOPT[BOOTSRC_SEL] to 10/11.
Regards,
Jing
Hi Jing,
Thank you.
Now I see it more clear but I have managed to do it in a different way. The key is the BOOTPIN_OPT that It has to be set to 1 in order tho boot from BOOTSRC_SEL configuration. If BOOTSRC_SEL = 00 the device will boot from flash as in most cases.
In summary, now it works correctly with the following configuration:
FOPT[NMI_DIS]=0
FOPT[BOOTPIN_OPT]=1
FOPT[BOOTSRC_SEL]=00
__attribute__ ((used,section(".FlashConfig"))) const struct {
unsigned int word1;
unsigned int word2;
unsigned int word3;
unsigned int word4;
//} Flash_Config = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFF3DFE};
//} Flash_Config = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFF39FE}; // NMI disabled
} Flash_Config = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFF3BFE}; // NMI disabled & BOOTPIN_OPT = 1
regards,
gaston