TI中文支持网
TI专业的中文技术问题搜集分享网站

LAUNCHXL-CC1310: 从7X7封装移植到4X4封装,在spi_transfer会跑飞。

Part Number:LAUNCHXL-CC1310Other Parts Discussed in Thread:CC1310

 首先参考这篇文章SimpleLink MCU代码移植指南:CC1310从VQFN48(7×7)到VQFN32(5×5)代码移植流程参考 – 嵌入式处理 – 技术文章 – E2ETm 设计支持 (ti.com),将CC1310_LAUNCHXL.h中除了SPI0的IO都赋值PIN_UNASSIGNED。

CC1310_LAUNCHXL.H:

#define CC1310_LAUNCHXL_DIO23_ANALOGPIN_UNASSIGNED
#define CC1310_LAUNCHXL_DIO24_ANALOGPIN_UNASSIGNED
#define CC1310_LAUNCHXL_DIO25_ANALOGPIN_UNASSIGNED
#define CC1310_LAUNCHXL_DIO26_ANALOGPIN_UNASSIGNED
#define CC1310_LAUNCHXL_DIO27_ANALOGPIN_UNASSIGNED
#define CC1310_LAUNCHXL_DIO28_ANALOGPIN_UNASSIGNED
#define CC1310_LAUNCHXL_DIO29_ANALOGPIN_UNASSIGNED
#define CC1310_LAUNCHXL_DIO30_ANALOGPIN_UNASSIGNED

/* Digital IOs */
#define CC1310_LAUNCHXL_DIO0IOID_0
#define CC1310_LAUNCHXL_DIO1IOID_1
#define CC1310_LAUNCHXL_DIO12PIN_UNASSIGNED
#define CC1310_LAUNCHXL_DIO15PIN_UNASSIGNED
#define CC1310_LAUNCHXL_DIO16_TDOPIN_UNASSIGNED
#define CC1310_LAUNCHXL_DIO17_TDIPIN_UNASSIGNED
#define CC1310_LAUNCHXL_DIO21PIN_UNASSIGNED
#define CC1310_LAUNCHXL_DIO22PIN_UNASSIGNED

/* Discrete Inputs */
#define CC1310_LAUNCHXL_PIN_BTN1PIN_UNASSIGNED
#define CC1310_LAUNCHXL_PIN_BTN2PIN_UNASSIGNED

/* GPIO */
#define CC1310_LAUNCHXL_GPIO_LED_ON1
#define CC1310_LAUNCHXL_GPIO_LED_OFF0

/* I2C */
#define CC1310_LAUNCHXL_I2C0_SCL0PIN_UNASSIGNED
#define CC1310_LAUNCHXL_I2C0_SDA0PIN_UNASSIGNED

/* I2S */
#define CC1310_LAUNCHXL_I2S_ADOPIN_UNASSIGNED
#define CC1310_LAUNCHXL_I2S_ADIPIN_UNASSIGNED
#define CC1310_LAUNCHXL_I2S_BCLKPIN_UNASSIGNED
#define CC1310_LAUNCHXL_I2S_MCLKPIN_UNASSIGNED
#define CC1310_LAUNCHXL_I2S_WCLKPIN_UNASSIGNED

/* LEDs */
#define CC1310_LAUNCHXL_PIN_LED_ON1
#define CC1310_LAUNCHXL_PIN_LED_OFF0
#define CC1310_LAUNCHXL_PIN_RLEDPIN_UNASSIGNED
#define CC1310_LAUNCHXL_PIN_GLEDPIN_UNASSIGNED

/* PWM Outputs */
#define CC1310_LAUNCHXL_PWMPIN0PIN_UNASSIGNED
#define CC1310_LAUNCHXL_PWMPIN1PIN_UNASSIGNED
#define CC1310_LAUNCHXL_PWMPIN2PIN_UNASSIGNED
#define CC1310_LAUNCHXL_PWMPIN3PIN_UNASSIGNED
#define CC1310_LAUNCHXL_PWMPIN4PIN_UNASSIGNED
#define CC1310_LAUNCHXL_PWMPIN5PIN_UNASSIGNED
#define CC1310_LAUNCHXL_PWMPIN6PIN_UNASSIGNED
#define CC1310_LAUNCHXL_PWMPIN7PIN_UNASSIGNED

/* SPI */
#define CC1310_LAUNCHXL_SPI_FLASH_CSPIN_UNASSIGNED
#define CC1310_LAUNCHXL_FLASH_CS_ON0
#define CC1310_LAUNCHXL_FLASH_CS_OFF1

