Been at this off and on for a few months and most of my hair is gone now…
Scenario: Two ZED-F9P connected to their own ESP32’s. One is Rover, the other is Base.
Base can read RTCM3 data and is sending it 1 byte at a time over wifi to the other ESP32
void SFE_UBLOX_GPS::processRTCM(uint8_t incoming)
{
sendData(incoming);
}
void sendData(uint8_t incoming)
{
int msg_time = millis();
memcpy(&myData.message_time, &msg_time, sizeof(unsigned int));
memcpy(&myData.gpsdata, &incoming, sizeof(uint8_t));
esp_err_t result = esp_now_send(slave.peer_addr, (uint8_t *)&myData, sizeof(myData));
}
typedef struct
{
uint8_t buf[ESP_NOW_PACKET_SIZE]; /*!< Packet data */
int len; /*!< Packe t size in bytes. */
} esp_now_packet_t;
On my Rover this data arrives one byte at a time without error.
void OnDataRecv(const uint8_t *mac_addr, const uint8_t *incomingData, int data_len)
{
memcpy(&myData, incomingData, sizeof(myData));
// SEND TO ROVER GPS MODULE. THIS IS WHERE MY HAIR HAS GONE
}
My problem is that I can’t seem to get the data to the Rover GPS-RTK2. When I push it one byte at a time over Serial to UART1 or UART2, U-Center is not showing any increase in bytes received. My Serial looks like this:
And my Serial code looks like this:
static const int RXpin = 15, TXpin = 14;
static const uint32_t GPSBaud = 115200;
SoftwareSerial S2(RXpin, TXpin);
void setup() {
... ...
S2.begin(GPSBaud);
S2.flush();
}
void serialGPSUpdate(uint8_t incoming){
S2.write(incoming);
}
Result: ESP32 thinks it writing but the GPS is not paying attention. Byte counts over UART1 do not increment (same for UART2).
So I want to move to I2C and am hoping it works better for me but can’t find any solid examples of RTCM3 piped over I2C.
I am also making the big assumption that I can just stream the bytes from Base:processRTCM->Wifi->Rover:Send Byte to GPS and that I don’t have to assemble packets or frames. The docs say that you can do this and when I connect GPS serials directly together it immediately gets a fix. This tells me I should be able to just flood bytes at the GPS and have it do the right thing.
So, anyone have any I2C code? I suspect I am doing something very basic wrong here.
Tx!