How do I get the wake source for K344

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

How do I get the wake source for K344

Jump to solution
784 Views
ZDDL
Contributor III

I looked at the S32K3 Low Power Management AN and demos, but those demos uses DS3.4, which I couldn't open and compile. Is there a demo of DS3.5 available?

I have a problem with low power Management. After the MCU is awakened, the reset type obtained by using Power_Ip_GetResetReason() is MCU_WAKEUP_REASON, and this is correct. But when I used Wkpu Ip GetInputState() to get the wake source, I didn't get the correct result.  I don't know why.

ZDDL_2-1732804683081.png

 

ZDDL_1-1732804624327.png

This is my test project. I hope someone could help me.

Thanks!

0 Kudos
Reply
1 Solution
763 Views
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @ZDDL,

You can refer to the following examples: S32K3 Low Power Management AN and demos RTD 4.0.0 & 5.0.0 - NXP Community.

For the wakeup source, please try reading the registers directly:

uint32_t WISR_Value;
uint32_t WISR64_Value;

void WKPU_Handler(void)
{
	/*store the WISR value which indicate the wake up source.*/
	WISR_Value = IP_WKPU->WISR;
	WISR64_Value = IP_WKPU->WISR_64;
	if(MCU_WAKEUP_REASON == Power_Ip_GetResetReason())
	{
		printf("Reset reason = MCU_WAKEUP_REASON\r\n");
	}
	printf("WISR = %"PRIu32",", WISR_Value);
	printf("WISR64 = %"PRIu32".\n", WISR64_Value);
	/*Clear the flag by writing 1.*/
	IP_WKPU->WISR = 0xffffffff;
	IP_WKPU->WISR_64 = 0xffffffff;
	__asm("dsb");
	__asm("isb");
}

Best regards,
Julián

View solution in original post

0 Kudos
Reply
1 Reply
764 Views
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @ZDDL,

You can refer to the following examples: S32K3 Low Power Management AN and demos RTD 4.0.0 & 5.0.0 - NXP Community.

For the wakeup source, please try reading the registers directly:

uint32_t WISR_Value;
uint32_t WISR64_Value;

void WKPU_Handler(void)
{
	/*store the WISR value which indicate the wake up source.*/
	WISR_Value = IP_WKPU->WISR;
	WISR64_Value = IP_WKPU->WISR_64;
	if(MCU_WAKEUP_REASON == Power_Ip_GetResetReason())
	{
		printf("Reset reason = MCU_WAKEUP_REASON\r\n");
	}
	printf("WISR = %"PRIu32",", WISR_Value);
	printf("WISR64 = %"PRIu32".\n", WISR64_Value);
	/*Clear the flag by writing 1.*/
	IP_WKPU->WISR = 0xffffffff;
	IP_WKPU->WISR_64 = 0xffffffff;
	__asm("dsb");
	__asm("isb");
}

Best regards,
Julián

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2003827%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EHow%20do%20I%20get%20the%20wake%20source%20for%20K344%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2003827%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%3CSPAN%3EI%20looked%20at%20the%20S32K3%20Low%20Power%20Management%20AN%20and%20demos%2C%20but%20those%20demos%20uses%20DS3.4%2C%20which%20I%20couldn't%20open%20and%20compile.%26nbsp%3BIs%20there%20a%20demo%20of%20DS3.5%20available%3F%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EI%20have%20a%20problem%20with%20low%20power%20Management.%20After%20the%20MCU%20is%20awakened%2C%20the%20reset%20type%20obtained%20by%20using%20Power_Ip_GetResetReason()%20is%20MCU_WAKEUP_REASON%2C%20and%20this%20is%26nbsp%3Bcorrect.%20But%20when%20I%20used%20Wkpu%20Ip%20GetInputState()%20to%20get%20the%20wake%20source%2C%20I%20didn't%20get%20the%20correct%20result.%26nbsp%3B%26nbsp%3BI%20don't%20know%20why.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22ZDDL_2-1732804683081.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22ZDDL_2-1732804683081.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F313166iCDE40D937314B581%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22ZDDL_2-1732804683081.png%22%20alt%3D%22ZDDL_2-1732804683081.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22ZDDL_1-1732804624327.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22ZDDL_1-1732804624327.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F313165i0595748CE9C8322A%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22ZDDL_1-1732804624327.png%22%20alt%3D%22ZDDL_1-1732804624327.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EThis%20is%20my%20test%20project.%26nbsp%3BI%20hope%20someone%20could%20help%20me.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EThanks!%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2003927%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20How%20do%20I%20get%20the%20wake%20source%20for%20K344%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2003927%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F232867%22%20target%3D%22_blank%22%3E%40ZDDL%3C%2FA%3E%2C%3C%2FP%3E%0A%3CP%3EYou%20can%20refer%20to%20the%20following%20examples%3A%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2FS32K-Knowledge-Base%2FS32K3-Low-Power-Management-AN-and-demos-RTD-4-0-0-amp-5-0-0%2Fta-p%2F1993152%22%20target%3D%22_blank%22%3ES32K3%20Low%20Power%20Management%20AN%20and%20demos%20RTD%204.0.0%20%26amp%3B%205.0.0%20-%20NXP%20Community%3C%2FA%3E.%3C%2FP%3E%0A%3CP%3EFor%20the%20wakeup%20source%2C%20please%20try%20reading%20the%20registers%20directly%3A%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-c%22%3E%3CCODE%3Euint32_t%20WISR_Value%3B%0Auint32_t%20WISR64_Value%3B%0A%0Avoid%20WKPU_Handler(void)%0A%7B%0A%09%2F*store%20the%20WISR%20value%20which%20indicate%20the%20wake%20up%20source.*%2F%0A%09WISR_Value%20%3D%20IP_WKPU-%26gt%3BWISR%3B%0A%09WISR64_Value%20%3D%20IP_WKPU-%26gt%3BWISR_64%3B%0A%09if(MCU_WAKEUP_REASON%20%3D%3D%20Power_Ip_GetResetReason())%0A%09%7B%0A%09%09printf(%22Reset%20reason%20%3D%20MCU_WAKEUP_REASON%5Cr%5Cn%22)%3B%0A%09%7D%0A%09printf(%22WISR%20%3D%20%25%22PRIu32%22%2C%22%2C%20WISR_Value)%3B%0A%09printf(%22WISR64%20%3D%20%25%22PRIu32%22.%5Cn%22%2C%20WISR64_Value)%3B%0A%09%2F*Clear%20the%20flag%20by%20writing%201.*%2F%0A%09IP_WKPU-%26gt%3BWISR%20%3D%200xffffffff%3B%0A%09IP_WKPU-%26gt%3BWISR_64%20%3D%200xffffffff%3B%0A%09__asm(%22dsb%22)%3B%0A%09__asm(%22isb%22)%3B%0A%7D%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EBest%20regards%2C%3CBR%20%2F%3EJuli%C3%A1n%3C%2FP%3E%3C%2FLINGO-BODY%3E