Other Parts Discussed in Thread: TMS320F28035
I'm working on Tms320f28035. I want to enable interrupts for the Scia tx and rx. This is the configuration that I'm using to set Rx and Tx. The Rx interrupt is working fine, but the tx interrupt is not working.
#include "DSP28x_Project.h" // Device Headerfile and Examples Include File
// Prototype statements for functions found within this file.
void scia_echoback_init(void);
void scia_fifo_init(void);
void scia_xmit(int a);
void scia_msg(char *msg);
void Transmitdata(void);
void temp_transmit_data(void);
// Global counts used in this example
Uint16 LoopCount;
Uint16 ErrorCount;
char ReceivedLocalBuf[100];
char ReceivedChar;
char SendCharBuf[100];
char temp_send = 2;
void main(void)
{
// Step 1. Initialize System Control:
// PLL, WatchDog, enable Peripheral Clocks
// This example function is found in the DSP2803x_SysCtrl.c file.
InitSysCtrl();
// Step 2. Initalize GPIO:
// This example function is found in the DSP2803x_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 DSP2803x_Sci.c file.
InitSciaGpio();
// 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 DSP2803x_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 DSP2803x_DefaultIsr.c.
// This function is found in DSP2803x_PieVect.c.
InitPieVectTable();
// Step 4. Initialize all the Device Peripherals:
// This function is found in DSP2803x_InitPeripherals.c
// InitPeripherals(); // Not required for this example
// Step 5. User specific code:
EALLOW;
PieVectTable.SCIRXINTA = &SCIRXINTA_ISR; // map the address of the isr to the vector table
PieVectTable.SCITXINTA = &SCITXINTA_ISR; // map the address of the isr to the vector table
PieCtrlRegs.PIEIER9.all = 1; // Set the PIE interrupt enable bit
PieCtrlRegs.PIEIFR9.all = 1; // Set the PIR flag enable bit
IER |= M_INT9;
IFR |= M_INT9;
EINT;
ERTM;
EDIS;
scia_fifo_init(); // Initialize the SCI FIFO
scia_echoback_init(); // Initalize SCI for echoback
SciaRegs.SCITXBUF = 0x61;
while(1)
{
}
}
// Test 1,SCIA DLB, 8-bit word, baud rate 0x000F, default, 1 STOP bit, no parity
void scia_echoback_init()
{
// Note: Clocks were turned on to the SCIA peripheral
// in the InitSysCtrl() function
SciaRegs.SCICCR.all = 0x0007; // 1 stop bit, No loopback
// No parity,8 char bits,
// async mode, idle-line protocol
SciaRegs.SCICTL1.all = 0x0003; // enable TX, RX, internal SCICLK,// tx is enabled only before sending
// Disable RX ERR, SLEEP, TXWAKE
SciaRegs.SCIHBAUD = 0x0000; // 9600 baud @LSPCLK = 15MHz (60 MHz SYSCLK).
SciaRegs.SCILBAUD = 0x00C2;
SciaRegs.SCICTL1.all = 0x0023; // Relinquish SCI from Reset
}
// Initalize the SCI FIFO
void scia_fifo_init() // Ref document for details
{
SciaRegs.SCIFFTX.all = 0xE023;//
SciaRegs.SCIFFRX.all = 0x2021;// 0x2021
SciaRegs.SCIFFCT.all = 0x0000;
SciaRegs.SCIPRI.all = 0x0008; // for debug
}
I'm enabling the TXFIFO interrupt in the Rx ISR. (SciaRegs.SCIFFTX.bit.TXFFIENA = 1;)
Thanks
Seetharaman
