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.

TI RTOS GPIO configure for F28035 (piccolo)

Other Parts Discussed in Thread: SYSBIOS

Hi, I'm trying to create a simple task for 10ms on F28035  wherein I need to toggle the gpio . For this I have created a task, configured gpio and included necessary lib files but not able to generate waveform on the scope. Below is my code:

/*
* ======== main.c ========
*/

#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>
#include "DSP28x_Project.h"

/*
* ======== taskFxn ========
*/
Void taskFxn1(UArg a0, UArg a1)
{
System_printf("enter taskFxn()\n");
GpioDataRegs.GPBTOGGLE.bit.GPIO34 = 1; // Toggle GPIO34

Task_sleep(10);

System_printf("exit taskFxn()\n");

System_flush(); /* force SysMin output to console */
}

/*
* ======== main ========
*/
Int main()

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

// Step 2. Initialize GPIO:
// This example function is found in the DSP2803x_Gpio.c file and
// illustrates how to set the GPIO to it's default state.
//InitGpio(); // Skipped for this example

// Configure GPIO34 as a GPIO output pin
EALLOW;
GpioCtrlRegs.GPBPUD.bit.GPIO34 = 0; // Enable pullup on GPIO34
GpioCtrlRegs.GPBMUX1.bit.GPIO34 = 0;
GpioCtrlRegs.GPBDIR.bit.GPIO34 = 1;
EDIS;


Task_Handle task;
Error_Block eb;

System_printf("enter main()\n");

Error_init(&eb);
task = Task_create(taskFxn1, NULL, &eb);

if (task == NULL) {
System_printf("Task_create() failed!\n");
BIOS_exit(0);
}

BIOS_start(); /* does not return */
return(0);
}

My task function works fine but I'm not able to toggle the GPIO. Is this correct way of configuring GPIO for rtos project? Help needed.

Regards,

Vinod!

  • Hi Kumar,

    Since you're writing directly to a register, there's no reason the scheduler should affect whether or not the GPIO will toggle. Looking at the System Control and Interrupts Reference Guide for your device it looks like you may be setting up the pins incorrectly.

    Section 4.3 discusses the GPIO module and it's configuration, it looks like there's a specific GPIO toggle register that you can use for your purpose.

    Could you try giving that configuration a try and see if you're able to see it toggle?

    For your reference:

    EDIT: Updated the reference to your specific device

    www.ti.com/.../sprugl8c.pdf

    Best,

    Alexander

  • Your task does not have an endless-loop. Just embed both the toggle and sleep instruction into a while(1)-loop and it will work perfect.