ZED-F9P/GPS-RTK2: Sample code for RTCM3 correction data over I2C?

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!

Hi - I don’t have a solution for you yet, but I just wanted to let you know that I’m working on the exact same thing myself. I’ll let you know if I come up with a working solution, primarily from the ‘rover’ side of things since the examples appear to be lacking in that department.

Over in the ublox forum I asked the same question and Clive1 has been trying to help. He recommends assembly the full RTCM3 package rather than bytestreaming. I’m just about done with that code. Once that is done I am going to connect the 2nd GPS to the same ESP32 and read I2C RTCM3 from GPS1 and write Serial RTCM3 full packets to GPS2. If I can get that to work, I’ll move back to the network.

Its kind of strange, the docs make a big deal about how easy this is but I have never ever seen anyone in the forums or the real world that actually has made it work. The only use case that has ever been proven to work is the bluetooth or lora serial stuff where there is no intermediary device.

I doubt this scenario has ever even been tested…

Lets keep each other up to date! Here is my thread over there. In that thread you can find some great clues: https://portal.u-blox.com/s/question/0D … ith-serial