用1310做一个项目:把串口接收到的配置数据,写入到NVS中,如果不是配置文件,则直接通过RF发射出去。
现在的问题是:串口收到数据写NVS,复位后代码卡死在easylink初始化位置。
不写NVS则串口收发,RF收发都没问题。
NVS配置 :
char myCopyBlock[4096];
const NVSCC26XX_HWAttrs nvsCC26xxHWAttrs[CC1310DK_7XD_NVSCOUNT] = {
{
.block = (void *)(0x1d000 – 4096), // Flash sector to use is 4096 of flash on a 128K part
.blockSize = 4096,
.copyBlock = myCopyBlock,
.isRam = true
}
};
NVS_init();
nvsHandle = NVS_open(CC1310DK_7XD_NVS1F000, NULL);
/* + 1 to make sure to write the '\0' character */
strSize = strlen(custom_falsh_write_buffer) + 1;
/* make sure the buffer size is a multiple of 4 */
strSize = (strSize + 4) & 0xFFFFFFFFC;
status = NVS_write(nvsHandle, 0, custom_falsh_write_buffer, strSize, NVS_WRITE_ERASE | NVS_WRITE_VALIDATE);
if (status != NVS_SOK) {
System_abort("NVS_write failed");
}
status = NVS_read(nvsHandle, 0, custom_falsh_read_buffer, MYBUFFERSIZE);
if (status != NVS_SOK) {
System_abort("NVS_read failed");
}
这个段代码放在main函数中,读写没问题。
串口的配置:
uartParams.readMode = UART_MODE_CALLBACK;
uartParams.readCallback = Uart_ReadCallback;
uartParams.writeCallback = Uart_WriteCallback;
uartParams.writeMode = UART_MODE_CALLBACK;
uartParams.writeDataMode = UART_DATA_BINARY;
uartParams.readDataMode = UART_DATA_BINARY;
uartParams.readReturnMode = UART_RETURN_FULL;
uartParams.readEcho = UART_ECHO_OFF;
switch(rate)
{
case 1:
uartParams.baudRate = 9600;
这是一个task。
麻烦帮我解答下,万分感激。
Viki Shi:
NVS跟串口是可以同时工作的,你能追踪到具体卡死在哪句代码吗?
Felix ZF:
应该是复位不完全,如果是在IDE里在线调试,选择board reset,如果是离线运行,使用reset按键或是断电后再重新上电。