sparkfun / SparkFun_u-blox_GNSS_v3

An Arduino library which allows you to communicate seamlessly with u-blox GNSS modules using the Configuration Interface
Other
55 stars 24 forks source link

SPI connection F9R ESP #20

Closed NicoZobernig closed 1 year ago

NicoZobernig commented 1 year ago

Hello,

We are trying to get the GPS Dead Reckoning ZED-F9R breakout board to connect via SPI with an ESP32 Wrover module but are not having any success, we receive the error that the GNSS module cannot be detected. It works well using I2C. We have shorted the SPI connector pads on the back of the module and have ensured that everything is hooked up correctly. We have also switched to SFE_UBLOX_GNSS_SPI.

We have tried the standard example and have also tried modifying the code like this:

SPI.begin(SCK, MISO, MOSI, SS);
SPI.setFrequency(myClockSpeed);
ESP_LOGI("SPI", "Trying SPI");
while (moto_gps.begin(SPI, SS, 4000000) == false) {
    ESP_LOGI("SPI", "u-blox GNSS not detected. Retrying...");
    delay(1000);
}

Has anyone had any success running the SPI example with an esp32 and the zed-f9r? Any help would be greatly appreciated.

Thanks! Nico

PaulZC commented 1 year ago

Hi Nico (@NicoZobernig ),

I have seen modules where they are 'reluctant' to go into SPI mode if they have been used previously for I2C / UART. I think it has something to do with the port or message configuration - stored in battery-backed RAM and/or Flash.

I suggest connecting the F9R board to a Windows PC via USB and use u-center to reset the module back to its default settings. You do this using UBX-CFG-CFG. More details are here: https://github.com/sparkfun/SparkFun_u-blox_GNSS_Arduino_Library/issues/191#issuecomment-1515038572.

You can have both u-center USB and Arduino SPI connected at the same time. Leave your Arduino code running and leave the Serial Monitor open, do the reset, and you should see the Arduino code begin.

Please close this issue if this solves your problem.

Best wishes, Paul

shecker commented 1 year ago

Hi Paul (@PaulZC)

Thank you for the quick reply! We are able to connect via SPI by resetting the board via u-center however the connection is very unstable in the sense that it takes around 20 tries until it can establish a connection with the module and sometimes fails completely. Is that normal behavior?

Thanks, Simon

PaulZC commented 1 year ago

Hi Simon,

No, that's not normal...

I wonder if the POCI (MISO) pin needs a pull-up? Try adding a 10K pull-up resistor between POCI (MISO) and 3.3V. Does that make any difference?

If not, try analyzing the SPI traffic using a logic analyzer. Any clues there?

Best wishes, Paul

PaulZC commented 1 year ago

Also check you have opened the I2C pull-up resistor jumpers.

shecker commented 1 year ago

Hi Paul

We will try with the 10K pull-up resistor. Regarding the I2C pull-up resistors, these are open by default / factory correct, so as long as we didn't close them they should be fine?

Thanks, Simon

PaulZC commented 1 year ago

Yes, that should be fine. The jumpers were normally-closed on the earliest boards, but we later switched to normally-open.

Hope all is well in Switzerland, Best, Paul

shecker commented 1 year ago

Hi Paul, I added a 100K pull-down to POCI (MISO), that seems to have done the trick, thanks! Yes all is well in Switzerland, we had some busy integration weeks but things are coming together. Hope all is well with you as well! Best, Simon

PaulZC commented 1 year ago

Hi Simon,

All is well here. Busy as usual!

OK - glad that's working for you. But that is a surprise... I thought a pull-up might help. A pull-down shouldn't make any difference. But, if it is working, it is working!

Please check your GND connection. You need to have GND, 3V3 (or 5V), PICO, POCI, SCK and CS connected between the two boards.

Please close this issue if you are happy.

Best, Paul