summaryrefslogtreecommitdiff
path: root/board/servo_micro
diff options
context:
space:
mode:
authorBrian J. Nemec <bnemec@chromium.org>2019-11-11 23:51:35 -0800
committerCommit Bot <commit-bot@chromium.org>2020-01-18 01:16:43 +0000
commit771dd33b149fb94725edf0e29670207b9a013cb6 (patch)
tree295d1dbe58d3c280054ee8bf89ae9345f8205c83 /board/servo_micro
parentc520344abe270967b1bd96d43559fb00c0d431d4 (diff)
downloadchrome-ec-771dd33b149fb94725edf0e29670207b9a013cb6.tar.gz
ServoMicro: Enable Brownout detection with PVD circuit
Enables the programmable voltage detector (PVD) interrupt in ServoMicro. This interrupt fires when the supply voltage drops from the expected 3.3V to under 2.3V after power on. This gives several hundred microseconds of time for the device to respond to the power reduction. In order to ensure that the ServoMicro does not enter a non-responsive state, it triggers a reboot of the system to restore it to a good configuration. BRANCH=servo BUG=chromium:1023715 TEST=Configured GPIO output to trigger on pvd_interrupt() and verified the interrupt fires during the following situations using Saleae analyzer: * USB Power removed from working device * Ramping supply voltage from 1.5V to 5V with a DC supply * Repoducing failure condition from crbug/1016051 1 Connect ServoMicro to Cyan board 2 dut-control power_state:on 3 dut-control fw_wp_vref:pp3300 4 dut-control power_state:off 5 GPIO toggles and system reset occurs Change-Id: I721f48ab84b01d52a5f98747cc9d879ff2876a07 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1911759 Reviewed-by: Ruben Rodriguez Buchillon <coconutruben@chromium.org> Tested-by: Brian Nemec <bnemec@chromium.org> Commit-Queue: Brian Nemec <bnemec@chromium.org> Auto-Submit: Brian Nemec <bnemec@chromium.org>
Diffstat (limited to 'board/servo_micro')
-rw-r--r--board/servo_micro/board.c10
-rw-r--r--board/servo_micro/board.h4
2 files changed, 14 insertions, 0 deletions
diff --git a/board/servo_micro/board.c b/board/servo_micro/board.c
index 7d9bd0bac5..ca97b1fbd7 100644
--- a/board/servo_micro/board.c
+++ b/board/servo_micro/board.c
@@ -13,6 +13,7 @@
#include "queue_policies.h"
#include "registers.h"
#include "spi.h"
+#include "system.h"
#include "task.h"
#include "timer.h"
#include "update_fw.h"
@@ -673,6 +674,15 @@ const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
int usb_i2c_board_is_enabled(void) { return 1; }
+void pvd_interrupt(void) {
+ /* Clear Pending Register */
+ STM32_EXTI_PR = EXTI_PVD_EVENT;
+ /* Handle recovery by rebooting the system */
+ system_reset(0);
+}
+
+DECLARE_IRQ(STM32_IRQ_PVD, pvd_interrupt, HOOK_PRIO_FIRST);
+
/******************************************************************************
* Initialize board.
*/
diff --git a/board/servo_micro/board.h b/board/servo_micro/board.h
index 99fa722fb4..9a0ca5824d 100644
--- a/board/servo_micro/board.h
+++ b/board/servo_micro/board.h
@@ -32,6 +32,10 @@
/* Optional features */
#define CONFIG_STM_HWTIMER32
#define CONFIG_HW_CRC
+#define CONFIG_PVD
+/* See 'Programmable voltage detector characteristics' in the STM32F072x8 Datasheet.
+ PVD Threshold 1 corresponds to a falling voltage threshold of min:2.09V, max:2.27V. */
+#define PVD_THRESHOLD (1)
/* USB Configuration */
#define CONFIG_USB