AVR32 uc3b发送空中断不工作

AVR32 uc3b发送空中断不工作,c,interrupt,avr,usart,rs485,C,Interrupt,Avr,Usart,Rs485,我目前正在AT32UCB1258定制板上处理RS485 usart中断,并正在努力处理txempty中断。 基本上,我想在发送5个字节后禁用tx。 我的rx中断(从主板接收命令)和tx就绪中断正确触发,但tx空中断根本不触发。 我正在检查通道状态寄存器,以区分USART2中断处理程序中要触发的中断。 非常感谢您的帮助。提前谢谢 //***********************USART INT HANDLER*************************************** __a

我目前正在AT32UCB1258定制板上处理RS485 usart中断,并正在努力处理txempty中断。 基本上,我想在发送5个字节后禁用tx。 我的rx中断(从主板接收命令)和tx就绪中断正确触发,但tx空中断根本不触发。 我正在检查通道状态寄存器,以区分USART2中断处理程序中要触发的中断。 非常感谢您的帮助。提前谢谢

//***********************USART INT HANDLER***************************************
__attribute__((__interrupt__)) static void rs485Interrupt(void)
{   
     if(AVR32_USART2.CSR.rxrdy)
     {  
         gpio_set_pin_low(AVR32_PIN_PA08);
         AVR32_USART2.IDR.txrdy = 1;
         AVR32_USART2.IDR.txempty = 1;
         rs485RxInterrupt();
     }
     else if(AVR32_USART2.CSR.txrdy)
     {  
         AVR32_USART2.IDR.rxrdy = 1;
         AVR32_USART2.IDR.txempty = 1;
         rs485TxInterrupt();
     }
     else if(AVR32_USART2.CSR.txempty)
     {
         gpio_set_pin_low(AVR32_PIN_PA06);
         rs485TxEmpty();
     }
}
 //**********************************************************************************

 // this function is in main, and calls txrdy interrupt if data is available to send
 static void rs485_write(void)
 {
     gpio_set_pin_high(AVR32_PIN_PA10);
     txBuf[0] = ATEAddress;
     AVR32_USART2.THR.txchr = txBuf[0];
     tx_outctr = 1;
     txLength = 5;
     //txempty_flag = false;

     txBuf[1] = peaks[loop][0];
     txBuf[2] = peaks[loop][1];
     txBuf[3] = peaks[loop][2];
     txBuf[4] = peaks[loop][3];
     AVR32_USART2.IER.txrdy = 1;
 }


 //************************TX INTERRUPT ROUTINE******************************************
 static void rs485TxInterrupt(void)
 {  
     //gpio_set_pin_low(AVR32_PIN_PA06);
     for(tx_outctr=1; tx_outctr<=5; tx_outctr++)
     {
     //AVR32_USART2.THR.txchr = 0x01;
         AVR32_USART2.THR.txchr = txBuf[tx_outctr];
         //usart_write_char(&AVR32_USART2,(int)txBuf[tx_outctr]);
         if (tx_outctr == 5)
         {   
             // if 5btyes are sent, disable tx by causing txempty interrupt
             AVR32_USART2.IDR.txrdy = 1;
             AVR32_USART2.IER.txempty = 1;
             txempty_flag = true;
         }
     }
     //gpio_set_pin_low(AVR32_PIN_PA08);
 }
 //**********************************************************************************
/*******************USART INT处理程序***************************************
__属性(中断)静态无效RS485中断(无效)
{   
if(AVR32_USART2.CSR.rxrdy)
{  
gpio设置引脚低(AVR32引脚PA08);
AVR32_USART2.IDR.txrdy=1;
AVR32_USART2.IDR.txempty=1;
rs485rxinterrup();
}
else if(AVR32_USART2.CSR.txrdy)
{  
AVR32_USART2.IDR.rxrdy=1;
AVR32_USART2.IDR.txempty=1;
rs485txinterrup();
}
else if(AVR32_USART2.CSR.txempty)
{
gpio设置引脚低(AVR32引脚PA06);
rs485TxEmpty();
}
}
//**********************************************************************************
//此函数位于main中,如果有数据可发送,则调用txrdy中断
静态无效rs485_写入(无效)
{
gpio设置引脚高(AVR32引脚PA10);
txBuf[0]=ATE地址;
AVR32_USART2.THR.txchr=txBuf[0];
tx_outctr=1;
txLength=5;
//txempty_标志=false;
txBuf[1]=峰值[loop][0];
txBuf[2]=峰值[loop][1];
txBuf[3]=峰值[loop][2];
txBuf[4]=峰值[loop][3];
AVR32_USART2.IER.txrdy=1;
}
//************************发送中断程序******************************************
静态空隙rs485TxInterrupt(空隙)
{  
//gpio设置引脚低(AVR32引脚PA06);
对于(tx\U outctr=1;tx\U outctr