RCM_GetPreviousResetSources(RCM) returns incorrect value

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

RCM_GetPreviousResetSources(RCM) returns incorrect value

Jump to solution
1,511 Views
gauravbanyal
Contributor IV

Hello,

 

I am working with a MKL03Z32 and I am using VLLS0 and VLLS3 states.

When I recover from these states to RUN state because of an LLWU interrupt source, the RCM_GetPreviousResetSources(RCM) returns an even number. It should be odd (with LSb = 1).

 

This is called before the function BOARD_InitPins(); in the main(). My code is based on the example "power mode switch"

 

Any ideas on what could be wrong?

 

Thanks!

Labels (1)
Tags (1)
0 Kudos
1 Solution
1,088 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi

Please check below threads about how to disable NMI function of KL03 PTB5:

Bare-metal on KL03: 

https://community.nxp.com/message/626738?commentID=626738#comment-626738 

Wish it helps.


Have a great day,
Ma Hui

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

View solution in original post

0 Kudos
8 Replies
1,088 Views
gauravbanyal
Contributor IV

When the MCU is in VLLS0 or VLLS3 state and I start flashing the MCU with the J-link probe, I always receive an odd value for that event. For the LLWU interrupt event, I always get an even value. I have seen values 0x20 and 0x400.

0 Kudos
1,088 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Gaurav,

As you know that the RCM_GetPreviousResetSources(RCM) function returns the RCM_SRS1/RCM_SRS0 registers value, if the value is 0x20, it means that watchdog resets the chip.  If the value is 0x40, it means that Reset pin  resets the chip.  

If you use LLWU interrupt source, have you set the LLWU module so that the external low leakage wakeup pin can reset the chip? which wake-up pin are you using?

Hope it can help you

BR

Xiangjun Rong

static inline uint32_t RCM_GetPreviousResetSources(RCM_Type *base)
{
#if (defined(FSL_FEATURE_RCM_REG_WIDTH) && (FSL_FEATURE_RCM_REG_WIDTH == 32))
    return base->SRS;
#else
    return (uint32_t)((uint32_t)base->SRS0 | ((uint32_t)base->SRS1 << 8U));
#endif /* (FSL_FEATURE_RCM_REG_WIDTH == 32) */
}

0 Kudos
1,088 Views
gauravbanyal
Contributor IV

Hello Xiangjun,

I have this issue now again. Previously I had this issue on the old generation of the HW of the product we are trying to build. Now I have a new build with the same processor MKL03Z32 in the 16-pin package. 

The culprit is port pin PTB5.

In the earlier version of the hardware, this pin was configured as an analog input for the ADC. In the new version of the hardware (which I am using now), its a GPIO output pin. In either case, the problem is solved when I comment out the code doing the mux setting for this pin in BOARD_InitPins().

Issue is, I need to use this pin as a GPIO and my system cannot work without it. The Erata does not give me any information on this.

PLEASE HELP ON PRIORITY!!!

0 Kudos
1,088 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Gaurav,

I have checked the pin assignmet, for the MKL03Z32  with 16 pin package, the PTB5 is multiplexed with NMI pin, in default state after Reset, the PTB5 pin is in NMI function, you have to connect a pull-up resistor for the PIN so that the NMI pin is high after reset. If it is low after reset, the chip will enter NMI interrupt after reset.

For your current board, can you pull-up the PTB5 pin to high even if you use it as GPIO output?

BR

Xiangjun Rong

0 Kudos
1,088 Views
gauravbanyal
Contributor IV

Hi Xiangjun Rong,

For the moment, the boards are built without a pull-up. I am using it as a GPIO output.

Is the change that I have done above, risky? If not, I will prefer to not change the hardware at this point.

Best regards,

Gaurav.

0 Kudos
1,088 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Gaurav,

can the Kl03 start up successfully? if it can not(KL03 enters NMI interrupt after Reset), you have to connect a pull-up resisto by float wire.

BR

xiangjun Rong

0 Kudos
1,089 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi

Please check below threads about how to disable NMI function of KL03 PTB5:

Bare-metal on KL03: 

https://community.nxp.com/message/626738?commentID=626738#comment-626738 

Wish it helps.


Have a great day,
Ma Hui

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

0 Kudos
1,088 Views
gauravbanyal
Contributor IV

Hello Ma Hui,

Thanks for this. It was quite a long read in the community page you shared, to understand what needs to be done. But glad I did understand it in the end.

In "startup_MKL03Z4.s" I changed the line

FOPT          EQU     0x3D

to 

FOPT          EQU     0x39

After this, everything was fine :smileyhappy:

Thanks for your support!

BR\Gaurav.

0 Kudos