一、硬件连接
修改引脚配置: 例如 SDK2.4 multi_role工程 Startup目录下 board.c 跳转到 cc2640r2em_board.c
#if defined(CC2640R2DK_CXS) || defined (CC2640R2DK_4XS) \
|| defined (CC2640R2DK_5XD) || defined (CC2640R2DK_7ID)
#include "./cc2640r2em/cc2640r2em_board.c"
芯片为5x5时,跳转 CC2640R2DK_5XD.c
芯片为7x7时,跳转 CC2640R2DK_7ID.c
#elif defined(CC2640R2DK_5XD)
#include "../../boards/CC2640R2DK_5XD/Board.h"
#include "../../boards/CC2640R2DK_5XD/CC2640R2DK_5XD.c"
#elif defined(CC2640R2DK_7ID)
#include "../../boards/CC2640R2DK_7ID/Board.h"
#include "../../boards/CC2640R2DK_7ID/CC2640R2DK_7ID.c"
找到 SPI 结构体
/*
* =============================== SPI DMA ===============================
*/
#include <ti/drivers/SPI.h>
#include <ti/drivers/spi/SPICC26XXDMA.h>
SPICC26XXDMA_Object spiCC26XXDMAObjects[CC2640R2DK_5XD_SPICOUNT];
const SPICC26XXDMA_HWAttrsV1 spiCC26XXDMAHWAttrs[CC2640R2DK_5XD_SPICOUNT] = {
{
.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,
.mosiPin = CC2640R2DK_5XD_SPI0_MOSI,
.misoPin = CC2640R2DK_5XD_SPI0_MISO,
.clkPin = CC2640R2DK_5XD_SPI0_CLK,
.csnPin = CC2640R2DK_5XD_SPI0_CSN
}
};
跳转修改宏 CC2640R2DK_5XD_SPI0_MOSI、CC2640R2DK_5XD_SPI0_MISO、CC2640R2DK_5XD_SPI0_CLK
/* SPI Board */
#define CC2640R2DK_5XD_SPI0_MISO IOID_8//IOID_12 /* P1.20 */
#define CC2640R2DK_5XD_SPI0_MOSI IOID_9//IOID_11 /* P1.18 */
#define CC2640R2DK_5XD_SPI0_CLK IOID_10 /* P1.16 */
#define CC2640R2DK_5XD_SPI0_CSN PIN_UNASSIGNED
|