Skip to content

Commit 4580dce

Browse files
committed
Example34 - poll UBX-MON-VER to kickstart I2C
1 parent 729f5cc commit 4580dce

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

examples/Basics/Example34_I2C_Serial_Passthrough/Example34_I2C_Serial_Passthrough.ino

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ uint8_t uartI2cRingBuffer[ringBufferSize];
5050
uint16_t uartI2cBufferHead = 0;
5151
uint16_t uartI2cBufferTail = 0;
5252

53-
const unsigned long uartI2cSendInterval_ms = 50;
53+
const unsigned long uartI2cSendInterval_ms = 5;
5454
unsigned long uartI2cLastSend_ms = 0;
5555
const uint16_t uartI2cSendLimit = 16;
5656

57-
const unsigned long i2cUartSendInterval_ms = 50;
57+
const unsigned long i2cUartSendInterval_ms = 5;
5858
unsigned long i2cUartLastSend_ms = 0;
5959
const uint16_t i2cUartSendLimit = 16;
6060

@@ -66,12 +66,19 @@ const uint16_t i2cReadLimit = 16;
6666
void setup()
6767
{
6868

69-
delay(1000); // Wait for ESP32 to start up
69+
delay(2000); // Wait for ESP32 and GNSS to start up
7070

7171
mySerial.begin(115200); // Baud rate for u-center
7272

7373
myWire.begin(); // Start I2C
7474
myWire.setClock(400000); // 400kHz
75+
76+
// Give I2C a kickstart - if needed. Request UBX-MON-VER
77+
const uint8_t pollUbxMonVer[] = { 0xB5, 0x62, 0x0A, 0x04, 0x00, 0x00, 0x0E, 0x34 };
78+
for (int i = 0; i < (sizeof(pollUbxMonVer) / sizeof(uint8_t)); i++) {
79+
addToUartI2cBuffer(pollUbxMonVer[i]);
80+
}
81+
7582
} // /setup
7683

7784
void loop()
@@ -147,6 +154,7 @@ void loop()
147154
i2cUartLastSend_ms = millis();
148155
}
149156
}
157+
150158
} // /loop
151159

152160
// Read how many bytes are available in the GNSS I2C buffer.

0 commit comments

Comments
 (0)