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.

How to Test SCI

Other Parts Discussed in Thread: TMS320F28035, CONTROLSUITE

Good Day,

I am trying to get the SCI on a TMS320F28035 control card (DRV8301-HC-C2-Kit) to transmit data to an arduino uno to display some information. I am using an FTDI adapter connected to GPIO28 and GPIO29 and the arduino serial window. I am trying to write data from the CCS debug window to the SCITXBUF register to make sure the same data is being sent. I have selected the same baud rate but all I get is a weird looking Z.

See below for the SCI functions.

I suspect it may be the JTAG that is giving the problem but I am not sure.

Any assistance on how to go about testing the SCI and ensuring the data is sent accurately would be appreciated.

Regards,

Christian,

unsigned char SCIDataAvailable()

{
return ((SciaRegs.SCIFFRX.all & 0x1F00)!=0);
}


// ******************************************************
// unsigned char SCIReceiveByte()
//
// This function is used to receive a single byte from
// serial ports receive fifo buffer.
//
// Return values:
// The first (oldest) byte in the fifo buffer
// ******************************************************
unsigned char SCIReceiveByte()
{
return SciaRegs.SCIRXBUF.all;
}


// ******************************************************
// void SCITransmitByte(unsigned char data)
//
// This function is used to transmit a single byte on
// the serial port.
//
// Parameters:
// data: The byte to transmit.
// ******************************************************
void SCITransmitByte(unsigned char data)
{
//1. If the fifo buffer is full we should wait
while((SciaRegs.SCIFFTX.all &0x1F00)>0x0300) ;
//kickdog();

//2. Write the data byte to the fifo buffer
SciaRegs.SCITXBUF=data;
}

void InitSciaGpio()
{
EALLOW;

/* Enable internal pull-up for the selected pins */
// Pull-ups can be enabled or disabled disabled by the user.
// This will enable the pullups for the specified pins.

GpioCtrlRegs.GPAPUD.bit.GPIO28 = 0; // Enable pull-up for GPIO28 (SCIRXDA)
GpioCtrlRegs.GPAPUD.bit.GPIO29 = 0; // Enable pull-up for GPIO29 (SCITXDA)


/* Set qualification for selected pins to asynch only */
// Inputs are synchronized to SYSCLKOUT by default.
// This will select asynch (no qualification) for the selected pins.

GpioCtrlRegs.GPAQSEL2.bit.GPIO28 = 3; // Asynch input GPIO28 (SCIRXDA)
// GpioCtrlRegs.GPAQSEL1.bit.GPIO7 = 3; // Asynch input GPIO7 (SCIRXDA)

/* Configure SCI-A pins using GPIO regs*/
// This specifies which of the possible GPIO pins will be SCI functional pins.

GpioCtrlRegs.GPAMUX2.bit.GPIO28 = 1; // Configure GPIO28 for SCIRXDA operation
GpioCtrlRegs.GPAMUX2.bit.GPIO29 = 1; // Configure GPIO29 for SCITXDA operation

EDIS;
}

void SetupSerialPort()
{

// *** Calculate the BRR ***
//
// LSPLK
// BRR = ---------------------------------- - 1
// 8*BAUDRATE

UINT32 BRR = (15000000UL)/(115200<<3)-1; //Low speed clock = 15 MHz, baudrate = 115200 baud


InitSciaGpio();

SciaRegs.SCICTL1.all=0x0003; // Reset SCI enable RX and TX
SciaRegs.SCIFFCT.all=0x0000; // SCI FIFO Control (SCIFFCT) Register
// No transfer delay or auto detect baud
SciaRegs.SCIFFTX.all=0xE000; // Enable transmit FIFO opeRATIONS
SciaRegs.SCIFFRX.all=0x2000; // Enable receive FIFO operations

SciaRegs.SCICTL2.all=0x0000; //disable interrupts

// Set the baud rate
SciaRegs.SCIHBAUD=(UINT16)(BRR>>8) & 0x00FF;
SciaRegs.SCILBAUD=(UINT16)BRR & 0x00FF;


SciaRegs.SCIPRI.all=0x0018; //SCI Priority Control Register
//Complete current receive/transmit sequence before stopping

SciaRegs.SCICCR.all=0x0007; // SCI Communication Control Register
//8 bit character length, No parity, 1 stop bit
SciaRegs.SCICTL1.all=0x0023; // Enable the SCI
}

  • Christian,

    We suggest to try a known-good example from our Controsuite to first determine if the problem lies with FTDI or the software code.

    You may already have the Controlsuite installed, otherwise please go here to install it: www.ti.com/.../controlsuite

    After installation, SCI examples will be at C:\ti\controlSUITE\device_support\F28035\v180\F28035_examples
    Please take a look at check sci_loopback_interrupts, sci_loopback and sci_echoback examples.

    Regards,
    PEter