Part Number: AM3358
Tool/software: Code Composer Studio
I am a BeagleBone Black Noob. I have to modify an existing, working, project to respond to an external interrupt on GPIO0.4
The basic project works well - I am using CCS 7,3,0.00019 and programming and debugging using a Segger J-link
I have modified the working routine "ioinit()" by adding the lines you see suffixed with "//steve"
In addition, these other subroutine calls are in the body of the program
IntAINTCInit();//called before the ioinit()
IntMasterIRQEnable();//is called after
I would be grateful is anyone can find where I am going wrong.
I get no compile errors, just no interrupt!
Thanks
steve robinson
This is the modified "ioinit()"......
void ioInit(void)
{
//Enable clocks for GPIO1 instance
GPIO1ModuleClkConfig();
GPIO0ModuleClkConfig();//steve
//Enable GPIO1 module
GPIOModuleEnable(SOC_GPIO_1_REGS);
GPIOModuleEnable(SOC_GPIO_0_REGS);//steve
//Configure LED1 as a GPIO (GPIO1_21/GPMC_A5)
HWREG(SOC_CONTROL_REGS + CONTROL_CONF_GPMC_A(5)) = CONTROL_CONF_MUXMODE(7);
//Configure LED2 as a GPIO (GPIO1_22/GPMC_A6)
HWREG(SOC_CONTROL_REGS + CONTROL_CONF_GPMC_A(6)) = CONTROL_CONF_MUXMODE(7);
//Configure LED3 as a GPIO (GPIO1_23/GPMC_A7)
HWREG(SOC_CONTROL_REGS + CONTROL_CONF_GPMC_A(7)) = CONTROL_CONF_MUXMODE(7);
//Configure LED4 as a GPIO (GPIO1_24/GPMC_A8)
HWREG(SOC_CONTROL_REGS + CONTROL_CONF_GPMC_A(8)) = CONTROL_CONF_MUXMODE(7);
HWREG(SOC_CONTROL_REGS + GPIO_0_4) = CONTROL_CONF_MUXMODE(7);//steve
//steve Configure it as an input
GPIODirModeSet(SOC_GPIO_0_REGS, 4, GPIO_DIR_INPUT);//steve
GPIOPinIntEnable(SOC_GPIO_0_REGS, GPIO_INT_LINE_1, 4);//steve
GPIOIntTypeSet(SOC_GPIO_0_REGS,4, GPIO_INT_TYPE_FALL_EDGE);//steve
IntSystemEnable(SYS_INT_GPIOINT0A);//steve
IntPrioritySet(SYS_INT_GPIOINT0A, 3, AINTC_HOSTINT_ROUTE_IRQ);//steve
IntRegister(SYS_INT_GPIOINT0A, gpio0Isr);//steve
//Configure LED1 as an output
GPIODirModeSet(SOC_GPIO_1_REGS, 21, GPIO_DIR_OUTPUT);
//Configure LED2 as an output
GPIODirModeSet(SOC_GPIO_1_REGS, 22, GPIO_DIR_OUTPUT);
//Configure LED3 as an output
GPIODirModeSet(SOC_GPIO_1_REGS, 23, GPIO_DIR_OUTPUT);
//Configure LED4 as an output
GPIODirModeSet(SOC_GPIO_1_REGS, 24, GPIO_DIR_OUTPUT);
}
.........and this is my service routine
static void gpio0Isr(void)
{
//clear interrupt
GPIOPinIntClear(SOC_GPIO_0_REGS,0,4);
GPIOPinIntEnable(SOC_GPIO_0_REGS,0,4);
GPIOPinIntWakeUpEnable(SOC_GPIO_0_REGS,0,4);
GPIOPinWrite(SOC_GPIO_1_REGS, 23, GPIO_PIN_HIGH);//just to see if it happens
}