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.

LAUNCHXL-F28379D: SCI connection to computer

Part Number: LAUNCHXL-F28379D


I have launchpad F28379d, I want to monitor some variables of the code via SCI on the terminal on the PC.

I have tried module 8 of training also SCI ex 3 echo back.
but I am not getting anything on the terminal.

Is any external connector required to communicate to PC or internal IC is given and if IC provided which SCI module should i configure for this application?

Please help me find what I am missing?

Thanks & Regards
Jay

  • Hi Jay,

    Is any external connector required to communicate to PC or internal IC is given and if IC provided which SCI module should i configure for this application?

    No, you shouldn't need any external connections besides the USB cable that comes with the LaunchPad

    Please help me find what I am missing?
    • Can you please verify that you see the "_LAUNCHXL_F28379D" predefine in your projects? Access the Predefined symbols list by accessing the Project Properties (right click on the project name), Navigating to Build » C2000 Compiler » Advanced Options » Predefined Symbols.
    • Can you please verify you have the right COM port (this should be seen within 'Ports (COM & LPT)' in Device Manager and that your serial port settings are correct (Baud 9600, etc.) 

    Best Regards,

    Marlyn

  • Hi Marlyn,

    I have added _LAUNCHXL_F28379D in the predefined symbol and also verified the COM port and baud rate. I have checked on both CCS terminal as well as putty terminal, still I am not getting anything on the terminal it is just blank also I can not write/type anything on the terminal.

    Is there any specific module is connected with USB internally (though I have tried A,B and C module but none is working in this case)

    I am attaching the code please look into it (It is for SCI B), letme know any changes is required or some special things needs to be done?

    Thanks & Regards,
    Jay

    //############################################################################
    //
    // FILE: module8_main.c
    //
    // TITLE: Lab - Module 8 (Communications)
    //
    // C2K ACADEMY URL: https://dev.ti.com/tirex/explore/node?node=AOpze8ebskysmgASY3VKSA__jEBbtmC__LATEST
    //
    //! \addtogroup academy_lab_list
    //! <h1> Lab solution on Using Communication Peripherals </h1>
    //!
    //! The objective of this lab is to become familiar with the on-board SCI
    //! (Serial Communication Interface) by sending and receiving data between a
    //! C2000 device and a computer. We will use the computer to change the
    //! frequency of the blinking LED and then the board will echo this value back
    //! to the computer. This will allow us to demonstrate both means of
    //! communication. Additionally, Code Composer Studio's terminal feature will
    //! be explored and will be used to interact with the device.
    //!
    //! \b External \b Connections \n
    //!  - None.
    //!
    //! \b Watch \b Variables \n
    //!  - None.
    #include "driverlib.h"
    #include "device.h"
    //
    uint16_t cpuTimer0IntCount;     //num times interrupt triggered
    uint16_t delayCount;            //number 0-9 to change LED frequency
    // Function Prototypes
    //
    void initGPIO(void);
    void initSCIB(void);
    void initCPUTimer0(void);
    void configCPUTimer(uint32_t, float, float);
    
    __interrupt void cpuTimer0ISR(void);
    // Main
    //
    void main(void)
    {
    //--- CPU Initialization
        Device_init();
        Interrupt_initModule();
        Interrupt_initVectorTable();
    
    
    //--- Configure GPIO pins LED1, SCI Rx, and SCI Tx
        Device_initGPIO();
        initGPIO();
    
    //--- Initialize CPUTIMER0 and its interrupt
        Interrupt_register(INT_TIMER0, &cpuTimer0ISR);
        initCPUTimer0();
        configCPUTimer(CPUTIMER0_BASE, DEVICE_SYSCLK_FREQ, 200000); //Interrupts every 0.2 sec
        CPUTimer_enableInterrupt(CPUTIMER0_BASE);
        Interrupt_enable(INT_TIMER0);
        CPUTimer_startTimer(CPUTIMER0_BASE);
    
    //--- Enable global interrupts and real-time debug
        EINT;
        ERTM;
    
        initSCIB();
    
        char* msg;
        char receivedChar;
        uint16_t rxStatus = 0U;
    
        //
        // Send starting message.
        //
        msg = "\r\n\n\nHello World! Enter a number 0-9 to change the LED blink rate\0";
        SCI_writeCharArray(SCIB_BASE, (uint16_t*)msg, 65);
        for(;;)
        {
            msg = "\r\nEnter a number 0-9: \0";
            SCI_writeCharArray(SCIB_BASE, (uint16_t*)msg, 24);
    
            //
            // Read a character from the FIFO.
            //
            receivedChar = SCI_readCharBlockingFIFO(SCIB_BASE);
    
    
            //Turns character to digit
            delayCount = receivedChar - '0';
    
            rxStatus = SCI_getRxStatus(SCIB_BASE);
            if((rxStatus & SCI_RXSTATUS_ERROR) != 0)
            {
                //
                //If Execution stops here there is some error
                //Analyze SCI_getRxStatus() API return value
                //
                ESTOP0;
            }
    
            //
            // Echo back the character.
            //
            msg = "  LED set to blink rate \0";
            SCI_writeCharArray(SCIB_BASE, (uint16_t*)msg, 25);
            SCI_writeCharBlockingFIFO(SCIB_BASE, receivedChar);
        }
    }
    
    //
    // Initializes CPUTIMER0
    //
    void
    initCPUTimer0(void)
    {
    //--- Initialize timer period to maximum
        CPUTimer_setPeriod(CPUTIMER0_BASE, 0xFFFFFFFF);
    
    //--- Initialize pre-scale counter to divide by 1 (SYSCLKOUT)
        CPUTimer_setPreScaler(CPUTIMER0_BASE, 0);
    
    //--- Make sure timer is stopped
        CPUTimer_stopTimer(CPUTIMER0_BASE);
    
    //--- Reload all counter register with period value
        CPUTimer_reloadTimerCounter(CPUTIMER0_BASE);
    
    //--- Set interrupt counter
        cpuTimer0IntCount = 0;
    }
    
    //
    // configCPUTimer - This function initializes the selected timer to the
    // period specified by the "freq" and "period" parameters. The "freq" is
    // entered as Hz and the period in uSeconds. The timer is held in the stopped
    // state after configuration.
    //
    void
    configCPUTimer(uint32_t cpuTimer, float freq, float period)
    {
        uint32_t temp;
    
    //--- Initialize timer period:
        temp = (uint32_t)(freq / 1000000 * period);
        CPUTimer_setPeriod(cpuTimer, temp);
    
    //--- Set pre-scale counter to divide by 1 (SYSCLKOUT):
        CPUTimer_setPreScaler(cpuTimer, 0);
    
    //
    // Initializes timer control register. The timer is stopped, reloaded,
    // free run disabled, and interrupt enabled.
    // Additionally, the free and soft bits are set
    //
        CPUTimer_stopTimer(cpuTimer);
        CPUTimer_reloadTimerCounter(cpuTimer);
        CPUTimer_setEmulationMode(cpuTimer,
                                  CPUTIMER_EMULATIONMODE_STOPAFTERNEXTDECREMENT);
        CPUTimer_enableInterrupt(cpuTimer);
    }
    
    //
    // ISR for CPUTIMER0 to change LED blink rate based on input to delayCount
    //
    __interrupt void
    cpuTimer0ISR(void)
    {
        cpuTimer0IntCount++; 
        if (cpuTimer0IntCount >= delayCount){
            cpuTimer0IntCount = 0;
            GPIO_togglePin(DEVICE_GPIO_PIN_LED1);
        }
    
    //--- Acknowledge this interrupt to receive more interrupts from group 1
        Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP1);
    }
    
    //
    // Configures LED1 and SCI Rx and Tx pins
    //
    void initGPIO(void)
    {
    
    //--- Configure LED1
        GPIO_setPadConfig(DEVICE_GPIO_PIN_LED1, GPIO_PIN_TYPE_PULLUP);     // Enable pull-up on LED1
        GPIO_setPinConfig(DEVICE_GPIO_CFG_LED1  );                         // Sets the pin to be LED1
        GPIO_setDirectionMode(DEVICE_GPIO_PIN_LED1, GPIO_DIR_MODE_OUT);    // LED1 = output
        GPIO_writePin(DEVICE_GPIO_PIN_LED1, 1);                            // Load output latch
    
    
        GPIO_setPinConfig(GPIO_18_SCITXDB);
        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);
    
    //--- Set the SCI Tx pin
      //  GPIO_setPinConfig(DEVICE_GPIO_CFG_SCITXDA);
        GPIO_setDirectionMode(18, GPIO_DIR_MODE_OUT);
        GPIO_setPadConfig(18, GPIO_PIN_TYPE_STD);
        GPIO_setQualificationMode(18, GPIO_QUAL_ASYNC);
    
        /*
    //--- Set the SCI Rx pin
        GPIO_setPinConfig(DEVICE_GPIO_CFG_SCIRXDA);
        GPIO_setDirectionMode(DEVICE_GPIO_PIN_SCIRXDA, GPIO_DIR_MODE_IN);
        GPIO_setPadConfig(DEVICE_GPIO_PIN_SCIRXDA, GPIO_PIN_TYPE_STD);
        GPIO_setQualificationMode(DEVICE_GPIO_PIN_SCIRXDA, GPIO_QUAL_ASYNC);
    
    //--- Set the SCI Tx pin
        GPIO_setPinConfig(DEVICE_GPIO_CFG_SCITXDA);
        GPIO_setDirectionMode(DEVICE_GPIO_PIN_SCITXDA, GPIO_DIR_MODE_OUT);
        GPIO_setPadConfig(DEVICE_GPIO_PIN_SCITXDA, GPIO_PIN_TYPE_STD);
        GPIO_setQualificationMode(DEVICE_GPIO_PIN_SCITXDA, GPIO_QUAL_ASYNC);
    */
    }
    
    void initSCIB(void){
    //--- Initialize SCIB and its FIFO.
        SCI_performSoftwareReset(SCIB_BASE);
    
    //--- Configure SCIB 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_resetRxFIFO(SCIB_BASE);
        SCI_resetTxFIFO(SCIB_BASE);
        SCI_clearInterruptStatus(SCIB_BASE, SCI_INT_TXFF | SCI_INT_RXFF);
        SCI_enableFIFO(SCIB_BASE);
        SCI_enableModule(SCIB_BASE);
        SCI_performSoftwareReset(SCIB_BASE);
    
    #ifdef AUTOBAUD
        //
        // Perform an autobaud lock.
        // SCI expects an 'a' or 'A' to lock the baud rate.
        //
        SCI_lockAutobaud(SCIB_BASE);
    #endif
    }

  • Hi Jay,

    I just retested the module 8 communications lab on the F28379D launchpad and it does work on my end. 

    The LaunchPad supports PC communications through the USB/UART XDS100v2 connection for SCI-A, can you please try the original code with SCI-A? 

    Just for sanity checks, can you please attach images of what you see in your device manager as well as the settings in your serial ports and your predefine symbols?

    Best Regards,

    Marlyn

  • sorry for the late reply.

    Actually, the code is working, I configured the wrong pin for SCI A.

    Thank you.Regards,
    Jay