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!