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: CCS/LAUNCHXL-F28379D: Using SCIB -UART

Part Number: TMS320F28379D
Other Parts Discussed in Thread: CONTROLSUITE, C2000WARE

Tool/software: Code Composer Studio

Hi,

 I Have tried UART communication code by changing the pin from the example code,the Tx line  does not seem to be transmitting at all .I am having some trouble with the SCI modules not being able to output anything through the pins on the launchpad,When I were edited controlsuite code its work fine.I posted my code bellow, any suggestions as to what I'm missing would be appreciated.

//#############################################################################
//
// FILE:   sci_ex3_echoback.c
//
// TITLE:  SCI echoback example.
//
//! \addtogroup driver_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 USB cable.
//!  Refer to the hardware user guide for the UART/USB connector information.
//
//#############################################################################
// $TI Release: F2837xD Support Library v3.10.00.00 $
// $Release Date: Tue May 26 17:13:46 IST 2020 $
// $Copyright:
// Copyright (C) 2013-2020 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 "driverlib.h"
#include "device.h"

//
// Defines
//
// Define AUTOBAUD to use the autobaud lock feature
//#define AUTOBAUD

//
// Globals
//
uint16_t loopCounter = 0;

//
// Main
//
void main(void)
{
    uint16_t receivedChar;
    unsigned char *msg;
    uint16_t rxStatus = 0U;

    //
    // Configure PLL, disable WD, enable peripheral clocks.
    //
    Device_init();

    //
    // Disable pin locks and enable internal pullups.
    //
    Device_initGPIO();


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

        EALLOW;
    //
    // Configuration for 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_PULLUP);
    GPIO_setQualificationMode(19, GPIO_QUAL_ASYNC);



    //
    // Initialize interrupt controller and vector table.
    //
    Interrupt_initModule();
    Interrupt_initVectorTable();

    //
    // 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_disableLoopback(SCIB_BASE);
    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

    //
    // Send starting message.
    //
    msg = "HELLO";

    for(;;)
    {

        SCI_writeCharArray(SCIB_BASE, (uint16_t*)msg, 6);

      

    }
}

//
// End of File
//


