Fix problem with ADC at conversion rates above a few hertz (3 or 4Hz) as updated...
authorNathael Pajani <nathael.pajani@ed3l.fr>
Tue, 21 Oct 2014 22:21:08 +0000 (00:21 +0200)
committerNathael Pajani <nathael.pajani@ed3l.fr>
Tue, 8 Nov 2022 16:03:04 +0000 (17:03 +0100)
core/system.c
drivers/adc.c
include/core/system.h

index 5f28188..a11e6ea 100644 (file)
@@ -100,6 +100,9 @@ void system_brown_out_detection_config(uint32_t level)
                sys_ctrl->powerdown_run_cfg |= LPC_POWER_DOWN_BOD;
                lpc_private.brown_out_detection_enabled = 0;
        } else {
+               /* Power on Brown-Out Detection.
+                * (Needed for ADC, See Section 19.2 of UM10441 revision 2.1 or newer for more information) */
+               sys_ctrl->powerdown_run_cfg &= ~(LPC_POWER_DOWN_BOD);
                lpc_private.brown_out_detection_enabled = 1;
                /* Configure Brown-Out Detection */
                /* FIXME */
index 8d4dfc9..fce8721 100644 (file)
@@ -205,6 +205,11 @@ void adc_on(void)
 
        /* Disable ADC Interrupt */
        NVIC_DisableIRQ(ADC_IRQ);
+
+       /* Brown-Out detection must be powered to operate the ADC.
+        * See Section 19.2 of UM10441 revision 2.1 or newer for more information */
+       sys_ctrl->powerdown_run_cfg &= ~LPC_POWER_DOWN_BOD;
+
        /* Power-up ADC */
        sys_ctrl->powerdown_run_cfg &= ~LPC_POWER_DOWN_ADC;
        /* Provide clock to ADC */
index 0ce6faf..8686bd6 100644 (file)
@@ -71,7 +71,10 @@ void enter_deep_sleep(void);
 /* Power on or off a subsystem */
 void subsystem_power(uint32_t power_bit, uint32_t on_off);
 
-/* Configure the brown-out detection */
+/* Configure the brown-out detection.
+ * Note: Brown-Out detection must be powered to operate the ADC (See Section 19.2
+ *    of UM10441 revision 2.1 or newer for more information)
+ */
 void system_brown_out_detection_config(uint32_t level);
 
 /***************************************************************************** */