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.

F28377d GPIO pin not updated properly



Hi,

I tried to toggle the GPIO14 and GPIO15 on each CPU timer 1 interrupt. However it does not work properly.

CASE 1 : Only GPIO15 gives square wave, GPIO14  is always high with glitches

__interrupt void cpu_timer1_isr(void)
{
    CpuTimer1.InterruptCount++;
    if (CpuTimer1.InterruptCount&1)
    {
        EALLOW;
        GpioDataRegs.GPADAT.bit.GPIO14 = 0;
        GpioDataRegs.GPADAT.bit.GPIO15 = 1;
        EDIS;
    }
    else
    {
        EALLOW;
        GpioDataRegs.GPADAT.bit.GPIO14 = 1;
        GpioDataRegs.GPADAT.bit.GPIO15 = 0;
        EDIS;
    }
    EALLOW;
    WdRegs.WDKEY.bit.WDKEY = 0x00AA;
    EDIS;
}

CASE 2 : Only GPIO14 gives square wave, GPIO15  is always low with glitches

__interrupt void cpu_timer1_isr(void)
{
    CpuTimer1.InterruptCount++;
    if (CpuTimer1.InterruptCount&1)
    {
        EALLOW;
        GpioDataRegs.GPADAT.bit.GPIO15 = 1;
        GpioDataRegs.GPADAT.bit.GPIO14 = 0;
        EDIS;
    }
    else
    {
        EALLOW;
        GpioDataRegs.GPADAT.bit.GPIO15 = 0;
        GpioDataRegs.GPADAT.bit.GPIO14 = 1;
        EDIS;
    }
    EALLOW;
    WdRegs.WDKEY.bit.WDKEY = 0x00AA;
    EDIS;
}

CASE 3:  Both the GPIO14 & GPIO15 are square wave

__interrupt void cpu_timer1_isr(void)
{
    CpuTimer1.InterruptCount++;
    if (CpuTimer1.InterruptCount&1)
    {
        EALLOW;
        GpioDataRegs.GPADAT.all =  0x00008000;
        EDIS;
    }
    else
    {
        EALLOW;
        GpioDataRegs.GPADAT.all =  0x00004000;
        EDIS;
    }
    EALLOW;
    WdRegs.WDKEY.bit.WDKEY = 0x00AA;
    EDIS;
}

CASE 4:  None of the GPIO14 & GPIO15 are square wave

__interrupt void cpu_timer1_isr(void)
{
    CpuTimer1.InterruptCount++;
    if (CpuTimer1.InterruptCount&1)
    {
        EALLOW;
        GpioDataRegs.GPADAT.all =  (GpioDataRegs.GPADAT.all | 0x00008000);
        EDIS;
    }
    else
    {
        EALLOW;
        GpioDataRegs.GPADAT.all =  (GpioDataRegs.GPADAT.all | 0x00008000);
        EDIS;
    }
    EALLOW;
    WdRegs.WDKEY.bit.WDKEY = 0x00AA;
    EDIS;
}

I could not understand why the cases 1, 2 and 3 are not working properly. Please help.

-Shambhu