Part Number:CC2640R2F
Tool/software: TI C/C++ Compiler
Hello,
I'm using the 5X5 package variant of the CC2640r2. I'm trying to implement a task whereby I GPIO_toggle(bled) when button 1 in pressed. At the end of my thread I call
Task_construct(&myTask, myThread, &taskParams, Error_IGNORE);
I get the following errors
![]()
I've ported the code to a SaBLE-x-R2 using their instructions and the device work fine until I start diddling the pins. I've changed pin 7 & 13 in the attached board file. I've changed the #define for the pins namely, "bled" and "BTN1". The task function is taken directly from the SimpleLink Academy BLE example. Board file and conStatus are attached for reference. Any thoughts on how best to proceed would be appreciated.
/** ============================================================================
* Symbol by generic Board.c to include the correct kit specific Board.c
* ==========================================================================*/
#define CC2650EM_5XD
/* Mapping of pins to board signals using general board aliases
* <board signal alias> <pin mapping>
*/
//LEDs
#define Board_LED_ON 0 /* LEDs on SaBLE-x EM board LEDs are active low */
#define Board_LED_OFF 1
#define Board_GLED IOID_14
#define Board_BLED IOID_7
#define Board_RLED IOID_4
// Button Board
#define Board_KEY1 IOID_13
#define Board_KEY2 IOID_9
// Other button definitions for code compatibility
#define Board_PIN_BUTTON0 Board_KEY1
#define Board_PIN_BUTTON1 Board_KEY2
#define Board_BTN1 Board_KEY1
#define Board_BTN2 Board_KEY2
// UART Board
#define Board_UART_RX IOID_1
#define Board_UART_TX IOID_0
#define Board_UART_CTS PIN_UNASSIGNED
#define Board_UART_RTS PIN_UNASSIGNED
// SPI Board
#define Board_SPI0_MISO IOID_12
#define Board_SPI0_MOSI IOID_11
SECOND FILE
/*
* conStatus.c
*
* Created on: Jan 16, 2019
* Author: Owner
*/
#include <stdint.h>
#include <stddef.h>
#include <xdc/std.h>
#include <xdc/runtime/Error.h>
#include <ti/sysbios/BIOS.h>
#include <ti/sysbios/knl/Semaphore.h>
#include <ti/sysbios/knl/Task.h>
/* Driver Header files */
#include <ti/drivers/GPIO.h>
#include <ti/display/Display.h>
#include <ti/drivers/ADC.h>
/* Example/Board Header files */
#include "Board.h"
Task_Struct myTask;
#define THREADSTACKSIZE 1024
uint8_t myTaskStack[THREADSTACKSIZE];
uint16_t adcValue;
/* extern Display_Handle dispHandle;
Semaphore_Handle adcSem; */
/********** gpioButtonFxn0 **********/
void gpioButtonFxn0(uint_least8_t index)
{
/* Clear the GPIO interrupt and toggle an LED */
GPIO_toggle(Board_BLED);
//Semaphore_post(adcSem);
}
/********** myThread **********/
void *myThread(void *arg0) {
/* ADC_Handle adc;
ADC_Params params;
Semaphore_Params semParams;
Semaphore_Params_init(&semParams);
adcSem = Semaphore_create(0, &semParams, Error_IGNORE);
if(adcSem == NULL)
{
-- Semaphore_create() failed --
Display_print0(dispHandle, 0, 0, "adcSem Semaphore creation failed\n");
while (1);
} */
/* Initialize GPIO driver */
GPIO_init();
GPIO_setConfig(Board_BTN1, GPIO_CFG_IN_PU | GPIO_CFG_IN_INT_FALLING);
/* install Button callback */
GPIO_setCallback(Board_BTN1, gpioButtonFxn0);
/* Enable interrupts */
GPIO_enableInt(Board_BTN1);
/* ADC_Params_init(¶ms);
adc = ADC_open(Board_ADC0, ¶ms);
if (adc == NULL) {
Display_printf(dispHandle, 6, 0, "Error initializing ADC channel 0\n");
while (1);
}
while (1) {
-- Pend on semaphore, tmp116Sem --
Semaphore_pend(adcSem, BIOS_WAIT_FOREVER);
-- Blocking mode conversion --
ADC_convert(adc, &adcValue);
Display_printf(dispHandle, 6, 0, "ADC value: %d\n", adcValue);
} */
return 0;
}
/********** myThread_create **********/
void myThread_create(void) {
Task_Params taskParams;
// Configure task
Task_Params_init(&taskParams);
taskParams.stack = myTaskStack;
taskParams.stackSize = THREADSTACKSIZE;
taskParams.priority = 1;
Task_construct(&myTask, myThread, &taskParams, Error_IGNORE);
}