I have had both M3 and C28 blinky examples working. I also modified each to include the other red LED to alternate the on off setting of each LED. While the addition of code to add the second LED was straight forward and as expected on the M3, the C28 was quite different. I found that instead of simply insert a second line here and there to turn the other LED on and off, I had to add a delay between the two LED directed instructions to get the thing to work properly. Without the delay, the code just lease one LED permanently on and blinks the other. I suspect, without the delay I am creaming a register or some such thing. Can anyone shed some light on this? Thanks
PS here are excerpts from c_28 and M3 blinky respectively
C28
EALLOW;
GpioG1CtrlRegs.GPCDIR.bit.GPIO70 = ~0;
EALLOW; // stuck in a second EALLOW think it might only apply to the instruction directly following
GpioG1CtrlRegs.GPCDIR.bit.GPIO71 = ~0;
EDIS;
GpioG1DataRegs.GPCDAT.bit.GPIO70 = 0;// turn off LED
EDIS; // stuck in a second EDIS for the same reason
GpioG1DataRegs.GPCDAT.bit.GPIO71 = 0;// turn on LED
GpioG1DataRegs.GPCDAT.bit.GPIO70 = ~0;
for(delay = 0; delay < 20; delay++)
{ // I had to add this delay to get it to work
}
GpioG1DataRegs.GPCDAT.bit.GPIO71 = 0;
M3
GPIOPinTypeGPIOOutput(GPIO_PORTC_BASE, GPIO_PIN_6);
GPIOPinWrite(GPIO_PORTC_BASE, GPIO_PIN_6, 0);
GPIOPinTypeGPIOOutput(GPIO_PORTC_BASE, GPIO_PIN_7);
GPIOPinWrite(GPIO_PORTC_BASE, GPIO_PIN_7, ~0);