Part Number: LAUNCHXL-F28379D
Hello,
I'm trying to communicate using the SCI protocol using the LAUNCHXL-F28379D. As usual, I have read the TRM and tried the example code. The example code worked perfectly, because it uses SCIA. When I switch to use SCIB or any other one (C or D) it just doesn't work and I can't find why, even with the GPIO Mux correctly set up. This is my code, trying to talk over SCIBTX :
#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();
EALLOW;
// Set the mux to SCITXDB on GPIO 18
GpioCtrlRegs.GPAGMUX2.bit.GPIO18 = 0;
GpioCtrlRegs.GPAMUX2.bit.GPIO18 = 2;
// Select CPU 1
GpioCtrlRegs.GPACSEL3.bit.GPIO18 = 0;
// Set GPIO 18 as output
GpioCtrlRegs.GPADIR.bit.GPIO18 = 1;
// Async mode
GpioCtrlRegs.GPAQSEL2.bit.GPIO18 = 3;
EDIS;
// Interrupts
DINT;
InitPieCtrl();
IER = 0x0000;
IFR = 0x0000;
InitPieVectTable();
EINT;
// SCI
scib_fifo_init();
scib_echoback_init();
for (;;) {
msg = "Salut\n\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; // Enable RXBKINTENA and TXINTENA
//
// 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;
}
I'm using the flag _LAUNCHXL_F28379D for the compiler.
Thanks for your help!