This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
I wanted to transmit data using SCI with interrupt.
What I currently have for the SCI initialization is:
SciaRegs.SCICCR.all = 0x0007; // 1 stop bit, no parity, 8 char bits
SciaRegs.SCICTL1.all = 0x0002; // Initialize SCI, enable TX
SciaRegs.SCICTL2.bit.TXINTENA = 1; // Enable TX interrupt
SciaRegs.SCIHBAUD = 0;
SciaRegs.SCILBAUD = 780; // 9603 baud rate
SciaRegs.SCIFFTX.all = 0xE022; // Interrupt generated when FIFO level is below 2
SciaRegs.SCIFFCT.all = 0x00;
SciaRegs.SCICTL1.all = 0x0022; // Bring SCI out of reset
SciaRegs.SCIFFTX.bit.TXFIFOXRESET = 1;
And the interrupt routine is as follows. SCIChars is the variable where I hold the data I want to transmit, and is declared globally.
interrupt void sciaTxFifoIsr(void) {
int i = 0;
int messageLength = strlen(SCIChars);
char tdx;
while (SciaRegs.SCIFFTX.bit.TXFFST != 0) {}
for (i = 0; i < 2 && SCICounter < messageLength; i++) {
tdx = SCIChars[SCICounter++];
SciaRegs.SCITXBUF = tdx;
}
SciaRegs.SCIFFTX.bit.TXFFINTCLR = 1; // clear interrupt flag
PieCtrlRegs.PIEACK.all |= 0x100; // Issue PIE ACK
}
The interrupt triggers correctly, but I cannot see data coming out from the line. Is there something that I miss? I've set up the TMS320F28035's GPIO 29 as follows:
GpioCtrlRegs.GPAMUX2.bit.GPIO29 = 1; // 0=GPIO, 1=SCITXD-A, 2=I2CSCL-A, 3=TZ3
GpioCtrlRegs.GPADIR.bit.GPIO29 = 1; // 1=OUTput, 0=INput
GpioCtrlRegs.GPAPUD.bit.GPIO29 = 0;
Thanks
Actually, never mind. The problem lies here:
SciaRegs.SCIHBAUD = 0;
SciaRegs.SCILBAUD = 780; // 9603 baud rate
780 is 0x030C, I didn't realize HBAUD and LBAUD are 8 bits each. So I simply need to split 0x03 to HBAUD and 0x0C to LBAUD to make things work.