The question about the PTB5 in the KL02.

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

The question about the PTB5 in the KL02.

Jump to solution
1,904 Views
小勇邹
Contributor II

The PTB5 is configured as the normal input pin (ALT1) in my project.

My project works normally when the PTB5 input pin’s value=1.

But the project cannot work normally when the PTB5 input pin’s value=0.

All the interrupts in my project cannot work only more--the timer interrupt, the SPI interrupt and so on.

I think it is caused by the “NMI_b” property in the PTB5.

Can you tell me how to solve the problem?

Labels (1)
0 Kudos
Reply
1 Solution
1,768 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Robin,

   IAR is special, you need to enter :

--enable_config_write “ in Flash loader configuration windows.

More details, please check my attached doc, it is for KL03 in IAR to modify the FOPT register, but KL02 is the same.

Wish it helps you!


Have a great day,
Kerry

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

View solution in original post

0 Kudos
Reply
7 Replies
1,768 Views
mjbcswitzerland
Specialist V

Robin

Disable the NMI function at the pin in the FTFA_FOPT setting:

pastedImage_1.png

To do this you need to edit the Flash Configuration settings.

In the uTasker project it is done by configuring the define

#define KINETIS_FLASH_CONFIGURATION_NONVOL_OPTION  (FTFL_FOPT_RESET_PIN_ENABLED | FTFL_FOPT_LPBOOT_NORMAL | FTFL_FOPT_NMI_DISABLED)

In other libraries you may have to search for an assembler file containing these values and modify them manually.

Regards

Mark

http://www.utasker.com/kinetis/FRDM-KL02Z.html

0 Kudos
Reply
1,768 Views
小勇邹
Contributor II

Mark,

Thank you for your help.

The IAR is used in the project.

But FTFA_FOPT cannot be changed in the debug mode.

After the firmware is downloaded from the IAR, the value from 0x400 to 0x40B has been changed.

But the value in the 0x40D(FTFA_FOPT) cannot be changed.

So my project still cannot work normally when the firmware is downloaded by the IAR.

And I generate the .bin file by the IAR and find that the value in the 0x40D(FTFA_FOPT) can be changed.

Can you tell me why the value in the 0x40D(FTFA_FOPT) cannot be changed in the debug mode?

 

#pragma segment="FlashConfig_region"

#pragma location="FlashConfig_region"

__root static const uint8_t Config[16]= 

{

   /* NV_BACKKEY3: KEY=0xFF */

    0xFFU,

   /* NV_BACKKEY2: KEY=0xFF */

    0xFFU,

   /* NV_BACKKEY1: KEY=0xFF */

    0xFFU,

   /* NV_BACKKEY0: KEY=0xFF */

    0xFFU,

   /* NV_BACKKEY7: KEY=0xFF */

    0xFFU,

   /* NV_BACKKEY6: KEY=0xFF */

    0xFFU,

   /* NV_BACKKEY5: KEY=0xFF */

    0xFFU,

   /* NV_BACKKEY4: KEY=0xFF */

    0xFFU,

   /* NV_FPROT3: PROT=0xFF */

    0xFFU,

   /* NV_FPROT2: PROT=0xFF */

    0xFFU,

   /* NV_FPROT1: PROT=0xFF */

    0xFFU,

   /* NV_FPROT0: PROT=0xFF */

    0xFFU,

   /* NV_FSEC: KEYEN=1,MEEN=3,FSLACC=3,SEC=2 */

    0x7EU,

   /* NV_FOPT: =1,=1,FAST_INIT=1,LPBOOT1=1,RESET_PIN_CFG=1,NMI_DIS=0,=1,LPBOOT0=1 */

    0xFBU,

    0xFFU,

    0xFFU

     

  };

0 Kudos
Reply
1,769 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Robin,

   IAR is special, you need to enter :

--enable_config_write “ in Flash loader configuration windows.

More details, please check my attached doc, it is for KL03 in IAR to modify the FOPT register, but KL02 is the same.

Wish it helps you!


Have a great day,
Kerry

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

0 Kudos
Reply
1,768 Views
小勇邹
Contributor II

Hi Kerry,

Thank you very much. My project can work normally now after entering ” --enable_config_write “ in Flash loader configuration windows.

0 Kudos
Reply
1,768 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Robin,

   You are welcome!

   If you still  have question about this topic, just let me know!

   If your question is solved, please help to mark the correct answer, just to close this question.


Have a great day,
Kerry

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

0 Kudos
Reply
1,768 Views
小勇邹
Contributor II

Hi Kerry,

I still have a question about this.

Why all the other interrupts are failed when the NMI_b of the PTB5 is enabled

When should we use the function of the NMI_b of the PTB5?

0 Kudos
Reply
1,768 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Robin,

 Sorry for my later reply because of China's National Day and Mid-Autumn Festival.

I don't think if the NMI is enabled, other interrupts are failed if your NMI interrupt is not triggered.

You can make sure PTB5 is higher, then check other interrupt, it should works. But if your NMI is low, your code will enter NMI interrupt and always in that handler, it will caused other interrupt can't enter.

Wish it helps you!


Have a great day,
Kerry

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

0 Kudos
Reply