Tool/software:
Hi Team,
I am developing a device that can use a button to power on/off after a long press. Previously it worked fine, but recently I added an on-chip OAD feature on it.
After that I found that I can only shutdown the device after a long press but cannot wake it up again.
Here is my main logic of button wake up/shutdown after a long press, I place Boot_init() in the beginning of SimplePeripheral_taskFxn function:
void Boot_Init()
{
PowerCC26X2_ResetReason resetReason = PowerCC26X2_getResetReason();
if(resetReason == PowerCC26X2_RESET_SHUTDOWN_IO)
{
PowerCC26X2_releaseLatches();
BootCountDownCreate();
BootCountDownInit();
GPIO_setConfig(CONFIG_GPIO_MPB_CONST, GPIO_CFG_IN_PU);
uint8_t press = GPIO_read(CONFIG_GPIO_MPB_CONST);
BootServiceRoutine(press);
BootCountEliminate();
GPIO_resetConfig(CONFIG_GPIO_MPB_CONST);
howToBoot = 0x00;
}
else if (resetReason == PowerCC26X2_RESET_TCK_NOISE)
{
howToBoot = 0x01;
}
else if(resetReason == PowerCC26X2_RESET_SYSTEM)
{
howToBoot = 0x02;
}
else if(resetReason == PowerCC26X2_RESET_WARM_RESET) /*Fast Boot*/
{
howToBoot = 0x03;
}
else if(resetReason == PowerCC26X2_RESET_CLK)
{
howToBoot = 0x04;
}
else if(resetReason == PowerCC26X2_RESET_VDDR)
{
howToBoot = 0x05;
}
else if(resetReason == PowerCC26X2_RESET_VDDS)
{
howToBoot = 0x06;
}
else if(resetReason == PowerCC26X2_RESET_PIN)
{
howToBoot = 0x07;
}
else if(resetReason == PowerCC26X2_RESET_POR)
{
howToBoot = 0x08;
}
}
void BootServiceRoutine(uint8_t isWakeUp)
{
uint8_t BOOT_FINISHED = 0x00;
if(isWakeUp == 0)
{
/*If user is still pressing the button, the Count Down timer starts immediately */
uint8_t stillPress = GPIO_read(CONFIG_GPIO_MPB_CONST);
if(stillPress == 0x00)
{
/*Starts Counting Down for BOOTREADY_TIME x BOOTREADY_COUNT seconds*/
BootCountStart();
}
/*We haven't done booting yet! Although you are pressing the button! Don't put down your hand!*/
while(BOOT_FINISHED == 0x00)
{
/* status = 0x01 --> release the button
* status = 0x00 --> press the button
*/
uint8_t status = GPIO_read(CONFIG_GPIO_MPB_CONST);
/*Oh my god! You have released the button! Let me go to sleep again!*/
if(status == 0x01)
{
/*Count-Down Timer Stops*/
BootCountStop();
/*Enters Shut Down Mode again*/
SystemShutDownRoutine();
}
/*If the user is still pressing the button until TIME'S UP, the count down timer stops! Boot Routine is finished! */
/*For each 500 ms timer overflow, bootCount increases by 1.
*To have 1.5 seconds delay, bootReady is 3.
*To see the blink, wait until the bootReady is 3 while you are pressing the button!
* */
if(bootReady >= BOOTREADY_COUNT)
{
/*Count-Down finished*/
BootCountStop();
/*Congratulations! BOOT Process is Done ! Get out of the loop! Enjoy driving! */
BOOT_FINISHED = 0x01;
}
}
}
else if(isWakeUp == 1)
{
while(BOOT_FINISHED == 0x00)
{
/*Enters Shut Down Mode again*/
SystemShutDownRoutine();
}
}
}
void SystemShutDownRoutine()
{
GPIO_resetConfig(CONFIG_GPIO_MPB_CONST);
/* How to wake me up?? */
GPIO_setConfig(CONFIG_GPIO_MPB_CONST,GPIO_CFG_INPUT_INTERNAL | GPIO_CFG_PULL_UP_INTERNAL | GPIO_CFG_SHUTDOWN_WAKE_LOW);
/* Let me sleep! Bye! */
Power_shutdown(0, 0);
while(1)
{
}
}
I wonder if this problem is related to bim_onchip, so I need to implement my button press logic to the bim project?
I am using I am using simplelink_cc13xx_cc26xx_sdk_7_40_00_77 and CCS 12.8.1, could you help me with this problem?
Thanks a lot.
Jermyn