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.

SCIA UART communication problem

Other Parts Discussed in Thread: TMS320F28335, CONTROLSUITE

Hi,

I am using TMS320F28335. And I just want to exchange data between Transmit and Receive pins i.e in Loopback mode.

And below is the configuration I am using .

UART_Config()

{

EALLOW;
SysCtrlRegs.PCLKCR0.bit.SCIAENCLK = 1; // SCI-A
EDIS;

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)

/* 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;

SciaRegs.SCICCR.bit.SCICHAR = UART_EIGHT_BIT_DATA;

SciaRegs.SCICCR.bit.PARITYENA = SCI_DIS_PARITY;

SciaRegs.SCICCR.bit.STOPBITS = SCI_STOP_BIT_1;

/*LoopBack Enable*/
SciaRegs.SCICCR.bit.LOOPBKENA = SCI_LOOP_BK_ENA;


/* Clear SW_Reset */
SciaRegs.SCICTL1.bit.SWRESET = SCI_CLEAR_SW_RESET ;


/* Choose the baudrate */

SciaRegs.SCIHBAUD = SCI_37_5_BAUD_115200>> 8;
SciaRegs.SCILBAUD = SCI_37_5_BAUD_115200;

SciaRegs.SCIFFRX.bit.RXFFOVRCLR = SCI_CLEAR_RX_FIFO_OVF;
SciaRegs.SCIFFRX.bit.RXFIFORESET = SCI_RX_FIFO_RST;
SciaRegs.SCIFFRX.bit.RXFFIENA = SCI_RX_FIFO_INT_DIS;
SciaRegs.SCIFFRX.bit.RXFFINTCLR = SCI_RX_FIFO_INT_CLR;
SciaRegs.SCIFFRX.bit.RXFFIL = SCI_RX_FIFO_LEVEL_31; /* 0x001F */

/*
*
*/
SciaRegs.SCIFFTX.all = (SS_U16)0;
SciaRegs.SCIFFTX.bit.SCIRST = SCI_TX_RX_RESUME;
//SciaRegs.SCIFFTX.bit.SCIFFENA = SCI_FIFO_ENHANC_ENA;
SciaRegs.SCIFFTX.bit.SCIFFENA = SCI_FIFO_ENHANC_DIS;
SciaRegs.SCIFFTX.bit.TXFIFOXRESET = SCI_TX_FIFO_RESET;
SciaRegs.SCIFFTX.bit.TXFFIENA = SCI_TX_FIFO_INT_DIS;

SciaRegs.SCIPRI.bit.FREE = SCI_FREE_RUN;


SciaRegs.SCIFFCT.bit.CDC = SCI_DISABLE_AUTO_BAUD;
SciaRegs.SCIFFCT.bit.FFTXDLY = 0;


SciaRegs.SCICTL1.bit.SWRESET = SCI_SET_SW_RESET;


SciaRegs.SCICTL1.bit.RXENA=1;
SciaRegs.SCICTL1.bit.TXENA=1;

}

And below is the transmit and reception functions

void UART_Transmit()

{

if(SciaRegs.SCICTL2.bit.TXRDY IS 1)
{

/* Transmit Data Register is empty, transmit the data */

SciaRegs.SCITXBUF = dataToTransmit;


}

}

UART_Receive()

{

status = (SS_U16)SciaRegs.SCIFFRX.bit.RXFFST;


if (status != 0)
{
/* Put data in the hardware register to software buffer */
*receivedData = (SS_U8)SciaRegs.SCIRXBUF.bit.RXDT;
}

}

I am trying to transmit a string {"ABCD"}. The problem is I get no data on either Transmit or recieve pins(GPIO28 and GPIO29) when probed.The lines remain always High. But I can see the data on the registers. I do not want to use any FIFO, just a single transfer and receive should be fine for me.

Could anyone please let me know what might be the problem with my configuration. Is there any other method to configure the GPIO to work for SCIA. Is there something I am missing? 

And the clock I am using is 150MHZ and so the LSPCLK will be 150Mhz/4 .

Please suggest .

Thanks

Rohini

  • Hi Rohini,

    Please keep in mind that loopback mode uses an internal path to connect TX and RX. 

    You should disable the loopback enable bit to get data to show up on the GPIO pins.


    Thank you,
    Brett

  • Hi Brett,

    Thank you .

    I have tried with disabling the loopback . But I dont see any data on the line.
    I just want to know if , there is any other way to configure the GPIO to be SCIA pins? Bcs I see these pins going high when I write 1 on the pin (GPIO28 = 1). But it does not work when I write data to UART buffer.

    Thanks
    Rohini
  • Hi Rohini,

    I don't see anything obviously wrong.

    I might recommend trying to run your device's echoback example within controlSUITE.  This example has the C2000 chip retransmit any data it receives from hyperterminal.

    There's then a good chance that you can compare the example with what you've written and make sure you don't have some kind of hardware issue.


    -Brett

  • Hello Brett,

    I compared with the control suite example and I don't see anything wrong in my configuration.

    But one thing I observed on my device is

    After configuring the gpio as scia , I tried to toggle the gpio29 by writing multiple 0s and 1s .The gpio is toggling.

    Is this something expected after configuring the gpio as sci ??

    Thanks
  • Hi Rohini,

    If you are able to toggle the pin as gpio peripheral then the pin is not configured as SCIA peripheral properly.

    Please look into your project that anywhere you have re-configured it as gpio.

    regards

    Aditya