debug problem on KL03Z8

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

debug problem on KL03Z8

884 Views
gschelotto
Contributor V

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.

Screenshot from 2019-08-05 10-16-41-gas.png

More hints:

  • I'm using PE Multilink Universal FX debug prove
  • I've created the KL03Z8 project using MCUxpresso wizard, SDK v2.3.1 and ConfigTools for the Pins/Clocks initialization
  • Debug works fine and I have no issues with a KL03Z32 custom board (project created in the same way than previous KL03Z8 device)

regards,
gaston

0 Kudos
7 Replies

714 Views
gschelotto
Contributor V

It seems to be related to the NMI input (pin13 of MKL03Z8VFG4) and a low voltage level on this pin at power up?

I am trying to do the same procedure in a similar case for the MKE02Z family (see next post) with no success.
Digging into the KL03-Sub Reference Manual I've found the FTFA_FOPT register with the NMI_DIS field to disable the interrupt. However this register is located in the Flash memory and it's necessary to program the appropriate bits in the NVM option byte in order to change its value. How can I do it?

regards,
gaston

0 Kudos

714 Views
jingpan
NXP TechSupport
NXP TechSupport

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

0 Kudos

714 Views
gschelotto
Contributor V

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

0 Kudos

714 Views
jingpan
NXP TechSupport
NXP TechSupport

yes, it is.

Regards,

Jing

0 Kudos

714 Views
gschelotto
Contributor V

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

0 Kudos

714 Views
jingpan
NXP TechSupport
NXP TechSupport

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

0 Kudos

714 Views
gschelotto
Contributor V

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

0 Kudos