Other Parts Discussed in Thread: TMS320F28P650DK
Tool/software:
Hello,
I am using the F28P65x LaunchPad (TMS320F28P650DK) with CCS 10.2 on Linux.
I am trying to get UART logs over the XDS110 virtual COM port.
- Built with CPU1_FLASH configuration and flashed via DSLite.
- On the host, dmesg shows ttyACM0 (debug) and ttyACM1 (application UART).
- Opened `/dev/ttyACM1` at 115200 baud (also tried different baud rates) using picocom/minicom, but no output is seen.
- Verified with GPIO blinky example that my program is running.
Following is the code:
//############################################################################# // // FILE: sci_ex1_echoback.c // // TITLE: SCI Echoback Example. // //! \addtogroup bitfield_example_list //! <h1>SCI Echoback</h1> //! //! This test receives and echo-backs data through the SCI-A port. //! //! A terminal such as 'putty' can be used to view the data from //! the SCI and to send information to the SCI. Characters received //! by the SCI port are sent back to the host. //! //! \b Running \b the \b Application //! Open a COM port with the following settings using a terminal: //! - Find correct COM port //! - Bits per second = 9600 //! - Data Bits = 8 //! - Parity = None //! - Stop Bits = 1 //! - Hardware Control = None //! //! The program will print out a greeting and then ask you to //! enter a character which it will echo back to the terminal. //! //! \b Watch \b Variables \n //! - loopCounter - the number of characters sent //! //! \b External \b Connections \n //! Connect the SCI-A port to a PC via a transceiver and cable. //! - GPIO28 is SCI_A-RXD (Connect to Pin3, PC-TX, of serial DB9 cable) //! - GPIO29 is SCI_A-TXD (Connect to Pin2, PC-RX, of serial DB9 cable) //! // //############################################################################# // // // // C2000Ware v5.05.00.00 // // Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //############################################################################# // // Included Files // #include "f28x_project.h" // // Defines // // Define AUTOBAUD to use the autobaud lock feature //#define AUTOBAUD // // Globals // uint16_t loopCounter = 0; // // Function Prototypes // void initSCIAEchoback(void); void transmitSCIAChar(uint16_t a); void transmitSCIAMessage(unsigned char * msg); void initSCIAFIFO(void); // // Main // void main(void) { uint16_t ReceivedChar; unsigned char *msg; // // Initialize device clock and peripherals // InitSysCtrl(); // // Initialize GPIO // InitGpio(); // // For this example, only init the pins for the SCI-A port. // GPIO_SetupPinMux() - Sets the GPxMUX1/2 and GPyMUX1/2 register bits // GPIO_SetupPinOptions() - Sets the direction and configuration of GPIOs // // SCIRXDA on GPIO42 GPIO_SetupPinMux(42, GPIO_MUX_CPU1, 1); GPIO_SetupPinOptions(42, GPIO_INPUT, GPIO_ASYNC); // SCITXDA on GPIO43 GPIO_SetupPinMux(43, GPIO_MUX_CPU1, 1); GPIO_SetupPinOptions(43, GPIO_OUTPUT, GPIO_PUSHPULL); // // Disable CPU interrupts // DINT; // // Initialize the PIE control registers to their default state. // The default state is all PIE interrupts disabled and flags // are cleared. // InitPieCtrl(); // // Disable CPU interrupts and clear all CPU interrupt flags // IER = 0x0000; IFR = 0x0000; // // Initialize the PIE vector table with pointers to the shell Interrupt // Service Routines (ISR) // InitPieVectTable(); loopCounter = 0; initSCIAFIFO(); // Initialize the SCI FIFO initSCIAEchoback(); // Initialize SCI for echoback msg = "\r\n\n\nHello World!\0"; transmitSCIAMessage(msg); msg = "\r\nYou will enter a character, and the DSP will echo it back! \n\0"; transmitSCIAMessage(msg); for(;;) { msg = "\r\nEnter a character: \0"; transmitSCIAMessage(msg); // // Wait for character // while(SciaRegs.SCIFFRX.bit.RXFFST == 0) { } // wait for empty state // // Get character // ReceivedChar = SciaRegs.SCIRXBUF.all; // // Echo character back // msg = " You sent: \0"; transmitSCIAMessage(msg); transmitSCIAChar(ReceivedChar); loopCounter++; } } // // initSCIAEchoback - Initialize SCI-A for echoback // void initSCIAEchoback(void) { // // Note: Clocks were turned on to the SCIA peripheral // in the InitSysCtrl() function // SciaRegs.SCICCR.all = 0x0007; // 1 stop bit, No loopback // No parity, 8 char bits, // async mode, idle-line protocol SciaRegs.SCICTL1.all = 0x0003; // enable TX, RX, internal SCICLK, // Disable RX ERR, SLEEP, TXWAKE SciaRegs.SCICTL2.all = 0x0003; SciaRegs.SCICTL2.bit.TXINTENA = 1; SciaRegs.SCICTL2.bit.RXBKINTENA = 1; // // SCIA at 9600 baud // @LSPCLK = 50 MHz (200 MHz SYSCLK) HBAUD = 0x02 and LBAUD = 0x8B. // SciaRegs.SCIHBAUD.all = 0x0002; SciaRegs.SCILBAUD.all = 0x008B; SciaRegs.SCICTL1.all = 0x0023; // Relinquish SCI from Reset } // // transmitSCIAChar - Transmit a character from the SCI // void transmitSCIAChar(uint16_t a) { while (SciaRegs.SCIFFTX.bit.TXFFST != 0) { } SciaRegs.SCITXBUF.all = a; } // // transmitSCIAMessage - Transmit message via SCIA // void transmitSCIAMessage(unsigned char * msg) { int i; i = 0; while(msg[i] != '\0') { transmitSCIAChar(msg[i]); i++; } } // // initSCIAFIFO - Initialize the SCI FIFO // void initSCIAFIFO(void) { SciaRegs.SCIFFTX.all = 0xE040; SciaRegs.SCIFFRX.all = 0x2044; SciaRegs.SCIFFCT.all = 0x0; } // // End of file //