mirror of
https://github.com/markqvist/RNode_Firmware.git
synced 2026-04-27 14:30:33 +00:00
Fix I2C bus failure — XPowersLib was using wrong default SDA/SCL pins
Root cause: XPowersAXP2101(Wire) constructor defaults to SDA=8, SCL=9 (from generic esp32s3 variant pins_arduino.h). Its begin() method then calls Wire.begin(8, 9), overriding our Wire.begin(3, 2). All I2C traffic went to the wrong GPIO pins. Fix: pass explicit I2C_SDA, I2C_SCL to the XPowersAXP2101 constructor so it uses GPIO 3/2 (the T-Watch Ultra's actual I2C pins). Also removed I2C diagnostic/recovery code that was debugging the wrong problem.
This commit is contained in:
parent
f024489aee
commit
999933386b
2 changed files with 5 additions and 26 deletions
8
Power.h
8
Power.h
|
|
@ -683,10 +683,12 @@ bool init_pmu() {
|
|||
|
||||
return true;
|
||||
#elif BOARD_MODEL == BOARD_TWATCH_ULT
|
||||
Wire.begin(I2C_SDA, I2C_SCL);
|
||||
|
||||
// Pass explicit SDA/SCL pins to XPowersLib constructor.
|
||||
// The generic esp32s3 FQBN defaults to SDA=8, SCL=9 which are WRONG
|
||||
// for the T-Watch Ultra (SDA=3, SCL=2). XPowersLib's begin() calls
|
||||
// Wire.begin(__sda, __scl) internally, so we must set the correct pins here.
|
||||
if (!PMU) {
|
||||
PMU = new XPowersAXP2101(PMU_WIRE_PORT);
|
||||
PMU = new XPowersAXP2101(PMU_WIRE_PORT, I2C_SDA, I2C_SCL);
|
||||
if (!PMU->init()) {
|
||||
delete PMU;
|
||||
PMU = NULL;
|
||||
|
|
|
|||
|
|
@ -20,13 +20,6 @@
|
|||
#if BOARD_MODEL == BOARD_TWATCH_ULT
|
||||
#include "XL9555.h"
|
||||
#include "CO5300.h"
|
||||
|
||||
// I2C diagnostic storage
|
||||
uint8_t i2c_scan_results[16];
|
||||
uint8_t i2c_scan_count = 0;
|
||||
bool i2c_wire_ok = false;
|
||||
uint8_t i2c_sda_level = 0xFF; // SDA pin level before Wire.begin
|
||||
uint8_t i2c_scl_level = 0xFF; // SCL pin level before Wire.begin
|
||||
#endif
|
||||
|
||||
#define CHANNEL_FIFO_SIZE (CONFIG_UART_BUFFER_SIZE / NUM_CHANNELS)
|
||||
|
|
@ -279,22 +272,6 @@ void setup() {
|
|||
#endif
|
||||
|
||||
#if BOARD_MODEL == BOARD_TWATCH_ULT
|
||||
// I2C scan AFTER PMU init (which calls Wire.begin)
|
||||
i2c_scan_count = 0; // reuse as AXP2101 probe result
|
||||
if (pmu_ready) {
|
||||
// PMU worked — scan for all devices
|
||||
for (uint8_t addr = 0x08; addr < 0x78; addr++) {
|
||||
Wire.beginTransmission(addr);
|
||||
if (Wire.endTransmission() == 0 && i2c_scan_count < 16) {
|
||||
i2c_scan_results[i2c_scan_count++] = addr;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// PMU failed — probe AXP2101 directly for diagnostics
|
||||
Wire.beginTransmission(0x34);
|
||||
i2c_scan_count = Wire.endTransmission(); // store error code
|
||||
}
|
||||
|
||||
xl9555_init();
|
||||
xl9555_enable_lora_antenna();
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue