TI中文支持网
TI专业的中文技术问题搜集分享网站

急!!DSP的SCI进不去接收中断

不用FIFO。串口向DSP发送数据时,RXBUF中有数据,但是进不去中断,怎么办?求助各位大神

#include "DSP28x_Project.h"     // Device Headerfile and Examples Include File
void scib_init(void);
void scib_fifo_init(void);
void scib_xmit(int a);
void configGPIO(void);
__interrupt void SCIRXINTb_ISR(void);
__interrupt void cpu_timer0_isr(void);

Uint16 LoopCount=0;
Uint16 ErrorCount;
Uint16 sci_count;
Uint16 ReceiveChar;
Uint16 Char;
unsigned char Navdata[85];

void main(void)
{
 InitSysCtrl();
 configGPIO();
 DINT;
 InitPieCtrl();
 IER = 0x0000;
 IFR = 0x0000;
 InitPieVectTable();
    EALLOW;
    PieVectTable.TINT0 = &cpu_timer0_isr;
    PieVectTable.SCIRXINTB= &SCIRXINTb_ISR;
    EDIS;
    InitScibGpio();
    scib_fifo_init();    // Initialize the SCI FIFO
    scib_init();  // Initalize SCI for digital loop back
    InitCpuTimers();
    ConfigCpuTimer(&CpuTimer0,90,1000000);
    CpuTimer0Regs.TCR.all = 0x4000;
    IER = 0x101;  // Enable CPU INT
    PieCtrlRegs.PIECTRL.bit.ENPIE = 1;
    PieCtrlRegs.PIEIER1.bit.INTx7 = 1;
    PieCtrlRegs.PIEIER9.bit.INTx3 = 1;     // PIE Group 9, INT3   Receive Navigation information
    EINT;   // Enable Global interrupt INTM
    ERTM;   // Enable Global realtime interrupt DBGM
 for(;;)
    {
 
    }
}
void scib_init()
{
  ScibRegs.SCICCR.all =0x0007;   // 1 stop bit,  No loopback
                                   // No parity,8 char bits,
                                   // async mode, idle-line protocol
 ScibRegs.SCICTL1.all =0x0003;  // enable TX, RX, internal SCICLK,
                                   // Disable RX ERR, SLEEP, TXWAKE
 ScibRegs.SCICTL2.all =0x0003;
 ScibRegs.SCICTL2.bit.TXINTENA =1;
 ScibRegs.SCICTL2.bit.RXBKINTENA =1;
    ScibRegs.SCIHBAUD    =64>>8;
    ScibRegs.SCILBAUD    =64 & 0x00FF;//38400波特率
 ScibRegs.SCICCR.bit.LOOPBKENA =0;
 ScibRegs.SCICTL1.all =0x0023;     // Relinquish SCI from Reset
}
void scib_xmit(int a)
{
    ScibRegs.SCITXBUF=a;
}
void scib_fifo_init()
{
    ScibRegs.SCIFFTX.all=0xE040;
    ScibRegs.SCIFFRX.all=0x2044;
    ScibRegs.SCIFFCT.all=0x0;
}
void configGPIO(void)
{
 EALLOW;
 GpioCtrlRegs.GPAMUX2.bit.GPIO20 = 0;    //配置为通用I/O口
 GpioCtrlRegs.GPAMUX2.bit.GPIO21 = 0;
 GpioCtrlRegs.GPADIR.bit.GPIO20 = 1;     //作为输出I/O
 GpioCtrlRegs.GPADIR.bit.GPIO20 = 1;
 GpioDataRegs.GPADAT.bit.GPIO20 = 0;
 GpioDataRegs.GPADAT.bit.GPIO21 = 1;
 EDIS;
}
__interrupt void SCIRXINTb_ISR(void)     // SCI-B-RX  Receive Navigation
{
 int i;
 for (i=0;i<16;i++)
  Navdata[i] = ScibRegs.SCIRXBUF.all;
 PieCtrlRegs.PIEACK.all = PIEACK_GROUP9;
}
interrupt void cpu_timer0_isr(void)
{
 ErrorCount++;
 PieCtrlRegs.PIEACK.all = PIEACK_GROUP1;
}
//===========================================================================
// No more.
//===========================================================================

Mia Zhu:

求助?

不用FIFO。串口向DSP发送数据时,RXBUF中有数据,但是进不去中断,怎么办?求助各位大神

#include "DSP28x_Project.h"     // Device Headerfile and Examples Include File
void scib_init(void);
void scib_fifo_init(void);
void scib_xmit(int a);
void configGPIO(void);
__interrupt void SCIRXINTb_ISR(void);
__interrupt void cpu_timer0_isr(void);

Uint16 LoopCount=0;
Uint16 ErrorCount;
Uint16 sci_count;
Uint16 ReceiveChar;
Uint16 Char;
unsigned char Navdata[85];

void main(void)
{
 InitSysCtrl();
 configGPIO();
 DINT;
 InitPieCtrl();
 IER = 0x0000;
 IFR = 0x0000;
 InitPieVectTable();
    EALLOW;
    PieVectTable.TINT0 = &cpu_timer0_isr;
    PieVectTable.SCIRXINTB= &SCIRXINTb_ISR;
    EDIS;
    InitScibGpio();
    scib_fifo_init();    // Initialize the SCI FIFO
    scib_init();  // Initalize SCI for digital loop back
    InitCpuTimers();
    ConfigCpuTimer(&CpuTimer0,90,1000000);
    CpuTimer0Regs.TCR.all = 0x4000;
    IER = 0x101;  // Enable CPU INT
    PieCtrlRegs.PIECTRL.bit.ENPIE = 1;
    PieCtrlRegs.PIEIER1.bit.INTx7 = 1;
    PieCtrlRegs.PIEIER9.bit.INTx3 = 1;     // PIE Group 9, INT3   Receive Navigation information
    EINT;   // Enable Global interrupt INTM
    ERTM;   // Enable Global realtime interrupt DBGM
 for(;;)
    {
 
    }
}
void scib_init()
{
  ScibRegs.SCICCR.all =0x0007;   // 1 stop bit,  No loopback
                                   // No parity,8 char bits,
                                   // async mode, idle-line protocol
 ScibRegs.SCICTL1.all =0x0003;  // enable TX, RX, internal SCICLK,
                                   // Disable RX ERR, SLEEP, TXWAKE
 ScibRegs.SCICTL2.all =0x0003;
 ScibRegs.SCICTL2.bit.TXINTENA =1;
 ScibRegs.SCICTL2.bit.RXBKINTENA =1;
    ScibRegs.SCIHBAUD    =64>>8;
    ScibRegs.SCILBAUD    =64 & 0x00FF;//38400波特率
 ScibRegs.SCICCR.bit.LOOPBKENA =0;
 ScibRegs.SCICTL1.all =0x0023;     // Relinquish SCI from Reset
}
void scib_xmit(int a)
{
    ScibRegs.SCITXBUF=a;
}
void scib_fifo_init()
{
    ScibRegs.SCIFFTX.all=0xE040;
    ScibRegs.SCIFFRX.all=0x2044;
    ScibRegs.SCIFFCT.all=0x0;
}
void configGPIO(void)
{
 EALLOW;
 GpioCtrlRegs.GPAMUX2.bit.GPIO20 = 0;    //配置为通用I/O口
 GpioCtrlRegs.GPAMUX2.bit.GPIO21 = 0;
 GpioCtrlRegs.GPADIR.bit.GPIO20 = 1;     //作为输出I/O
 GpioCtrlRegs.GPADIR.bit.GPIO20 = 1;
 GpioDataRegs.GPADAT.bit.GPIO20 = 0;
 GpioDataRegs.GPADAT.bit.GPIO21 = 1;
 EDIS;
}
__interrupt void SCIRXINTb_ISR(void)     // SCI-B-RX  Receive Navigation
{
 int i;
 for (i=0;i<16;i++)
  Navdata[i] = ScibRegs.SCIRXBUF.all;
 PieCtrlRegs.PIEACK.all = PIEACK_GROUP9;
}
interrupt void cpu_timer0_isr(void)
{
 ErrorCount++;
 PieCtrlRegs.PIEACK.all = PIEACK_GROUP1;
}
//===========================================================================
// No more.
//===========================================================================

Xupeng(FAA) He:

能提供完整的工程文件嘛,我看你在代码里面初始化了FIFO

赞(0)
未经允许不得转载:TI中文支持网 » 急!!DSP的SCI进不去接收中断
分享到: 更多 (0)