Thanks in advance.

  • Hi, 

    Thanks for posting the code. The Code looks okay. some questions below

    Rani Loganthan said:
    I am having some trouble with the SCI modules not being able to output anything through the pins on the launchpad,When I were edited controlsuite code its work fine

    1. What are you connecting on J1 Booster pack connector when you run this code?

    2. what is the SCI connected to on the other side?

    3. are you seeing some characters on the other side?

    4. Since you said controlsuite code works fine, is it on the same setup.  

    Regards,

    Sudharsanan

  • By referring forum find out it... added the _LAUNCHXL_F28379D in predefined symbol ... Now transmitting is working... But when I am added timer interrupt as well as SCI TX interrupt both are not working parrelly ... If I am disable any one of the interrupt function remaining one works fine... Any idea about where I done mistakes...

  • Hi,

    Good to note that you had progressed past that. I did not understand what you meant by 

    Rani Loganthan said:
    But when I am added timer interrupt as well as SCI TX interrupt both are not working parrelly ... If I am disable any one of the interrupt function remaining one works fine

    May be you can refer the interrupt example: [C2000Ware Install dir]\driverlib\f2837xd\examples\cpu1\interrupt\interrupt_ex2_with_i2c_sci_spi_loopback.c.This is an example where multiple interrupts are handled. If you still get stuck, please post your relevant code snippet and elaborate a little bit more on what you disabled/how. 

    Regards,

    Sudharsanan

  • Hi sudharsanan,

     My application using timer 0 and timer2  with SCIB transmitting interrupt . When i am not enable the SCIB interrupt  timer 0 and timer 2 both are working fine. Enable the SCIB interrupt timer 2 interrupt is not working.

      Here i have attached snippet for your reference .if i have done any mistake please notify me.

      thanks in advance.

    //#############################################################################
    //
    // FILE: timer_ex1_cputimers.c
    //
    // TITLE: CPU Timers Example
    //
    //! \addtogroup driver_example_list
    //! <h1> CPU Timers </h1>
    //!
    //! This example configures CPU Timer0, 1, and 2 and increments
    //! a counter each time the timer asserts an interrupt.
    //!
    //! \b External \b Connections \n
    //! - None
    //!
    //! \b Watch \b Variables \n
    //! - cpuTimer0IntCount
    //! - cpuTimer1IntCount
    //! - cpuTimer2IntCount
    //!
    //
    //#############################################################################
    // $TI Release: F2837xD Support Library v3.09.00.00 $
    // $Release Date: Thu Mar 19 07:35:24 IST 2020 $
    // $Copyright:
    // Copyright (C) 2013-2020 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 "driverlib.h"
    #include "device.h"
    #include "Sci_B.h"
    #include "Timer0.h"

    //
    // Main
    //
    void main(void)
    {
    //
    // Initializes device clock and peripherals
    //
    Device_init();

    //
    // Configures the GPIO pin as a push-pull output
    //
    Device_initGPIO();
    GPIO_setPinConfig(DEVICE_GPIO_CFG_LED1);
    GPIO_setMasterCore(DEVICE_GPIO_PIN_LED1, GPIO_CORE_CPU1);
    GPIO_setPadConfig(DEVICE_GPIO_PIN_LED1, GPIO_PIN_TYPE_STD);
    GPIO_setDirectionMode(DEVICE_GPIO_PIN_LED1, GPIO_DIR_MODE_OUT);
    Sci_Communication_Conf();
    RS485enable();
    ModbusMaster_begin(1,19200);
    Ecap_PinConf();
    //
    // Initializes PIE and clears PIE registers. Disables CPU interrupts.
    //
    Interrupt_initModule();

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

    //
    // ISRs for each CPU Timer interrupt
    //

    Interrupt_register(INT_TIMER0, &cpuTimer0ISR);
    Interrupt_register(INT_TIMER2, &cpuTimer2ISR);
    Interrupt_register(INT_SCIB_TX, &sciaTXFIFOISR);
    Interrupt_register(INT_ECAP1, &ecap1ISR);
    //
    // Initializes the Device Peripheral. For this example, only initialize the
    // Cpu Timers.
    //

    initCPUTimers();
    Sci_Communication_Int();
    initECAP();
    //
    // Configure CPU-Timer 0, 1, and 2 to interrupt every second:
    // 1 second Period (in uSeconds)
    //
    configCPUTimer(CPUTIMER0_BASE, DEVICE_SYSCLK_FREQ, 1000000);
    configCPUTimer(CPUTIMER2_BASE, DEVICE_SYSCLK_FREQ, 1000000);


    //
    // To ensure precise timing, use write-only instructions to write to the
    // entire register. Therefore, if any of the configuration bits are changed
    // in configCPUTimer and initCPUTimers, the below settings must also
    // be updated.
    //
    CPUTimer_enableInterrupt(CPUTIMER0_BASE);
    CPUTimer_enableInterrupt(CPUTIMER2_BASE);

    // Enables CPU int1, int13, and int14 which are connected to CPU-Timer 0,
    // CPU-Timer 1, and CPU-Timer 2 respectively.
    // Enable TINT0 in the PIE: Group 1 interrupt 7
    //
    Interrupt_enable(INT_TIMER0);
    Interrupt_enable(INT_TIMER2);
    Interrupt_enable(INT_SCIB_TX);
    Interrupt_enable(INT_ECAP1);
    //
    // Starts CPU-Timer 0, CPU-Timer 1, and CPU-Timer 2.
    //
    CPUTimer_startTimer(CPUTIMER0_BASE);
    CPUTimer_startTimer(CPUTIMER2_BASE);


    //
    // Enable Global Interrupt (INTM) and realtime interrupt (DBGM)
    //
    EINT;
    ERTM;

    // IDLE loop. Just sit and loop forever (optional)
    //
    while(1)
    {
    NOP;
    }
    }

    #include "driverlib.h"
    #include "device.h"
    #include "Timer0.h"
    #include"RpmCal.h"
    #include "Ecap_3.h"


    volatile uint16_t Start_Delay,Reset_Delay=0 , cpuTimer0IntCount = 0,cpuTimer1IntCount,Pulse_Sec;
    //
    // initCPUTimers - This function initializes all three CPU timers
    // to a known state.
    //

    //
    // 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 initCPUTimers(void)
    {
    //
    // Initialize timer period to maximum
    //
    CPUTimer_setPeriod(CPUTIMER0_BASE, 0xFFFFFFFF);
    CPUTimer_setPeriod(CPUTIMER2_BASE, 0xFFFFFFFF);


    //
    // Initialize pre-scale counter to divide by 1 (SYSCLKOUT)
    //
    CPUTimer_setPreScaler(CPUTIMER0_BASE, 0);
    CPUTimer_setPreScaler(CPUTIMER2_BASE, 0);


    //
    // Make sure timer is stopped
    //
    CPUTimer_stopTimer(CPUTIMER0_BASE);
    CPUTimer_stopTimer(CPUTIMER2_BASE);


    //
    // Reload all counter register with period value
    //
    CPUTimer_reloadTimerCounter(CPUTIMER0_BASE);
    CPUTimer_reloadTimerCounter(CPUTIMER2_BASE);

    }

    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);

    //
    // Resets interrupt counters for the three cpuTimers
    //
    if (cpuTimer == CPUTIMER0_BASE)
    {
    Start_Delay=Reset_Delay=0;

    }
    else if(cpuTimer == CPUTIMER2_BASE)
    {
    Pulse_Sec=0;
    }

    }

    //
    // cpuTimer0ISR - Counter for CpuTimer0
    //

    __interrupt void cpuTimer0ISR(void)
    {
    Start_Delay++;
    Reset_Delay++;

    //
    // Acknowledge this interrupt to receive more interrupts from group 1
    //
    Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP1);
    }

    //
    // cpuTimer1ISR - Counter for CpuTimer1
    //
    uint16_t timer2;
    __interrupt void cpuTimer2ISR(void)
    {
    Pulse_Sec++;

    timer2++;

    }

    //Disable the SCIB interrupt both timer works.
    // End of File

    Enable the SCIB TImer2 is not working.......

  • Hi, 

    Thanks for the code and the screen shots. 

    Can you please let me know the IER and IFR register content in both the scenarios? 

    Regards,

    Sudharsanan

  • Case 1: SCI interrupt is working IER= 0x2009, IFR=0x2100 or 0x 2101. Timer 2 interrupt is not working...

    Case 2 : SCI interrupt is disabled IER=0x2009 ,IFR=0x0000. But timer interrupt is working..

  • While enable every interrupt works fine except timer 2 interrupt.

  • Hi, 

    Sorry for the delay in responding. How frequently is the SCI B interrupt occuring in your system. Is there any possiblility that SCIB interrupt is always taking priority and leading to Timer 2 not serviced at all? It has higher priority INT9 than INT14. 

    Regards,

    Sudharsanan

  • Yes you are correct... When I am using polling method to transmit data now every thing works fine...

    Thanks.