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.

TMS320F28335: LED blink with SYSBIOS

Part Number: TMS320F28335

I am using CCS 8.3 + SYS/BIOS 6.76. I am trying to blink LED with 28335 evaluation board.

Due to some limitations on this forum, I cannot post the full package. Some files are removed (I think which are not important, but keep all codes).

1. I tried this with bare-metal project. It works as expected.

2. I tried with SYS/BIOS, the application itself seems running properly (by outputing to CCS console periodically Task running ...), but the LED state remains unchanged.

So could you please help me check where is wrong in SYS/BIOS implementation? The specific may differ with your configuration, so please update if necessary.

Many thanks.

  • 1256.app.cfg

    #include <xdc/std.h>
    #include <xdc/runtime/Error.h>
    #include <xdc/runtime/System.h>
    #include <ti/sysbios/BIOS.h>
    #include <ti/sysbios/knl/Task.h>
    
    void LED_Init(void)
    {
        EALLOW;
        GpioCtrlRegs.GPAMUX1.bit.GPIO4 = 0;
        GpioCtrlRegs.GPADIR.bit.GPIO4 = 1;
        GpioCtrlRegs.GPAMUX1.bit.GPIO5 = 0;
        GpioCtrlRegs.GPADIR.bit.GPIO5 = 1;
        GpioCtrlRegs.GPAMUX1.bit.GPIO6 = 0;
        GpioCtrlRegs.GPADIR.bit.GPIO6 = 1;
        GpioCtrlRegs.GPAMUX1.bit.GPIO7 = 0;
        GpioCtrlRegs.GPADIR.bit.GPIO7 = 1;
        EDIS;
    }
    
    Void taskFxn(UArg a0, UArg a1)
    {
        System_printf("Task started ...\n");
        System_flush();
    
        LED_Init();
    
        while (1)
        {
            GpioDataRegs.GPATOGGLE.bit.GPIO4 = 1; // Toggle GPIO0 once per 500 milliseconds
            GpioDataRegs.GPATOGGLE.bit.GPIO5 = 1; // Toggle GPIO1 once per 500 milliseconds
            GpioDataRegs.GPATOGGLE.bit.GPIO6 = 1; // Toggle GPIO2 once per 500 milliseconds
            GpioDataRegs.GPATOGGLE.bit.GPIO7 = 1; // Toggle GPIO3 once per 500 milliseconds
    
            Task_sleep(1000);
    
            System_printf("Task running ...\n");
            System_flush();
        }
    
        System_printf("Task Done.\n");
    
        System_flush();
    }
    
    Int main()
    {
        // Initialize the peripheral clocks
        InitPeripheralClocks();
    
        Task_Handle task;
        Error_Block eb;
    
        Error_init(&eb);
        task = Task_create(taskFxn, NULL, &eb);
        if (task == NULL)
        {
            System_printf("Failed to create task. Stop.\n");
            BIOS_exit(0);
        }
    
        BIOS_start();
    
        return(0);
    }
    
    #include "DSP2833x_Device.h"     // DSP2833x Headerfile Include File
    #include "DSP2833x_Examples.h"   // DSP2833x Examples Include File
    
    void main(void)
    {
        // Step 1. Initialize System Control:
        // PLL, WatchDog, enable Peripheral Clocks
        // This example function is found in the DSP2833x_SysCtrl.c file.
        InitSysCtrl();
    
        // Step 2. Initalize GPIO:
        // This example function is found in the DSP2833x_Gpio.c file and
        // illustrates how to set the GPIO to it's default state.
        // InitGpio();  // Skipped for this example
    
    
        // 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 DSP2833x_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 DSP2833x_DefaultIsr.c.
        // This function is found in DSP2833x_PieVect.c.
        //   InitPieVectTable();
    
        // Interrupts that are used in this example are re-mapped to
        // ISR functions found within this file.
        //   EALLOW;  // This is needed to write to EALLOW protected registers
        //   PieVectTable.TINT0 = &cpu_timer0_isr;
    
        //   Count = 0;					//��ʼ������
        //   Flag=0;
    
        //   EDIS;    // This is needed to disable write to EALLOW protected registers
    
        // Step 4. Initialize the Device Peripheral. This function can be
        //         found in DSP2833x_CpuTimers.c
        //   InitCpuTimers();   // For this example, only initialize the Cpu Timers
        #if (CPU_FRQ_150MHZ)
        // Configure CPU-Timer 0 to interrupt every 500 milliseconds:
        // 150MHz CPU Freq, 50 millisecond Period (in uSeconds)
        //   ConfigCpuTimer(&CpuTimer0, 150, 500000);
        #endif
        #if (CPU_FRQ_100MHZ)
        // Configure CPU-Timer 0 to interrupt every 500 milliseconds:
        // 100MHz CPU Freq, 50 millisecond Period (in uSeconds)
        //   ConfigCpuTimer(&CpuTimer0, 100, 500000);
        #endif
    
        // 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 (in DSP2833x_CpuTimers.h), the
        // below settings must also be updated.
    
        //   CpuTimer0Regs.TCR.all = 0x4001; // Use write-only instruction to set TSS bit = 0
    
        // Step 5. User specific code, enable interrupts:
    
        // Configure GPIO0-3 as a GPIO output pin
        EALLOW;
        GpioCtrlRegs.GPAMUX1.bit.GPIO4 = 0;
        GpioCtrlRegs.GPADIR.bit.GPIO4 = 1;
        GpioCtrlRegs.GPAMUX1.bit.GPIO5 = 0;
        GpioCtrlRegs.GPADIR.bit.GPIO5 = 1;
        GpioCtrlRegs.GPAMUX1.bit.GPIO6 = 0;
        GpioCtrlRegs.GPADIR.bit.GPIO6 = 1;
        GpioCtrlRegs.GPAMUX1.bit.GPIO7 = 0;
        GpioCtrlRegs.GPADIR.bit.GPIO7 = 1;
        EDIS;
    
        // Enable CPU INT1 which is connected to CPU-Timer 0:
        //   IER |= M_INT1;
    
        // Enable TINT0 in the PIE: Group 1 interrupt 7
        //   PieCtrlRegs.PIEIER1.bit.INTx7 = 1;
    
        // 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(;;)
        {
            GpioDataRegs.GPATOGGLE.bit.GPIO4 = 1; // Toggle GPIO0 once per 500 milliseconds
            GpioDataRegs.GPATOGGLE.bit.GPIO5 = 1; // Toggle GPIO1 once per 500 milliseconds
            GpioDataRegs.GPATOGGLE.bit.GPIO6 = 1; // Toggle GPIO2 once per 500 milliseconds
            GpioDataRegs.GPATOGGLE.bit.GPIO7 = 1; // Toggle GPIO3 once per 500 milliseconds
    
            DELAY_US(100000);
        }
    }
    

  • I'm not spotting any issues in your code. Can  you take a screen capture of your GPIO configuration registers in the working non-BIOS project and compare it to the configuration registers in the BIOS project? Are you seeing any errors in ROV in the BIOS project?

    Thanks,

    Whitney