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.
您需要创建UART对应的Hwi task。以下请参考:
Hwi_create(9, UART_hwiIntFxn, &hwiParams, &eb);
详细代码,可下载TI RTOS MCU SDK,参考其中的UART ECHO示例代码。
用配置文件也是可以的,但不知您用的XDC是哪个版本,你这个没有设置中断优先级的选项。
我用的XDC 3.23.2.47是可以设置优先级的。并且中断优先级参数只能用0x20,0x40,0x80等值来进行设置。
MCU SDK下载地址:http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/tirtos/index.html
谢谢!
sysbios里面使用中断,打开全局中断的时候,程序运行后就一直进入死循环:IntDefaultHandler里的while(1)循环,请教改怎么设置cfg文件或是更改代码,使得系统硬件中断可以正常使用
Can't find a source file at "/tmp/TI_MKLIBl3yPak/SRC/exit.c"
Locate the file or edit the source lookup path to include its location.
工程请见附件
dubug的时候出现这个,也找不到源程序,请问这个怎么解决?
另外任务设置如下,但是进入不了接受中断:
/*
* UartTask
*/
Void UartTask(UArg a0, UArg a1)
{
#if 1
/* Enable Receive UART and its interrupt. */
// Out_T_RW = 0;
GPIOPinWrite(GPIO_PORTB_BASE, GPIO_PIN_2,0);//T_RW = 0,Receive Enable;
UARTIntRegister(UART1_BASE, uart1Isr);
UARTIntClear(UART1_BASE, (UART_INT_TX | UART_INT_TX | UART_INT_RT));
UARTIntDisable(UART1_BASE, (UART_INT_TX | UART_INT_RT));
UARTIntEnable(UART1_BASE, UART_INT_RX);
UARTEnable(UART1_BASE);
/* Set the FIFO level to 7/8 empty and 7/8 full. */
UARTFIFOLevelSet(UART1_BASE, UART_FIFO_TX1_8, UART_FIFO_RX7_8);
UARTFIFOEnable(UART1_BASE);
pt=0;
n=0;
while(1)
{
while(1)
{
SEM_pend(Sem, 50);//等待接收结束的信号量
if(pt==0)continue;//尚未接收到数据继续等待
if(n==pt)break;//接收大数据且稳定不变,则结束等待
n=pt;//记忆当前接收到的字节数目,继续等待。
}
n=pt;
pt=0;
/* Set the FIFO level to 7/8 empty and 7/8 full. */
UARTFIFOLevelSet(UART1_BASE, UART_FIFO_TX1_8, UART_FIFO_RX7_8);
UARTFIFOEnable(UART1_BASE);
UARTIntClear(UART1_BASE, (UART_INT_TX | UART_INT_RT));
UARTIntEnable(UART1_BASE, (UART_INT_TX | UART_INT_RT));
UARTEnable(UART1_BASE);
if(n>=14)//帧长度达到14字节以上
{
for(i=0;i<14;i++) //先发送14字节
{
mb_tx_data = a[pt++];
UARTCharPutNonBlocking(UART1_BASE,mb_tx_data);
}
/* Enable Send UART and its interrupt. */
// Out_T_RW = 1;
GPIOPinWrite(GPIO_PORTB_BASE, GPIO_PIN_2,~0);//T_RW = 1,Transmit Enable;
SEM_pend(Sem, 0);//等待发送结束的信号量
}
else for(i=0;i<n;i++)
mb_tx_data = a[pt++];//帧长度不到14一次发完,不需要中断和信号量
}
#endif
}