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.

CCS/TMS320F28379D: Using a different GPIOpin as SCI/UART Transmitt

Part Number: TMS320F28379D

Tool/software: Code Composer Studio

Hello,

I am trying to interface this MCU with a Bluetooth module using SCI/UART.  I have tested on the launchpad using GPIO 18 and 19 and they worked, but when I tried to do the same on the control card using GPIO42 for transmitting I have a difficult time setting it up. We have used an oscilloscope to probe GPIO42 (HSEC pin 93), and we did not see anything.

Thank you in advance,

Jin Gao

p.s

The following code is how we tried to pin mux GPIO42 to use SCITXA. I am not sure if GpioCtrlRegs.GPBGMUX1.bit.GPIO42 = 15 or 3. Well, either way, both did not work. The rest of the code is identical to code example  TMS320F28379D>sci_loopback_cpu.

//

// Initialize device clock and peripherals
//
Device_init();

//

//
Device_initGPIO();

// GPIO19 is the SCI Rx pin.
//
GPIO_setMasterCore(19, GPIO_CORE_CPU1);
GPIO_setPinConfig(GPIO_19_SCIRXDB);
GPIO_setDirectionMode(19, GPIO_DIR_MODE_IN);
GPIO_setPadConfig(19, GPIO_PIN_TYPE_STD);
GPIO_setQualificationMode(19, GPIO_QUAL_ASYNC);

//
// GPIO42 is the SCI Tx pin.
//
EALLOW;
GPIO_setMasterCore(42, GPIO_CORE_CPU1);
GPIO_setPinConfig(GPIO_42_SCITXDA);
GPIO_setDirectionMode(42, GPIO_DIR_MODE_OUT);
GPIO_setPadConfig(42, GPIO_PIN_TYPE_STD);
GPIO_setQualificationMode(42, GPIO_QUAL_ASYNC);

EALLOW;
GpioCtrlRegs.GPBGMUX1.bit.GPIO42 = 15;
GpioCtrlRegs.GPBMUX1.bit.GPIO42 = 15; // Mux to SCI

// Initialize PIE and clear PIE registers. Disables CPU interrupts.
//
Interrupt_initModule();

// Initialize the PIE vector table with pointers to the shell Interrupt
// Service Routines (ISR).
//
Interrupt_initVectorTable();

//
// Enables CPU interrupts
//
Interrupt_enableMaster();

//
// Initialize counts
//
loopCount = 0;
errorCount = 0;

//
// Initialize SCIB
//
initSCIBFIFO();
initSCIALoopback();

//
// Note: Autobaud lock is not required for this example
//

//
// Send a character starting with 0
//
//sendChar = ;
sendChar = 0;
float i = 0;
uint8_t dataID = 0;