/* SPI Board */
#define CC1310_LAUNCHXL_SPI0_MISOIOID_4/* RF1.20 */
#define CC1310_LAUNCHXL_SPI0_MOSIIOID_5/* RF1.18 */
#define CC1310_LAUNCHXL_SPI0_CLKIOID_7/* RF1.16 */
#define CC1310_LAUNCHXL_SPI0_CSNIOID_6
#define CC1310_LAUNCHXL_SPI0_IRQIOID_8
#define CC1310_LAUNCHXL_SPI0_CEIOID_9

#define CC1310_LAUNCHXL_SPI1_MISOPIN_UNASSIGNED
#define CC1310_LAUNCHXL_SPI1_MOSIPIN_UNASSIGNED
#define CC1310_LAUNCHXL_SPI1_CLKPIN_UNASSIGNED
#define CC1310_LAUNCHXL_SPI1_CSNPIN_UNASSIGNED

/* UART Board */
#define CC1310_LAUNCHXL_UART_RXPIN_UNASSIGNED/* RXD */
#define CC1310_LAUNCHXL_UART_TXPIN_UNASSIGNED/* TXD */
#define CC1310_LAUNCHXL_UART_CTSPIN_UNASSIGNED/* CTS */
#define CC1310_LAUNCHXL_UART_RTSPIN_UNASSIGNED/* RTS */

主函数如下:

void *mainThread(void *arg0)
{uint16_tbuf_num;for(buf_num = 0 ; buf_num < MASSAGE ; buf_num ++){transmitBuffer[buf_num] = buf_num;}SPI_init();SPI_Params_init(&spiParams);  // Initialize SPI parametersspiParams.transferMode = SPI_MODE_BLOCKING;  //spiParams.dataSize = 8;// 8-bit data sizespiParams.mode = SPI_MASTER;  //SPI MASTERspiParams.frameFormat = SPI_POL0_PHA1;  //SPI POL0 PHA0spiParams.bitRate = 4000000;  //4MHZspiTransaction.count = MASSAGE;spiTransaction.txBuf = (void *)transmitBuffer;spiTransaction.rxBuf = (void *)receiveBuffer;spi = SPI_open(Board_SPI0, &spiParams);if (spi == NULL) {while (1);  // SPI_open() failed}SPI_transfer(spi,&spiTransaction);usleep(100);return (NULL);
}

代码会在跑完SPI_transfer之后跑飞。代码在7X7封装上依然可以运行,但是在4X4上会跑飞。请问还有哪些地方需要修改,才可以正常工作?

Kevin Qiu1:

下面是以前4*4的配置文件,与新的SDK相比有了一些小变化,你可以参考它修改现在的SDK文件

CC1310DK_4XD.zip

除了.c和.h文件外,ccfg和cmd文件也要保持一致

,

yuan jiadong:

你好,1、现在将spiCC26XXDMAHWAttrs.minDmaTransferSize改为比较大的值,也就是不使用SPIDMA,可以跑过,也有波形输出。但是我本意是想用SPIDMA的,不知道什么原因会导致无法使用。2、还有就是发现使用sleep函数的时候也会跑飞,不是很明白。

,

Kevin Qiu1:

如果在必须在 7*7的板子上可以正常运行,那么正确移植后也应在4*4的板子上正常执行

yuan jiadong 说:现在将spiCC26XXDMAHWAttrs.minDmaTransferSize改为比较大的值,也就是不使用SPIDMA,可以跑过,也有波形输出。但是我本意是想用SPIDMA的,不知道什么原因会导致无法使用。2、还有就是发现使用sleep函数的时候也会跑飞,不是很明白。

RX FIFO 变满之前再次调用SPI_transfer()以避免溢出

对照这里的说明在检查下SPI的使用:https://dev.ti.com/tirex/content/simplelink_cc13x0_sdk_4_20_01_03/docs/tidrivers/doxygen/html/_s_p_i_c_c26_x_x_d_m_a_8h.html

,

yuan jiadong:

你好,谢谢你的回复。现在我对着配置文件来来回回试了很多次还是不行,然后我单步调试一直跟到后面,发现是在SPI_TRAN之后卡在了SemaphoreP_pend函数中,一直等不到SemaphoreP_post函数释放线程。在SemaphoreP_pend函数中死循环了。但是在7X7中还是可以运行。所以是有什么配置文件会影响到这里吗?

,

Kevin Qiu1:

你的4*4的内存是否核原来7*7的一致?如果可能不一致则可能是内存不够用了

参考下面的任务2使用ROV看下任务运行核内存使用情况:https://dev.ti.com/tirex/content/simplelink_academy_cc13x0sdk_4_20_00_00/modules/rtos/tirtos_basics/tirtos_basics.html

赞(0)
未经允许不得转载:TI中文支持网 » LAUNCHXL-CC1310: 从7X7封装移植到4X4封装,在spi_transfer会跑飞。
分享到: 更多 (0)

© 2024 TI中文支持网   网站地图 鲁ICP备2022002796号-1