AnsweredAssumed Answered

LPCOpen bug report

Question asked by Robert Delien on Nov 23, 2016
Latest reply on Nov 24, 2016 by Robert Delien

There's a bug in LPCOpen, switching all peripherals on when trying to switch off one:

lpc_chip_40xx/src/clock_17xx_40xx.c, line 111:

/* Disables power and clocking for a peripheral */
void Chip_Clock_DisablePeriphClock(CHIP_SYSCTL_CLOCK_T clk) {
    uint32_t bs = (uint32_t) clk;

 

#if defined(CHIP_LPC40XX)
    if (bs >= 32) {
        LPC_SYSCTL->PCONP1 &= ~(1 << (bs - 32));
    }
    else {
        LPC_SYSCTL->PCONP |= ~(1 << bs);
    }
#else
    LPC_SYSCTL->PCONP |= ~(1 << bs);
#endif
}

 

Index: lpc_chip_40xx/src/clock_17xx_40xx.c
===================================================================
--- lpc_chip_40xx/src/clock_17xx_40xx.c    (revision 440)
+++ lpc_chip_40xx/src/clock_17xx_40xx.c    (working copy)
@@ -117,7 +117,7 @@
         LPC_SYSCTL->PCONP1 &= ~(1 << (bs - 32));
     }
     else {
-        LPC_SYSCTL->PCONP |= ~(1 << bs);
+        LPC_SYSCTL->PCONP &= ~(1 << bs);
     }
 #else
     LPC_SYSCTL->PCONP |= ~(1 << bs);

Outcomes