//
// Send Characters forever starting with 0x00 and going through 0xFF.
// After sending each, check the receive buffer for the correct value.
//
for(;;)
{
/*
if(sendAT) {
if(sendChar < 21) {
xmitSCIB(ATCommands[sendChar]);
}
} else {
if(sendChar < 2) {
xmitSCIB(startAT[sendChar]);
}
}
*/
if(k <= 5) {
xmitSCIB(sendChar);

//
// Wait for RRDY/RXFFST = 1 for 1 data available in FIFO
//

/*while(SCI_getRxFIFOStatus(SCIB_BASE) == SCI_FIFO_RX0)
{
;
}
*/

//
// Check received character
//
receivedChar = SCI_readCharBlockingFIFO(SCIB_BASE);

//
// Received character not correct
//
if(receivedChar != sendChar)
{
//error();
}
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

void error()
{
errorCount++;
Example_Fail = 1;
//asm(" ESTOP0"); // Uncomment to stop the test here
for (;;);
}

//
// initSCIBLoopback - Configure SCIB settings
//
void initSCIALoopback()
{
//
// Note: Clocks were turned on to the SCIB peripheral
// in the Device_init() function
//

//
// 8 char bits, 1 stop bit, no parity. Baud rate is 9600.
//
SCI_setConfig(SCIB_BASE, DEVICE_LSPCLK_FREQ, 9600, (SCI_CONFIG_WLEN_8 |
SCI_CONFIG_STOP_ONE |
SCI_CONFIG_PAR_NONE));
SCI_disableLoopback(SCIB_BASE);

SCI_enableFIFO(SCIB_BASE);
SCI_performSoftwareReset(SCIB_BASE);
SCI_disableInterrupt(SCIB_BASE, SCI_INT_RXERR);

SCI_enableInterrupt(SCIB_BASE, SCI_INT_TXRDY);
SCI_enableInterrupt(SCIB_BASE, SCI_INT_RXRDY_BRKDT);

//SCI_enableLoopback(SCIB_BASE);

//
// Relinquish SCI from Reset
//
SCI_enableModule(SCIB_BASE);
}

//
// xmitSCIB - Transmit a character from the SCI
//
void xmitSCIB(uint16_t a)
{
SCI_writeCharNonBlocking(SCIB_BASE, a);
}

//
// initSCIBFIFO - Initialize the SCI FIFO
//
void initSCIBFIFO()
{
SCI_clearInterruptStatus(SCIB_BASE, SCI_INT_TXFF);
SCI_resetTxFIFO(SCIB_BASE);
SCI_enableFIFO(SCIB_BASE);

SCI_setFIFOInterruptLevel(SCIB_BASE, SCI_FIFO_TX0, SCI_FIFO_RX4);
SCI_resetChannels(SCIB_BASE);

SCI_clearInterruptStatus(SCIB_BASE, SCI_INT_RXFF);
}

//
// End of file
//

  • Hi Jin,

    These two chunks are attempting to do the same thing:

    EALLOW;
    GPIO_setMasterCore(42, GPIO_CORE_CPU1);
    GPIO_setPinConfig(GPIO_42_SCITXDA);
    GPIO_setDirectionMode(42, GPIO_DIR_MODE_OUT);
    GPIO_setPadConfig(42, GPIO_PIN_TYPE_STD);
    GPIO_setQualificationMode(42, GPIO_QUAL_ASYNC);

    EALLOW;
    GpioCtrlRegs.GPBGMUX1.bit.GPIO42 = 15;
    GpioCtrlRegs.GPBMUX1.bit.GPIO42 = 15; // Mux to SCI

    But I don't think the second one is correct.  Index 15 is a composite of both the GPxMUX and GPxGMUX, both of which only have individual ranges of 0 to 3:


  • Thank you for your response. Just to clarify, in order to switch GPIO42 to SCITXDA, what we do is:

    1. Set GPIO42 to CPU1

    GPIO_setMasterCore(42, GPIO_CORE_CPU1);

    2. Set the MUX for the pin configuration we want

    GPIO_setPinConfig(GPIO_42_SCITXDA);

    3. Set GPIO direction as output

    GPIO_setDirectionMode(42, GPIO_DIR_MODE_OUT);

    4. Set configuration to asynchronous mode

    GPIO_setQualificationMode(42, GPIO_QUAL_ASYNC);

    Apologies for the questions. We have implemented the above code, but we do not have any output (tested with an oscilloscope). The same code (for TX and RX) works when using GPIO29 set to SCITXDA (which does not need the MUX set), so we think that the MUX setup part of our code is not right. Otherwise, if this part is ok, do you have any other suggestions on what might be wrong?

    Here is the pin assignment we are using:

    (This is on page 25 of the TMS320F2837xD datasheet)

    Thank you~

  • Hi Jin,

    Yes, that seems right.

    Note that using GPIO29 will also need a mux selection (GPIO_setPinConfig) because (almost) all GPIOs are GPIO by default (not a peripheral like SCI).

    I think the next step is to verify the pin hookup.  You might switch over to one of the GPIO examples and see if you can specifically get GPIO42 to toggle so that you can verify that you are hooked up to the correct pin.  

    You can also go into the expressions window and examine the GPIO mux registers directly to make sure they are setup as expected.