Disable reset and NMI pins on MKL16Z128

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

Disable reset and NMI pins on MKL16Z128

Jump to solution
627 Views
mlun
Contributor I

Hello!

I have a custom board where I need both NMI and reset pin.

I use KDS 3.0.0 and I am not using processorexpert. Debugger is Jlink. Everything else is working fine as long as these pins stays inactive.

I tried the following code in an header file:

typedef struct stKINETIS_FLASH_CONFIGURATION                      // loaded from FLASH 0x00000400 at reset

{

     unsigned char  ucBackdoorComparisonKey[8];

     unsigned char  ucProgramFlashProtection[4];

     unsigned char  reserved1;

     unsigned char  reserved2;

     unsigned char  ucNonvolatileOption;

     unsigned char  ucDataFlashSecurity;

} KINETIS_FLASH_CONFIGURATION;

const KINETIS_FLASH_CONFIGURATION __attribute__((section(".f_config"))) __flash_config

= {

       0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,

     0xff,0xff,0xff,0xff,
     0xff,
     0xff,
     0b11110011,  //disable nmi and reset
     0b11111110  //unsecure

};

This does not seem to have any effect, reading memory location 0x040D gives 0xFF and pins are still active.

Is there something that owerrides this or what have I missed?

Best regards

Magnus Lundell

Finland

0 Kudos
1 Solution
396 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Magnus Lundell,

    I think you modify the wrong address, because from your defination:

const KINETIS_FLASH_CONFIGURATION __attribute__((section(".f_config"))) __flash_config

= {

      0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,

    0xff,0xff,0xff,0xff,
    0xff,
    0xff,
    0b11110011,  //disable nmi and reset
    0b11111110  //unsecure

};

Do you mean your .f_config is from 0x400? then  your  0b11110011,  //disable nmi and reset  actually is 0X40E, not 0x40D, please take care!

I create a barebone KDS project, I can modify the 0X40D successfully!

47.jpg

The attachment is my test project, you can refer to it!

After you modify it, you can generate a .hex file to check your 0X40D, whether you have modified it successfully!

Wish it helps you!

If you still have question, please contact me!


Have a great day,
Jingjing

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
2 Replies
397 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Magnus Lundell,

    I think you modify the wrong address, because from your defination:

const KINETIS_FLASH_CONFIGURATION __attribute__((section(".f_config"))) __flash_config

= {

      0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,

    0xff,0xff,0xff,0xff,
    0xff,
    0xff,
    0b11110011,  //disable nmi and reset
    0b11111110  //unsecure

};

Do you mean your .f_config is from 0x400? then  your  0b11110011,  //disable nmi and reset  actually is 0X40E, not 0x40D, please take care!

I create a barebone KDS project, I can modify the 0X40D successfully!

47.jpg

The attachment is my test project, you can refer to it!

After you modify it, you can generate a .hex file to check your 0X40D, whether you have modified it successfully!

Wish it helps you!

If you still have question, please contact me!


Have a great day,
Jingjing

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
396 Views
mlun
Contributor I

Thank you for your time!

Now the problem is solved, and I can say that I should have observed that lines  :smileyhappy: ,

/* Flash Configuration */

    .section .FlashConfig, "a"

    .long 0xFFFFFFFF

    .long 0xFFFFFFFF

    .long 0xFFFFFFFF

    .long 0xFFFFFFFE

,in the startupfile.s file the first time.

You are right about my mistake with the adress too.

Thank you!

0 Kudos