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.

TMS320F28379D: Serial Echo by polling or interrupt

Part Number: TMS320F28379D
Other Parts Discussed in Thread: C2000WARE

Tool/software:

Hi everyone

I try develop a code for testing and control my F28379D board, but I find some issues to fix, I try made a serial echo with my board, but my board not answer my commands, only send data to my serial port.

I use the GPIOs 18 and 19 to made this communication.

Could someone help me? Below is my code:

//
// Included Files
//
#include "driverlib.h"
#include "device.h"

void UART_GPIO_init();
void UART_Config();
void SCI_A_init();

void main(void)
{
uint16_t receivedChar;

Device_init();
Device_initGPIO();

UART_GPIO_init(); // Configure the GPIOs for SCIB
UART_Config(); // Configure the UART
SCI_A_init(); // Initialize the SCIB

SCI_writeCharArray(SCIB_BASE, (uint16_t *)"Hello World\r\n", 13); // Send the fixed message

while(1)
{
// Checks if a character was received
if(SCI_getRxFIFOStatus(SCIB_BASE) != SCI_FIFO_RX0)
{
// Read the received character
receivedChar = SCI_readCharBlockingFIFO(SCIB_BASE);

// Send a string "Received from F28379D:"
SCI_writeCharArray(SCIB_BASE, (uint16_t *)"Recebido de F28379D: ", 22);

// Sends the received character (echo)
SCI_writeCharBlockingFIFO(SCIB_BASE, receivedChar);

SCI_clearInterruptStatus(SCIB_BASE, SCI_INT_RXFF);

// Small delay to avoid communication overload
DEVICE_DELAY_US(1000000);

}
}
}

void UART_GPIO_init()
{
GPIO_setPinConfig(GPIO_19_SCIRXDB);
GPIO_setPinConfig(GPIO_18_SCITXDB);

}

void UART_Config()
{
//
// Configuration for the SCI Rx pin.
//
GPIO_setMasterCore(19U, GPIO_CORE_CPU1);
GPIO_setPinConfig(GPIO_19_SCIRXDB);
GPIO_setDirectionMode(19U, GPIO_DIR_MODE_IN);
GPIO_setPadConfig(19U, GPIO_PIN_TYPE_STD);
GPIO_setQualificationMode(19U, GPIO_QUAL_ASYNC);

//
// Configuration for the SCI Tx pin.
//
GPIO_setMasterCore(18U, GPIO_CORE_CPU1);
GPIO_setPinConfig(GPIO_18_SCITXDB);
GPIO_setDirectionMode(18U, GPIO_DIR_MODE_OUT);
GPIO_setPadConfig(18U, GPIO_PIN_TYPE_STD);
GPIO_setQualificationMode(18U, GPIO_QUAL_ASYNC);

//
// Configuration for the SCI-B Tx pin (GPIO 18).
//

}

void SCI_A_init()
{
//
// Initialize SCIA and its FIFO.
//
SCI_performSoftwareReset(SCIB_BASE);

//
// Configure SCIA for echoback.

SCI_setConfig(SCIB_BASE, DEVICE_LSPCLK_FREQ, 9600, (SCI_CONFIG_WLEN_8 |
SCI_CONFIG_STOP_ONE |
SCI_CONFIG_PAR_NONE));

SCI_resetChannels(SCIB_BASE);
SCI_clearInterruptStatus(SCIB_BASE, SCI_INT_TXFF | SCI_INT_RXFF);
SCI_resetRxFIFO(SCIB_BASE);
SCI_resetTxFIFO(SCIB_BASE);
SCI_enableFIFO(SCIB_BASE);
SCI_enableModule(SCIB_BASE);

#ifdef AUTOBAUD
//
// Perform an autobaud lock.
// SCI expects an 'a' or 'A' to lock the baud rate.
//
SCI_lockAutobaud(SCIB_BASE);
#endif

}

//
// End of File
//