50 lines
1.6 KiB
Diff
50 lines
1.6 KiB
Diff
|
From d40bb283101fd9cf702e4944865aebef52c34185 Mon Sep 17 00:00:00 2001
|
||
|
From: Djhg2000 <github@djhg2000.net>
|
||
|
Date: Thu, 4 Mar 2021 20:08:12 +0100
|
||
|
Subject: [PATCH] Add a 60ms delay before PWRKEY sequence
|
||
|
|
||
|
This brings the power on sequence in line with the EG25-G Hardware Design
|
||
|
datasheet, which states we need to wait at least 30 ms after VBAT becomes stable
|
||
|
before pulling PWRKEY low (first action of the power on sequene).
|
||
|
|
||
|
After this change the sequence becomes as follows:
|
||
|
- Set RESET_N high
|
||
|
- Wait 60 ms (double 30 ms)
|
||
|
- Execute PWRKEY sequence
|
||
|
|
||
|
60 ms was choosen because we don't know when VBAT becomes stable, but it should
|
||
|
be much less than an additional 30 ms. Empirical evidence suggests PinePhone
|
||
|
units with a healthy battery do not see serious side effects from not doing
|
||
|
this, while the modem will fail to boot and/or throw random errors on boot with
|
||
|
a worn out battery.
|
||
|
---
|
||
|
src/manager.c | 5 +++++
|
||
|
1 file changed, 5 insertions(+)
|
||
|
|
||
|
diff --git a/src/manager.c b/src/manager.c
|
||
|
index aaa3905..a992572 100644
|
||
|
--- a/src/manager.c
|
||
|
+++ b/src/manager.c
|
||
|
@@ -27,6 +27,9 @@
|
||
|
#define EG25_DATADIR "/usr/share/eg25-manager"
|
||
|
#endif
|
||
|
|
||
|
+// Delay between setting GPIO and PWRKEY sequence (60ms)
|
||
|
+#define MODEM_POWERON_DELAY 60000
|
||
|
+
|
||
|
static gboolean quit_app(struct EG25Manager *manager)
|
||
|
{
|
||
|
int i;
|
||
|
@@ -86,6 +89,8 @@ static gboolean modem_start(struct EG25Manager *manager)
|
||
|
|
||
|
if (should_boot) {
|
||
|
g_message("Starting modem...");
|
||
|
+ // Modem might crash on boot (especially with worn battery) if we don't delay here
|
||
|
+ usleep(MODEM_POWERON_DELAY);
|
||
|
gpio_sequence_poweron(manager);
|
||
|
manager->modem_state = EG25_STATE_POWERED;
|
||
|
} else {
|
||
|
--
|
||
|
GitLab
|
||
|
|