请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
器件型号:CC1352P 主题中讨论的其他器件: CC1310
您好!
我正在 尝试在完成数据发送后关闭 UART 端口、以降低功耗、方法是使用以下代码:
static void uartWriteCallback(UART2_Handle _handle, void *_buf, size_t _size, void *_userArg, int_fast16_t _status) { atUartTxSent += _size; if (atUartTxSent < atUartTxLen) { UART2_write(atUartHandle, (const void*)&(atUartTxBuff[atUartTxSent]), atUartTxLen - atUartTxSent, NULL); } else { SemaphoreP_post(atUartTxSem); // The following line of code sends system into perpetual reboot //atUartClose(); } } static void atUartClose() { if(atUartHandle) { UART2_readCancel(atUartHandle); // TODO: check if the equivalent of the following line is still needed //UART2_control(atUartHandle, UART_CMD_RXDISABLE, 0); UART2_writeCancel(atUartHandle); UART2_close(atUartHandle); atUartHandle = NULL; } }
不涉及信号量的类似代码在具有 UART 驱动器的 CC1310/SDK4.2中效果很好。 但在 CC1352P/SDK v7.1中以某种方式调用该函数来关闭 UART 端口会使系统永久重新启动、并且在 CCS 控制台中会出现如下的 NONSTOP 错误消息:
Cortex_M4_0: Error: (Error -1170 @ 0x0) Unable to access the DAP. Reset the device, and retry the operation. If error persists, confirm configuration, power-cycle the board, and/or try more reliable JTAG settings (e.g. lower TCLK). (Emulation package 9.12.0.00150) Cortex_M4_0: Trouble Halting Target CPU: (Error -2062 @ 0x0) Unable to halt device. Reset the device, and retry the operation. If error persists, confirm configuration, power-cycle the board, and/or try more reliable JTAG settings (e.g. lower TCLK). (Emulation package 9.12.0.00150) Cortex_M4_0: Error: (Error -1170 @ 0x0) Unable to access the DAP. Reset the device, and retry the operation. If error persists, confirm configuration, power-cycle the board, and/or try more reliable JTAG settings (e.g. lower TCLK). (Emulation package 9.12.0.00150) Cortex_M4_0: Trouble Halting Target CPU: (Error -2064 @ 0x0) Unable to read device status. Reset the device, and retry the operation. If error persists, confirm configuration, power-cycle the board, and/or try more reliable JTAG settings (e.g. lower TCLK). (Emulation package 9.12.0.00150) Cortex_M4_0: Error: (Error -1170 @ 0x0) Unable to access the DAP. Reset the device, and retry the operation. If error persists, confirm configuration, power-cycle the board, and/or try more reliable JTAG settings (e.g. lower TCLK). (Emulation package 9.12.0.00150) Cortex_M4_0: Trouble Halting Target CPU: (Error -2062 @ 0x0) Unable to halt device. Reset the device, and retry the operation. If error persists, confirm configuration, power-cycle the board, and/or try more reliable JTAG settings (e.g. lower TCLK). (Emulation package 9.12.0.00150)
我在这里遗漏了什么? 在写回调函数中删除 semaphore_post ()似乎能够避免永久重新启动,但这种方法有其自己的问题,任何超过 FIFO 缓冲区的数据都不能可靠地发送出去。
建议、谢谢、
ZL