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/LAUNCHXL-F28377S: GUI Composer v2 Binding widget and TMS320F28377S

Part Number: LAUNCHXL-F28377S

Tool/software: Code Composer Studio

Hello TI community,

I am currently trying to program a toggle switch in GUI Composer v2 to turn on and off LED D10 (blue) on the LaunchXL board. This is my code so far

//###########################################################################
//
// FILE:   blinky_cpu01.c
//
// TITLE:  LED Blink Example for F2837xS.
//
//! \addtogroup cpu01_example_list
//! <h1> Blinky </h1>
//!
//! This example blinks LED X
//!
//! \note If using a Launchpad, use the Launchpad build configurations.
//!
//
//###########################################################################
// $TI Release: F2837xS Support Library v210 $
// $Release Date: Tue Nov  1 15:35:23 CDT 2016 $
// $Copyright: Copyright (C) 2014-2016 Texas Instruments Incorporated -
//             http://www.ti.com/ ALL RIGHTS RESERVED $
//###########################################################################

//
// Included Files
//
#include "F28x_Project.h"

//
// Defines
//
//#define _LAUNCHXL_F28377S

#ifdef _LAUNCHXL_F28377S
#define BLINKY_LED_GPIO    13
#else
#define BLINKY_LED_GPIO    12
#endif

Uint16 test_LED_global = 0;
Uint16 on = 0;
Uint16 last_on = 0;

void main(void)
{

//
// Step 1. Initialize System Control:
// PLL, WatchDog, enable Peripheral Clocks
// This example function is found in the F2837xS_SysCtrl.c file.
//
    InitSysCtrl();

//
// Step 2. Initialize GPIO:
// This example function is found in the F2837xS_Gpio.c file and
// illustrates how to set the GPIO to it's default state.
//
    InitGpio();
    GPIO_SetupPinMux(BLINKY_LED_GPIO, GPIO_MUX_CPU1, 0);
    GPIO_SetupPinOptions(BLINKY_LED_GPIO, GPIO_OUTPUT, GPIO_PUSHPULL);

//
// Step 3. Clear all interrupts and initialize PIE vector table:
// 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.
// This function is found in the F2837xS_PieCtrl.c file.
//
    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).
// This will populate the entire table, even if the interrupt
// is not used in this example.  This is useful for debug purposes.
// The shell ISR routines are found in F2837xS_DefaultIsr.c.
// This function is found in F2837xS_PieVect.c.
//
    InitPieVectTable();

//
// Enable global Interrupts and higher priority real-time debug events:
//
    EINT;  // Enable Global interrupt INTM
    ERTM;  // Enable Global realtime interrupt DBGM

//
// Step 6. IDLE loop. Just sit and loop forever (optional):
//
    for(;;)
    {
        //
        // Turn on LED
        //
        /*
        if(test_LED_global || on != last_on) {
            if(test_LED_global) {
                on = (on+1) % 2;
            }

            last_on = on;
            GPIO_WritePin(BLINKY_LED_GPIO, test_LED_global);
            DELAY_US(1000);
        }
        */
        GPIO_WritePin(BLINKY_LED_GPIO, test_LED_global);
        DELAY_US(1000);


        //
        // Delay for a bit.
        //


/*
        //
        // Turn off LED
        //
        GPIO_WritePin(BLINKY_LED_GPIO, 1);

        //
        // Delay for a bit.
        //
        DELAY_US(1000*500);
*/
    }
}

//
// End of file
//

In GUI composer, I chose my_xds / "test_LED_global" binded to the toggle switch value. My hardware connects as I can tell that the board is flashing successfully. However, when I toggle the switch after running the program, nothing happens to the board. Initially when I am running, I do notice my blue LED turning on but when it starts verifying connection and telling me hardware is connected, the blue led turns off.

  • Hi Brendan,
    I'm looking into this and will post when I have more info on it.

    Regards,
    Brian
  • Hi Brian,

    I was wondering if you has any updates on this matter?
  • Hi Brenden,

    Sorry for the delayed response. Here's an update on where I've gotten so far:

    • built a blinky project configured to run from CPU1_RAM (Build Configurations / Set Active / CPU1_RAM )
    • used the CCS debugger to connect to the F28377S launchpad, load the program into RAM and ran it - works properly.
    • terminated the debug session, leaving the program running in RAM
    • started the GUI Composer App.  When GUI Composer connects to the device, the device was reset and started running the ADC demo program from Flash (flashes the blue LEDs and starts outputting ADC values to the serial port)

    I've tried configuring the project to run from CPU1_Flash, but it doesn't respond to the GUI.

    What configuration are you trying to use for your application?

    The F28377S launchpad is quite different from the other Launchpads I've been working with, so I need to get a deeper understanding of what GUI composer needs to do to either connect without causing the device to reboot into Flash or be able to work with global variables when the program is running from Flash.  I'll post again tomorrow to let you know what I find out.

    Regards,

      Brian

  • Hi Brian,

    Thank you for the response, I am not sure what configuration exactly is needed for what I am doing. Idealy, I would like to flash the project once onto the flash memory and then be able to control it with GUI composer each time I plug the launchpad into my computer via XDS v2. The LED control is simply a first test to reduce complexity in initial control.
  • Hi Brenden,

       We found the problem - there's a bug in the GUI Composer code that was responsible for establishing the connection with the target device.  I've verified that with the fix for this in place everything works correctly.  We're going through testing and validation right now and should have the fix online soon - I'll post when I have an estimated date for when the fix is available online.

    Sorry about the time and effort you've lost due to this problem.

    Thank you for your patience with this and for helping to identify the problem! 

    Regards,

      Brian

     

  • Hi Brenden,

     The fix is now up on dev.ti.com.  I've posted a GUI Composer project to the Gallery named "F28377s_Blinky_XDS" (https://dev.ti.com/gallery/search/F28377S_Blinky_XDS ) that will load in the.out file from the attached CCS project into the target flash and provides a toggle switch that is bound to 'test_LED_global' and an LED widget that is bound to 'on'.

    To run the demo, just click on the Gallery 'tile' for the GUI Composer project.  To fork the GUI Composer project so that you can customize it, click on the GUI Composer icon   

    There are a couple of changes that were needed for your target source code:

    • add the keyword volatile in front of the global variable definitions: e.g. volatile Uint16 test_LED_global = 0;
      • This ensures that the compiler doesn't optimize the code to the point where external changes to the variable are ignored

    • The GPIO pins need to be driven low to turn on the LED so the code writes the value of !on to the pin.
    • Also I found that the LED blinking worked better if I configured the pins for both the blue and red LEDs instead of leaving the red LED pins undefined.

    The attached CCS target project is based on the blinky example from the C2000ware software package:  http://dev.ti.com/tirex/#/Device/F28377S/?link=Software%2FC2000Ware%2FEnglish%2FDevices%2FF28377S%2FExamples%2FBitfield%2Fblinky 

    Please let me know if you have any questions or run into any problems.

    Thanks for your help identifying the problem!

    Regards,

     Brian

    blinky_cpu01_Flash.zip

  • Thanks Brian,

    worked like a charm!