Skip to content

Commit ef27cea

Browse files
committed
nRF52: Bootloader now doesn't reset RESETREAS
nRF52: If we reboot because of LOCKUP, don't enable DCDC converter Bangle.js2: Test screen now fails if no DCDC enabled
1 parent 49c60d8 commit ef27cea

File tree

5 files changed

+18
-10
lines changed

5 files changed

+18
-10
lines changed

ChangeLog

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
Fix escaping of `\r` in built-in modules, fixed regression that stopped Espruino WiFi 2v25 from connecting to Wifi
44
BLE: always return privacy info from NRF.getSecurityStatus(), regardless of connection state
55
Linux SDL build: mouse events now create `E.on("touch"` events like on CYD
6+
nRF52: Bootloader now doesn't reset RESETREAS
7+
nRF52: If we reboot because of LOCKUP, don't enable DCDC converter
8+
Bangle.js2: Test screen now fails if no DCDC enabled
69

710
2v25 : ESP32C3: Get analogRead working correctly
811
Graphics: Adjust image alignment when rotating images to avoid cropping (fix #2535)

libs/js/banglejs/Bangle_showTestScreen.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,12 @@
3434
var av = analogRead(D3), v=av*13.359;
3535
chg |= Bangle.isCharging();
3636
if (av>mv) cup=1;
37-
draw(8,'Chg',v.toFixed(2)+"v "+(Bangle.isCharging()?"charge":"discharge"),chg&&cup&&(v>2)&&(v<4.4));
37+
var ok = chg&&cup&&(v>2)&&(v<4.4), msg = v.toFixed(2)+"v "+(Bangle.isCharging()?"charge":"discharge");
38+
if (!peek32(0x40000578)) { // DCDCEN
39+
msg = "NO DCDC";
40+
ok = false;
41+
}
42+
draw(8,'Chg',msg,ok);
3843
},500);
3944
},1000);
4045
Bangle.on('swipe', e => {

libs/js/banglejs/Bangle_showTestScreen.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

targets/nrf5x/bluetooth.c

+8-4
Original file line numberDiff line numberDiff line change
@@ -2636,10 +2636,14 @@ static void ble_stack_init() {
26362636
NRF_SDH_SOC_OBSERVER(m_soc_observer, APP_SOC_OBSERVER_PRIO, soc_evt_handler, NULL);
26372637
#endif
26382638

2639-
#if defined(PUCKJS) || defined(RUUVITAG) || defined(ESPR_DCDC_ENABLE)
2640-
// can only be enabled if we're sure we have a DC-DC
2641-
err_code = sd_power_dcdc_mode_set(NRF_POWER_DCDC_ENABLE);
2642-
APP_ERROR_CHECK(err_code);
2639+
#if defined(ESPR_DCDC_ENABLE)
2640+
if (!(NRF_POWER->RESETREAS & POWER_RESETREAS_LOCKUP_Msk)) {
2641+
/* If we previously booted and got a LOCKUP reset, this could well be due to a DCDC
2642+
converter issue, so don't enable DCDC if that's the case. */
2643+
// can only be enabled if we're sure we have a DC-DC
2644+
err_code = sd_power_dcdc_mode_set(NRF_POWER_DCDC_ENABLE);
2645+
APP_ERROR_CHECK(err_code);
2646+
}
26432647
#endif
26442648
#if defined(ESPR_DCDC_HV_ENABLE)
26452649
err_code = sd_power_dcdc0_mode_set(NRF_POWER_DCDC_ENABLE);

targets/nrf5x_dfu/main.c

-4
Original file line numberDiff line numberDiff line change
@@ -396,8 +396,6 @@ int main(void)
396396
} else {
397397
// DICKENS: Enter bootloader only if BTN2 held as well
398398
if (!get_btn2_state()) {
399-
// Clear reset reason flags
400-
NRF_POWER->RESETREAS = 0xFFFFFFFF;
401399
#ifdef ESPR_BOOTLOADER_SPIFLASH
402400
lcd_init();
403401
#ifndef DICKENS
@@ -427,8 +425,6 @@ int main(void)
427425
while (*reasons) reasons++;
428426
reasons++;
429427
}
430-
// Clear reset reason flags
431-
NRF_POWER->RESETREAS = 0xFFFFFFFF;
432428
print_fw_version();
433429
#ifdef ESPR_BOOTLOADER_SPIFLASH
434430
if (!get_btn1_state()) flashCheckAndRun();

0 commit comments

Comments
 (0)