Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
User7804
Level 4
Level 4
Hi all,

void XMC_SCU_UnlockProtectedBits(void)
{
SCU_GENERAL->PASSWD = SCU_GCU_PASSWD_PROT_DISABLE;

while(((SCU_GENERAL->PASSWD) & SCU_GENERAL_PASSWD_PROTS_Msk))
{
/* Loop until the lock is removed */
}
}


IMO checking PROTS after unlocking is useless and dangerous: If an interrupt (taking more than 32 MCLK cycles) happens after unlocking, the funcion will wait forever.

Any idea what the author wanted to achieve with the PROTS query?

Oliver
0 Likes
2 Replies
Travis
Employee
Employee
First solution authored Welcome! 500 replies posted
If i remember correctly, after 32 clock cycles it will go back to LOCK state.
0 Likes
User7804
Level 4
Level 4
Hello Travis,

please read again my posting: " If an interrupt (taking more than 32 MCLK cycles) happens after unlocking, the function will wait forever."
0 Likes