I am working with the TMS320F28335's SCI-B serial communication.
I do not know if when initialize SCIB I have errors or I need something to enable. I read the examples and some documents using the interruption To receive. but even I can not find the solution to work this interruption.
this is my code:
#include "DSP28x_Project.h" // Device Headerfile and Examples Include File
// Prototype statements for functions found within this file.
void scib_init(void);
void scib_xmit(void);
__interrupt void rxbint_isr(void);
// Global counts used in this example
Uint16 LoopCount=0;
Uint16 ErrorCount;
Uint16 ReceivedChar=0;
void main(void)
{
// Step 1. Initialize System Control:
// PLL, WatchDog, enable Peripheral Clocks
// This example function is found in the DSP2833x_SysCtrl.c file.
InitSysCtrl();
// Step 2. Initialize GPIO:
// This example function is found in the DSP2833x_Gpio.c file and
// illustrates how to set the GPIO to it's default state.
//InitGpio(); Skipped for this example
// For this example, only init the pins for the SCI-A port.
// This function is found in the DSP2833x_Sci.c file.
InitScibGpio();
// Step 3. Clear all interrupts and initialize PIE vector table:
// Disable CPU interrupts
DINT;
// Initialize PIE control registers to their default state.
// The default state is all PIE interrupts disabled and flags
// are cleared.
// This function is found in the DSP2833x_PieCtrl.c file.
InitPieCtrl();
// Disable CPU interrupts and clear all CPU interrupt flags:
IER = 0x0000;
IFR = 0x0000;
// Initialize the PIE vector table with pointers to the shell Interrupt
// Service Routines (ISR).
// This will populate the entire table, even if the interrupt
// is not used in this example. This is useful for debug purposes.
// The shell ISR routines are found in DSP2833x_DefaultIsr.c.
// This function is found in DSP2833x_PieVect.c.
InitPieVectTable();
EALLOW;
PieVectTable.SCIRXINTB=&rxbint_isr;
EDIS;
scib_init();
PieCtrlRegs.PIEIER9.bit.INTx3=1;
IER |=0x0100;
EINT;
for(;;);
}
// Test 1,SCIA DLB, 8-bit word, baud rate 0x000F, default, 1 STOP bit, no parity
void scib_init()
{
ScibRegs.SCIHBAUD =0x0001; // 9600 baud @LSPCLK = 37.5MHz.
ScibRegs.SCILBAUD =0x00E7;
ScibRegs.SCICCR.all =0x0007; // 1 stop bit, No loopback
// No parity,8 char bits,
// async mode, idle-line protocol
ScibRegs.SCICTL1.all =0x0001; // RX, internal SCICLK,
// Disable RX ERR, SLEEP, TXWAKE
ScibRegs.SCICTL2.all =0x0002;
ScibRegs.SCICTL2.bit.RXBKINTENA =1;
ScibRegs.SCICTL1.all =0x0021; // Relinquish SCI from Reset
ScibRegs.SCIFFTX.all=0xE040;
ScibRegs.SCIFFRX.all=0x204f;
ScibRegs.SCIFFCT.all=0x0;
}
// Transmit a character from the SCI
// Initialize the SCI FIFO
__interrupt void rxbint_isr(void)
{
LoopCount++;
// Get character
ReceivedChar = ScibRegs.SCIRXBUF.all;
PieCtrlRegs.PIEACK.all=0x0100;
}