This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320F280049C: SCI持续发送时导致程序跑死

Part Number: TMS320F280049C

串口调试时,我利用串口助手自动发送获得响应

但随时间运行一段时间后我发现程序不再响应了,我的主程序的运行灯也不再工作,但用示波器测得硬件PWM是正常输出的

我的串口初始化函数为:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
void HAL_setupSCI(void)
{
//
// GPIO28 is the SCI Rx pin.
//
GPIO_setPinConfig(DEVICE_GPIO_CFG_SCIRXDA);
GPIO_setDirectionMode(DEVICE_GPIO_PIN_SCIRXDA, GPIO_DIR_MODE_IN);
GPIO_setPadConfig(DEVICE_GPIO_PIN_SCIRXDA, GPIO_PIN_TYPE_STD);
GPIO_setQualificationMode(DEVICE_GPIO_PIN_SCIRXDA, GPIO_QUAL_ASYNC);
//
// GPIO29 is the SCI Tx pin.
//
GPIO_setPinConfig(DEVICE_GPIO_CFG_SCITXDA);
GPIO_setDirectionMode(DEVICE_GPIO_PIN_SCITXDA, GPIO_DIR_MODE_OUT);
GPIO_setPadConfig(DEVICE_GPIO_PIN_SCITXDA, GPIO_PIN_TYPE_STD);
GPIO_setQualificationMode(DEVICE_GPIO_PIN_SCITXDA, GPIO_QUAL_ASYNC);
//
//
//
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

接收中断函数为:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
interrupt void sciaRxISR(void)
{
//
// Read characters from the FIFO.
//
// SciRxBuf[SciRxPointHead] = SCI_readCharBlockingFIFO(SCIA_BASE);
SciRxBuf[SciRxPointHead] = SCI_readCharNonBlocking(SCIA_BASE);
SciRxPointHead ++;
if (SciRxPointHead == RxLen)
SciRxPointHead = 0;
GPIO_togglePin(TTPLPFC_GPIO_LED1);
//
// Clear the SCI RXFF interrupt and acknowledge the PIE interrupt.
//
SCI_clearInterruptStatus(SCIA_BASE, SCI_INT_RXFF);
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP9);
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

发送函数为:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
void SendMessageToSCI(uint32_t base, unsigned char *msg)
{
uint16_t msg_len = 0;
while (msg[msg_len] != 0) {
SciTxBuf[SciTxPointHead] = msg[msg_len];
SciTxPointHead ++;
if (SciTxPointHead == TxLen)
SciTxPointHead = 0;
msg_len ++;
}
SCI_writeCharArray(base,(const uint16_t *)SciTxBuf,SciTxPointHead);
SciTxPointEnd = SciTxPointHead = 0;
memset(SciTxBuf,0,TxLen);
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

不使用自动发送,缓慢调试时不会出问题,但是换成自动发送程序就会出错,请问是什么原因?