Part Number: LAUNCHXL-F28379D
Other Parts Discussed in Thread: C2000WARE
Hello,
I'm trying to use the SCI protocol on my LAUNCHXL-F28379D. As usual, I readed the documentation and tried the examples, but they didn't work. I switch from the SCIA to SCIB (because the LAUNCHXL doesn't have PINs on SCIA) and it still doesn't work. I simplified the code, keeping the essential, so this is my code :
#include "F28x_Project.h"
#define TX 18
void scib_echoback_init(void);
void scib_fifo_init(void);
void scib_xmit(int a);
void scib_msg(char *msg);
void main(void)
{
char *msg;
InitSysCtrl();
// GPIO
InitGpio();
GPIO_SetupPinMux(TX, GPIO_MUX_CPU1, 1);
GPIO_SetupPinOptions(TX, GPIO_OUTPUT, GPIO_ASYNC);
// Interrupts
DINT;
InitPieCtrl();
IER = 0x0000;
IFR = 0x0000;
InitPieVectTable();
EINT;
// SCI
scib_fifo_init();
scib_echoback_init();
for (;;) {
msg = "a\0";
scib_msg(msg);
}
}
void scib_echoback_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;
//
// SCIB at 9600 baud
// @LSPCLK = 50 MHz (200 MHz SYSCLK) HBAUD = 0x02 and LBAUD = 0x8B.
// @LSPCLK = 30 MHz (120 MHz SYSCLK) HBAUD = 0x01 and LBAUD = 0x86.
//
ScibRegs.SCIHBAUD.all = 0x0002;
ScibRegs.SCILBAUD.all = 0x008B;
ScibRegs.SCICTL1.all = 0x0023; // Relinquish SCI from Reset
}
void scib_xmit(int a)
{
while (ScibRegs.SCIFFTX.bit.TXFFST != 0) {}
ScibRegs.SCITXBUF.all =a;
}
void scib_msg(char * msg)
{
int i;
i = 0;
while(msg[i] != '\0')
{
scib_xmit(msg[i]);
i++;
}
}
void scib_fifo_init()
{
ScibRegs.SCIFFTX.all = 0xE040;
ScibRegs.SCIFFRX.all = 0x2044;
ScibRegs.SCIFFCT.all = 0x0;
}
As you can see, I'm just sending over and over the 'a' character. In debug mode, I checked SCITXBUF from the ScibRegs and it is filled correctly (0x0061). So I think the configuration of the SCI is right. For reading, I'm using an Arduino UNO with the following code :
void setup() {
Serial.begin(9600);
}
void loop() {
if (Serial.available() > 0) {
int msg = Serial.read();
Serial.println(msg);
}
}
Both cards are connected to my computer via USB. I connected the PIN 4 (GPIO18) of the TI card to the PIN 0 (RX) of the Arduino. But the arduino RX led doesn't light up and the Serial monitor stay empty.
I absolutly don't know where the problem is. I will be able to check on a scope monday if needed.
Thanks for your help !