Other Parts Discussed in Thread: SYSCONFIG, CC2640
HI
I have a CC2640R2 LaunchPad, I want to control the GPIO and SPI on the CC2640R2 LaunchPad via my smartphone.
so I used SYSCONFIG to generate a board file and add it to the "Simple Peripherals" project.. My steps are as follows:
1. Importing simple peripheral projects.
2.used SYSCONFIG to generate a board file.
/*
* ======== Board.c ========
* Configured TI-Drivers module definitions
*
* DO NOT EDIT - This file is generated for the CC2640R2_LAUNCHXL
* by the SysConfig tool.
*/
#include <stddef.h>
#ifndef DeviceFamily_CC26X0R2
#define DeviceFamily_CC26X0R2
#endif
#include <ti/devices/DeviceFamily.h>
#include "Board.h"
/*
* ============================= Display =============================
*/
#include <ti/display/Display.h>
#include <ti/display/DisplayHost.h>
#define Display_HOSTBUFFERSIZE 256
static char displayHostBuffer[Display_HOSTBUFFERSIZE];
DisplayHost_Object displayHostObject;
const DisplayHost_HWAttrs displayHostHWAttrs = {
.strBuf = displayHostBuffer,
.strBufLen = Display_HOSTBUFFERSIZE
};
const Display_Config Display_config[] = {
/* Board_Display0 */
{
.fxnTablePtr = &DisplayHost_fxnTable,
.object = &displayHostObject,
.hwAttrs = &displayHostHWAttrs
},
};
const uint_least8_t Display_count = 1;
/*
* =============================== DMA ===============================
*/
#include <ti/drivers/dma/UDMACC26XX.h>
#include <ti/devices/cc26x0r2/driverlib/udma.h>
#include <ti/devices/cc26x0r2/inc/hw_memmap.h>
UDMACC26XX_Object udmaCC26XXObject;
const UDMACC26XX_HWAttrs udmaCC26XXHWAttrs = {
.baseAddr = UDMA0_BASE,
.powerMngrId = PowerCC26XX_PERIPH_UDMA,
.intNum = INT_DMA_ERR,
.intPriority = (~0)
};
const UDMACC26XX_Config UDMACC26XX_config[1] = {
{
.object = &udmaCC26XXObject,
.hwAttrs = &udmaCC26XXHWAttrs,
},
};
/*
* =============================== GPIO ===============================
*/
#include <ti/drivers/GPIO.h>
#include <ti/drivers/gpio/GPIOCC26XX.h>
/*
* ======== gpioPinConfigs ========
* Array of Pin configurations
*/
GPIO_PinConfig gpioPinConfigs[] = {
/* DIO1 */
GPIOCC26XX_DIO_18 | GPIO_CFG_IN_NOPULL | GPIO_CFG_IN_INT_FALLING,
/* LED0 */
GPIOCC26XX_DIO_04 | GPIO_CFG_OUT_STD | GPIO_CFG_OUT_STR_MED | GPIO_CFG_OUT_HIGH,
/* POWER */
GPIOCC26XX_DIO_05 | GPIO_CFG_IN_NOPULL | GPIO_CFG_IN_INT_NONE,
/* NSS */
GPIOCC26XX_DIO_12 | GPIO_CFG_OUT_STD | GPIO_CFG_OUT_STR_MED | GPIO_CFG_OUT_HIGH,
/* RST */
GPIOCC26XX_DIO_15 | GPIO_CFG_OUT_STD | GPIO_CFG_OUT_STR_MED | GPIO_CFG_OUT_HIGH,
/* BUSY */
GPIOCC26XX_DIO_17 | GPIO_CFG_IN_NOPULL | GPIO_CFG_IN_INT_NONE,
};
/*
* ======== gpioCallbackFunctions ========
* Array of callback function pointers
*
* NOTE: Unused callback entries can be omitted from the callbacks array to
* reduce memory usage by enabling sorting (GPIO.optimizeCallbackTableSize = true)
*/
extern void DIO1_Callback(uint_least8_t index);
GPIO_CallbackFxn gpioCallbackFunctions[] = {
/* DIO1 */
DIO1_Callback,
};
/*
* ======== GPIOCC26XX_config ========
*/
const GPIOCC26XX_Config GPIOCC26XX_config = {
.pinConfigs = (GPIO_PinConfig *)gpioPinConfigs,
.callbacks = (GPIO_CallbackFxn *)gpioCallbackFunctions,
.numberOfPinConfigs = 6,
.numberOfCallbacks = 1,
.intPriority = (~0)
};
/*
* =============================== PIN ===============================
*/
#include <ti/drivers/PIN.h>
#include <ti/drivers/pin/PINCC26XX.h>
const PIN_Config BoardGpioInitTable[] = {
/* Parent Signal: LED0 GPIO Pin, (DIO4) */
Board_PIN0 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MED,
/* Parent Signal: POWER GPIO Pin, (DIO5) */
Board_PIN1 | PIN_INPUT_EN | PIN_NOPULL | PIN_IRQ_DIS,
/* Parent Signal: NSS GPIO Pin, (DIO12) */
Board_PIN2 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MED,
/* Parent Signal: RST GPIO Pin, (DIO15) */
Board_PIN3 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MED,
/* Parent Signal: BUSY GPIO Pin, (DIO17) */
Board_PIN4 | PIN_INPUT_EN | PIN_NOPULL | PIN_IRQ_DIS,
/* Parent Signal: DIO1 GPIO Pin, (DIO18) */
Board_PIN8 | PIN_INPUT_EN | PIN_NOPULL | PIN_IRQ_DIS,
/* Parent Signal: Board_SPI0 SCLK, (DIO11) */
Board_PIN5 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MED,
/* Parent Signal: Board_SPI0 MISO, (DIO1) */
Board_PIN6 | PIN_INPUT_EN | PIN_NOPULL | PIN_IRQ_DIS,
/* Parent Signal: Board_SPI0 MOSI, (DIO0) */
Board_PIN7 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MED,
PIN_TERMINATE
};
const PINCC26XX_HWAttrs PINCC26XX_hwAttrs = {
.intPriority = (~0),
.swiPriority = 0
};
/*
* =============================== Power ===============================
*/
#include <ti/drivers/Power.h>
#include <ti/drivers/power/PowerCC26XX.h>
#include "Board.h"
extern void PowerCC26XX_standbyPolicy(void);
extern bool PowerCC26XX_calibrate(unsigned int);
const PowerCC26XX_Config PowerCC26XX_config = {
.enablePolicy = true,
.policyInitFxn = NULL,
.policyFxn = PowerCC26XX_standbyPolicy,
.calibrateFxn = PowerCC26XX_calibrate,
.vddrRechargeMargin = 0,
.calibrateRCOSC_LF = true,
.calibrateRCOSC_HF = true,
};
/*
* =============================== RF Driver ===============================
*/
#include <ti/drivers/rf/RF.h>
const RFCC26XX_HWAttrsV2 RFCC26XX_hwAttrs = {
.hwiPriority = (~0),
.swiPriority = (uint8_t)0,
.xoscHfAlwaysNeeded = true,
.globalCallback = NULL,
.globalEventMask = 0
};
/*
* =============================== SPI DMA ===============================
*/
#include <ti/drivers/SPI.h>
#include <ti/drivers/spi/SPICC26XXDMA.h>
#define Board_SPICOUNT 1
/*
* ======== spiCC26XXDMAObjects ========
*/
SPICC26XXDMA_Object spiCC26XXDMAObjects[Board_SPICOUNT];
/*
* ======== spiCC26XXDMAHWAttrs ========
*/
const SPICC26XXDMA_HWAttrsV1 spiCC26XXDMAHWAttrs[Board_SPICOUNT] = {
/* Board_SPI0 */
{
.baseAddr = SSI0_BASE,
.intNum = INT_SSI0_COMB,
.intPriority = (~0),
.swiPriority = 0,
.powerMngrId = PowerCC26XX_PERIPH_SSI0,
.defaultTxBufValue = ~0,
.rxChannelBitMask = 1<<UDMA_CHAN_SSI0_RX,
.txChannelBitMask = 1<<UDMA_CHAN_SSI0_TX,
.minDmaTransferSize = 1,
.mosiPin = IOID_0,
.misoPin = IOID_1,
.clkPin = IOID_11,
.csnPin = PIN_UNASSIGNED
},
};
/*
* ======== SPI_config ========
*/
const SPI_Config SPI_config[Board_SPICOUNT] = {
/* Board_SPI0 */
{
.fxnTablePtr = &SPICC26XXDMA_fxnTable,
.object = &spiCC26XXDMAObjects[Board_SPI0],
.hwAttrs = &spiCC26XXDMAHWAttrs[Board_SPI0]
},
};
const uint_least8_t SPI_count = Board_SPICOUNT;
/*
* =============================== TRNG ===============================
*/
#include <ti/drivers/TRNG.h>
#include <ti/drivers/trng/TRNGCC26XX.h>
#define Board_TRNGCOUNT 1
TRNGCC26XX_Object trngCC26XXObjects[Board_TRNGCOUNT];
/*
* ======== trngCC26XXHWAttrs ========
*/
static const TRNGCC26XX_HWAttrs trngCC26XXHWAttrs[Board_TRNGCOUNT] = {
{
.intPriority = (~0),
.swiPriority = 0,
.samplesPerCycle = 240000
},
};
const TRNG_Config TRNG_config[Board_TRNGCOUNT] = {
{ /* Board_TRNG0 */
.object = &trngCC26XXObjects[Board_TRNG0],
.hwAttrs = &trngCC26XXHWAttrs[Board_TRNG0]
},
};
const uint_least8_t TRNG_count = Board_TRNGCOUNT;
#include <ti/drivers/Board.h>
/*
* ======== Board_initHook ========
* Perform any board-specific initialization needed at startup. This
* function is declared weak to allow applications to override it if needed.
*/
#if defined(__IAR_SYSTEMS_ICC__)
__weak void Board_initHook(void)
#elif defined(__GNUC__) && !defined(__ti__)
void __attribute__((weak)) Board_initHook(void)
#else
#pragma WEAK (Board_initHook)
void Board_initHook(void)
#endif
{
}
/*
* ======== Board_init ========
* Perform any initialization needed before using any board APIs
*/
void Board_init(void)
{
/* ==== /ti/drivers/Power initialization ==== */
Power_init();
/* ==== /ti/drivers/PIN initialization ==== */
if (PIN_init(BoardGpioInitTable) != PIN_SUCCESS) {
/* Error with PIN_init */
while (1);
}
Board_initHook();
}
3.add code to Board.h
4.Compiled with the following error:
undefined first referenced
symbol in file
--------- ----------------
CryptoCC26XX_config C:/ti/simplelink_cc2640r2_sdk_5_30_00_03/source/ti/drivers/lib/drivers_cc26x0r2.aem3<CryptoCC26XX.oem3>
TRNGCC26XX_config <whole-program>
error #10234-D: unresolved symbols remain
error #10010: errors encountered during linking; "simple_peripheral_cc2640r2lp_app.out" not built
I don't know how to deal with these errors and I would be very grateful if I could get your reply.
0363.simple_peripheral_cc2640r2lp_app.zip
Regards,
Tdy