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