How to change and save the I2C address
dizcza opened this issue · 1 comments
dizcza commented
Subject of the issue
The saveConfiguration comments the following docs:
Save current configuration to flash and BBR (battery backed RAM)
This, however, isn't true.
Your workbench
- What development board or microcontroller are you using? ESP32
- What version of hardware or breakout board are you using? NEO-M8P
- How is the breakout board wired to your microcontroller? I2C
- How is everything being powered? YES
Steps to reproduce
myGNSS.setI2CAddress(0x43);
Serial.printf("saveConfiguration %d\n", myGNSS.saveConfiguration()); // prints 1 as expectedThen ping and you should see 0x43. And I do see 0x43 until a power reset, which resets the device address to its default value, 0x42.
Expected behavior
Settings are saved in flash
Actual behavior
Settings are not saved in flash
I noticed that you don't specify the deviceMask and set the packet length to 12. I tried changing your function
// Save current configuration to flash and BBR (battery backed RAM)
// This still works but it is the old way of configuring ublox modules. See getVal and setVal for the new methods
bool SFE_UBLOX_GNSS::saveConfiguration(uint16_t maxWait)
{
packetCfg.cls = UBX_CLASS_CFG;
packetCfg.id = UBX_CFG_CFG;
packetCfg.len = 13;
packetCfg.startingSpot = 0;
// Clear packet payload
memset(payloadCfg, 0, packetCfg.len);
packetCfg.payload[4] = 0b11111; // Set any bit in the saveMask field to save current config to Flash and BBR
packetCfg.payload[5] = 0b11111;
packetCfg.payload[12] = 0b10111;
return (sendCommand(&packetCfg, maxWait) == SFE_UBLOX_STATUS_DATA_SENT); // We are only expecting an ACK
}but this didn't help either.
Any clue?
PaulZC commented
Hi Danylo (@dizcza ),
You are trying to do the saveConfiguration too quickly - before the new address has taken effect. Please look at Example9.
The steps are:
- Change the I2C address with
myGNSS.setI2CAddress(0x43); - Wait 2 seconds
- re-begin the GNSS with the new address (
myGNSS.begin(Wire, 0x43);) myGNSS.saveConfiguration();
I hope this helps,
Paul