Skip to content

Commit b65ee93

Browse files
committed
Boot Torch with LoRa.
1 parent 473426c commit b65ee93

File tree

1 file changed

+24
-4
lines changed

1 file changed

+24
-4
lines changed

Firmware/RTK_Everywhere/Begin.ino

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ void identifyBoard()
8181
if (productVariant == RTK_UNKNOWN)
8282
{
8383
// Torch
84-
// Check if a bq40Z50 battery manager is on the I2C bus
84+
// Check if unique ICs are on the I2C bus
8585
if (i2c_0 == nullptr)
8686
i2c_0 = new TwoWire(0);
8787
int pin_SDA = 15;
@@ -90,10 +90,26 @@ void identifyBoard()
9090
i2c_0->begin(pin_SDA, pin_SCL); // SDA, SCL
9191
// 0x0B - BQ40Z50 Li-Ion Battery Pack Manager / Fuel gauge
9292
bool bq40z50Present = i2cIsDevicePresent(i2c_0, 0x0B);
93+
94+
// 0x5C - MP2762A Charger
95+
bool mp2762aPresent = i2cIsDevicePresent(i2c_0, 0x5C);
96+
97+
// 0x08 - HUSB238 - USB C PD Sink Controller
98+
bool husb238Present = i2cIsDevicePresent(i2c_0, 0x08);
99+
93100
i2c_0->end();
94101

95-
if (bq40z50Present)
102+
if (bq40z50Present || mp2762aPresent || husb238Present)
96103
productVariant = RTK_TORCH;
104+
105+
if (productVariant == RTK_TORCH && bq40z50Present == false)
106+
systemPrintln("Error: Torch ID'd with no BQ40Z50 present");
107+
108+
if (productVariant == RTK_TORCH && mp2762aPresent == false)
109+
systemPrintln("Error: Torch ID'd with no MP2762A present");
110+
111+
if (productVariant == RTK_TORCH && husb238Present == false)
112+
systemPrintln("Error: Torch ID'd with no HUSB238 present");
97113
}
98114

99115
if (productVariant == RTK_UNKNOWN)
@@ -202,7 +218,8 @@ void beginBoard()
202218

203219
pin_GNSS_TimePulse = 39; // PPS on UM980
204220

205-
pin_muxA = 18; // Controls U12 switch between ESP UART1 to UM980 or LoRa
221+
pin_muxA = 18; // Controls U12 switch between ESP UART1 to UM980 UART3 or LoRa UART0
222+
pin_muxB = 12; // Controls U18 switch between ESP UART0 to LoRa UART2 or UM980 UART1
206223
pin_usbSelect = 21;
207224
pin_powerAdapterDetect = 36; // Goes low when USB cable is plugged in
208225

@@ -253,7 +270,10 @@ void beginBoard()
253270
digitalWrite(pin_usbSelect, HIGH); // Keep CH340 connected to USB bus
254271

255272
pinMode(pin_muxA, OUTPUT);
256-
digitalWrite(pin_muxA, LOW); // Keep ESP UART1 connected to UM980
273+
muxSelectUm980(); // Connect ESP UART1 to UM980
274+
275+
pinMode(pin_muxB, OUTPUT);
276+
muxSelectCh340(); // Connect ESP UART0 to CH340 Serial
257277

258278
settings.dataPortBaud = 115200; // Override settings. Use UM980 at 115200bps.
259279

0 commit comments

Comments
 (0)