Tool/software: TI C/C++ Compiler
hello everyone
The SCIC peripheral is used for receiving GPS information in my gps/ins intergrated navigation system, the T0, T1,T2 are enabled and the SCIC Rx interrupt is enabled, but the scic Rx interrupt some times occurs and some times doesn't , so the GPS information is received abnormally. I can't find the reason. The initialize function , interrupt function and part of the main function are as follows.The amount of calculation of the main function is big.The appendix is the whole program code.
baudrate=9600;
void scic_init(Uint32 baudrate)
{
// Note: Clocks were turned on to the SCIC peripheral
// in the InitSysCtrl() function
// init GPIOs for SCI-C
EALLOW;
GpioCtrlRegs.GPBPUD.bit.GPIO63 = 0; // Enable pull-up for GPIO63 (SCITXDC)
GpioCtrlRegs.GPBPUD.bit.GPIO62 = 0; // Enable pull-up for GPIO62 (SCIRXDC)
GpioCtrlRegs.GPBQSEL2.bit.GPIO62 = 3; // Asynch input GPIO62 (SCIRXDC)
GpioCtrlRegs.GPBMUX2.bit.GPIO63 = 1; // Configure GPIO63 for SCITXDC operation
GpioCtrlRegs.GPBMUX2.bit.GPIO62 = 1; // Configure GPIO62 for SCIRXDC operation
EDIS;
scic_fifo_init();
// Buad Rate BBR = LSPCLK(37.5MHz)/(BuadRate*8) - 1
baudrate = 37500000/(baudrate*8) - 1;
// 1 stop bit, No loopback
// No parity,8 char bits,
ScicRegs.SCICCR.all =0x0007;
// async mode, idle-line protocol
// enable TX, RX, internal SCICLK,
ScicRegs.SCICTL1.all =0x0003;
// Disable RX ERR, SLEEP, TXWAKE
ScicRegs.SCICTL2.all =0x0003;
ScicRegs.SCILBAUD = baudrate & 0xff;
ScicRegs.SCIHBAUD = (baudrate>>8) & 0xff;
ScicRegs.SCICCR.bit.LOOPBKENA =0; // Disable loop back
// enable receive interrupt
ScicRegs.SCICTL2.bit.RXBKINTENA =1;
// enable transmit interrupt
ScicRegs.SCICTL2.bit.TXINTENA = 1;
// Relinquish SCI from Reset
ScicRegs.SCICTL1.bit.SWRESET = 1;
}
interrupt void scic_rx_isr(void)
{
unsigned char t;
while (ScicRegs.SCIRXST.bit.RXRDY)
{
t = ScicRegs.SCIRXBUF.bit.RXDT;
if (IsDirectGPS)
{
scia_xmit_ex(t);
}
else
{
if (SCIC_RX_COUNT < SCI_RX_BUF_MAX)
{
SCIC_RX_BUF[SCIC_RX_COUNT++] = t;
SCIC_RX_NEW = TRUE;
}
}
}
// Acknowledge this interrupt to receive more interrupts from group 8
PieCtrlRegs.PIEACK.bit.ACK8 = 1;
}
main()
{
...
while(!(INS_Para.IsNoGPS))
{
if (SCIC_RX_NEW)
{
// if some new GPS data
CLOSE_SCIC_RX;
r = UBX_Addbytes(SCIC_RX_BUF, SCIC_RX_COUNT);
SCIC_RX_COUNT = 0;
SCIC_RX_NEW = FALSE;
OPEN_SCIC_RX;
...
}
...
}
...
}