Hello,
I am trying to toggle LED on LaunchPad every time when button GPIO12 is pressed. It seems that interrupt is triggered only once. Unfortunately after hours of trying different configurations I didn't had any success. Can somebody tell me what I am doing wrong? The C code and configuration file is listed below.
C code:
#include <xdc/std.h>
#include <xdc/runtime/Log.h>
#include <ti/sysbios/BIOS.h>
#include <ti/sysbios/knl/Task.h>
#include <ti/sysbios/knl/Semaphore.h>
#include <ti/sysbios/family/c28/Hwi.h>
void main()
{
BIOS_start(); /* does not return */
}
unsigned int *GPATOGGLE = (unsigned int*)0x6FC6;
unsigned short int *PIEACK = (unsigned short int*)0x0CE1;
unsigned short int *XINT2CR = (unsigned short*)0x7071;
unsigned int *GPADAT = (unsigned int*)0x6FC0;
unsigned int *GPIOXINT2 = (unsigned int*)0x6FE1;
unsigned int *GPAMUX1 = (unsigned int*)0x6F86;
unsigned int *GPADIR = (unsigned int*)0x6F8A;
unsigned int *GPAPUD = (unsigned int*)0x6F8C;
unsigned short int *PCLKCR3 = (unsigned short int*)0x7020;
Void myTaskFxn(Void)
{
asm(" EALLOW");
*PCLKCR3 |= 1<<13;
*GPAMUX1 = (unsigned int)0;
*GPAPUD |= 0x0000080F;
*GPADIR = 0x0000000F;
*GPIOXINT2 = 12;
*XINT2CR = 0x000D;
asm(" EDIS");
}
Void myIsr(xdc_UArg arg)
{
*GPATOGGLE = 0x000000F;
}
Application configuration:
var Defaults = xdc.module('xdc.runtime.Defaults');
var Main = xdc.useModule('xdc.runtime.Main');
var Startup = xdc.useModule('xdc.runtime.Startup');
var BIOS = xdc.useModule('ti.sysbios.BIOS');
var Timer = xdc.useModule('ti.sysbios.family.c28.Timer');
var Boot = xdc.useModule('ti.catalog.c2800.init.Boot');
BIOS.libType = BIOS.LibType_Custom;
BIOS.assertsEnabled = false;
BIOS.logsEnabled = false;
BIOS.swiEnabled = false;
BIOS.clockEnabled = true;
BIOS.taskEnabled = true;
Program.argSize = 0x0;
Program.stack = 0x100;
BIOS.heapSize = 1024;
BIOS.heapSection = null;
BIOS.runtimeCreatesEnabled = false;
Defaults.common$.diags_ASSERT = xdc.module("xdc.runtime.Diags").ALWAYS_OFF;
BIOS.cpuFreq.lo = 50000000;
Boot.pllcrDIV = 10;
var Task = xdc.useModule('ti.sysbios.knl.Task');
Task.enableIdleTask = true;
var taskParams = new Task.Params();
taskParams.priority = 2;
var myTask = Task.create('&myTaskFxn', taskParams);
var Hwi = xdc.useModule('ti.sysbios.family.c28.Hwi');
Hwi.dispatcherTaskSupport = true;
var hwi0Params = new Hwi.Params();
hwi0Params.enableAck = true;
hwi0Params.arg = 36;
hwi0Params.maskSetting = xdc.module("ti.sysbios.interfaces.IHwi").MaskingOption_SELF;
hwi0Params.disableMask = 0x0;
hwi0Params.restoreMask = 0x0;
hwi0Params.instance.name = "hwi0";
Program.global.hwi0 = Hwi.create(36, "&myIsr", hwi0Params);