Hi all,
There is any possibility to enable and disable the KL26 dedicated external pin reset (PORTA, pin 20, PORTA_PCR20) by firmware?
In my app and at the first boot, I need to disable the pin reset. After 2 minutes, I woul like to use the pin reset. This is because I have an external watchdog that at the first power on of my device, it generates unconditionally a reset signal after 1 minute, because it has his own Power On Reset. Then every 1 minute it generates external reset signal if the KL26 doesn't send a wake signal before. This is because I need to bypass the first signal reset.
I'm using the PE (codewarrior procesor expert) in order to disable the reset control . Then, after 2 minutes I use this code in my firmware, to try to enable it, but doesn't work.
Code in red, is the same that PE generates. The code in blue is to activate the bit 3 (RESET_PIN_CFG bit) of FTFA_FOPT register, that theorically controls the reset pin.
My questions are:
1. This is possible to do?
2. Is the correct the code below?
FTFA_FOPT |= 0x08;
/// RCM_RPFW: RSTFLTSEL=0x1F
RCM_RPFW |= RCM_RPFW_RSTFLTSEL(0x1F);
// RCM_RPFC: RSTFLTSS=1,RSTFLTSRW=2
RCM_RPFC = (uint8_t)((RCM_RPFC & (uint8_t)~(uint8_t)(RCM_RPFC_RSTFLTSRW(0x01))) | (uint8_t)(RCM_RPFC_RSTFLTSS_MASK | RCM_RPFC_RSTFLTSRW(0x02)));
// S'activa pin reset.
PORTA_PCR20 = (uint32_t)((PORTA_PCR20 & (uint32_t)~(uint32_t)(PORT_PCR_ISF_MASK)) | (uint32_t)(PORT_PCR_MUX(0x07)));
Thank you very much.
Joaquim.
Solved! Go to Solution.
Hello Joaquim Martinez:
Unfortunately reactivating the reset pin at runtime is not possible. The FTFA_FOPT register is Read-Only and its value is loaded during MCU boot from the Flash Configuration Field space, specifically from the address 0x040D in Flash.
There is actually a documentation gap about the Reset_b pin. Future revisions of the documents should present similar information to this statement below:
"The RESET_B function is not selected by the PORTx_PCRn[MUX] value but is controlled by the FOPT[RESET_PIN_CFG] bit. The PORTx_PCRN[MUX] value has no effect when the RESET_B pin is configured as the reset pin function. If the reset pin function is disabled then the pin is configured in its DISABLED state. The pin can then be configured to its GPIO function by setting the PORTx_PCRn[MUX] value to 1".
I hope this helps to clarify. Sorry for the inconvenience.
Regards!,
Jorge Gonzalez
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hello Joaquim Martinez:
Unfortunately reactivating the reset pin at runtime is not possible. The FTFA_FOPT register is Read-Only and its value is loaded during MCU boot from the Flash Configuration Field space, specifically from the address 0x040D in Flash.
There is actually a documentation gap about the Reset_b pin. Future revisions of the documents should present similar information to this statement below:
"The RESET_B function is not selected by the PORTx_PCRn[MUX] value but is controlled by the FOPT[RESET_PIN_CFG] bit. The PORTx_PCRN[MUX] value has no effect when the RESET_B pin is configured as the reset pin function. If the reset pin function is disabled then the pin is configured in its DISABLED state. The pin can then be configured to its GPIO function by setting the PORTx_PCRn[MUX] value to 1".
I hope this helps to clarify. Sorry for the inconvenience.
Regards!,
Jorge Gonzalez
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Jorge,
Thank you very much for the info.
BR,
Joaquim.