Part Number: LAUNCHXL-CC26X2R1
Other Parts Discussed in Thread: SYSBIOS
Hello,
I used BLE5Stack OAD Off Chip example and I created a second task to handle all of my customized activities. I keep my second task simple just for trying some little-partial codes like I2C communication or ADC, etc. Now, I am trying "pinShutDown" example like --> one of the buttons is used to shut-down the board (and I can do that) and the other one is used for to wakeup (just before shutting down, I arranged the other button as a wake-up pin) but I could not wake the board up!
NOTE THAT: My hardware has no problem because I tried "pinShutDown" example directly and it worked.
Here is how I added second task (NOTE: I added these codes in "main.c" )
//these codes are added top of the files
#include <xdc/std.h>
#include <ti/sysbios/knl/Task.h>
#include "CustomizationMain.h"
#ifndef TASK_STACK_SIZE
#define TASK_STACK_SIZE 4096
#endif
#ifndef TASK_PRIORITY
#define TASK_PRIORITY 4
#endif
/* Task's stack */
uint8_t sbcTaskStack[TASK_STACK_SIZE];
/* Task object (to be constructed) */
Task_Struct task0;
/* Task function */
void taskFunction(UArg arg0, UArg arg1)
{
PeripheralInit();
PeripheralRun();
}
Then, I added the code below in the "main()" function just after the line "SimplePeripheral_createTask();" and just before "BIOS_start();" function.
Task_Params taskParams; // Configure task Task_Params_init(&taskParams); taskParams.stack = sbcTaskStack; taskParams.stackSize = TASK_STACK_SIZE; taskParams.priority = TASK_PRIORITY; Task_construct(&task0, taskFunction, &taskParams, NULL);
Here is my other source code that does not work;
#define SLEEP_MS(a) usleep(a * 1000)
static bool But1Pressed = false;
static bool But2Pressed = false;
void BigDelay(uint32_t seconds)
{
int i = 0;
int howMany100ms = seconds * 1000 / 100;
for(i = 0; i < howMany100ms; i++)
usleep(100000);//100 ms
}
void gpioButtonFxn1(uint_least8_t index)
{
GPIO_toggle(CONFIG_GPIO_GLED);
SLEEP_MS(100);
if(But1Pressed == false)
But1Pressed = true;
else
But1Pressed = false;
}
/* Wake-up Button pin table */
//POWER_SAVING
PIN_Config ButtonTableWakeUp[] = {
CONFIG_PIN_BTN2 | PIN_INPUT_EN | PIN_PULLUP | PINCC26XX_WAKEUP_NEGEDGE,
PIN_TERMINATE /* Terminate list */
};
void PeripheralInit(void)
{
/* Call driver init functions */
Board_init();
//pheripheral init here
GPIO_init();
GPIO_setConfig(CONFIG_GPIO_RLED, GPIO_CFG_OUTPUT | GPIO_CFG_OUT_HIGH);
GPIO_setConfig(CONFIG_GPIO_GLED, GPIO_CFG_OUTPUT | GPIO_CFG_OUT_LOW);
//GPIO Input with Interrupt, configuring input and internal pull-up with falling edge (falling edge can be seen easily in schematic)
GPIO_setConfig(CONFIG_GPIO_BTN1, GPIO_CFG_IN_PU | GPIO_CFG_IN_INT_FALLING);
/* install Button callback */
GPIO_setCallback(CONFIG_GPIO_BTN1, gpioButtonFxn1);
/* Enable interrupts */
GPIO_enableInt(CONFIG_GPIO_BTN1);
}
void PeripheralRun(void)
{
while(1)
{
BigDelay(1);
static int asd = 0;
Debug_Uart("loopCount: %d", (asd++));
if(But1Pressed)
{
But1Pressed = false;
Debug_Uart("but1");
/* Configure DIO for wake up from shutdown */
PINCC26XX_setWakeup(ButtonTableWakeUp);
Debug_Uart("LINE: %d", __LINE__);
GPIO_write(CONFIG_GPIO_RLED, CONFIG_GPIO_LED_OFF);
GPIO_write(CONFIG_GPIO_GLED, CONFIG_GPIO_LED_OFF);
Debug_Uart("LINE: %d", __LINE__);
/* Go to shutdown */
Power_shutdown(0, 0);
Debug_Uart("LINE: %d", __LINE__);
/* Should never get here, since shutdown will reset. */
while (1)
{
Debug_Uart("LINE: %d", __LINE__);
}
}
}
return;
}
Whit this code, I can see my debug prints, also I can shut-down the board but I CANNOT WAKE IT UP.
I need to wake it up because, in my project, I just used a single button to turn on and off the board.
Please help me with it.



