@@ -81,7 +81,7 @@ void identifyBoard()
81
81
if (productVariant == RTK_UNKNOWN)
82
82
{
83
83
// Torch
84
- // Check if a bq40Z50 battery manager is on the I2C bus
84
+ // Check if unique ICs are on the I2C bus
85
85
if (i2c_0 == nullptr )
86
86
i2c_0 = new TwoWire (0 );
87
87
int pin_SDA = 15 ;
@@ -90,10 +90,26 @@ void identifyBoard()
90
90
i2c_0->begin (pin_SDA, pin_SCL); // SDA, SCL
91
91
// 0x0B - BQ40Z50 Li-Ion Battery Pack Manager / Fuel gauge
92
92
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
+
93
100
i2c_0->end ();
94
101
95
- if (bq40z50Present)
102
+ if (bq40z50Present || mp2762aPresent || husb238Present )
96
103
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" );
97
113
}
98
114
99
115
if (productVariant == RTK_UNKNOWN)
@@ -202,7 +218,8 @@ void beginBoard()
202
218
203
219
pin_GNSS_TimePulse = 39 ; // PPS on UM980
204
220
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
206
223
pin_usbSelect = 21 ;
207
224
pin_powerAdapterDetect = 36 ; // Goes low when USB cable is plugged in
208
225
@@ -253,7 +270,10 @@ void beginBoard()
253
270
digitalWrite (pin_usbSelect, HIGH); // Keep CH340 connected to USB bus
254
271
255
272
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
257
277
258
278
settings.dataPortBaud = 115200 ; // Override settings. Use UM980 at 115200bps.
259
279
0 commit comments