u-blox / ubxlib

Portable C libraries which provide APIs to build applications with u-blox products and services. Delivered as add-on to existing microcontroller and RTOS SDKs.
Apache License 2.0
287 stars 82 forks source link

esp idf i2c legacy driver issue #245

Open jimakos96 opened 1 month ago

jimakos96 commented 1 month ago

Hello

I can see on the port/platform/esp-idf/src/u_port_i2c.c that the legacy i2c driver is used for esp-idf , so for now only the legacy i2c driver is used , is there any plan on updating to the new version of driver (i2c_master.h) , because the legacy driver will be deprecated in the future .

RobMeades commented 1 month ago

Hi there: it is indeed on the TODO list; we will probably combine it with moving forward to ESP-IDF 5.2. We can't drop support for the old I2C driver of course, so it will make the ESP-IDF port-layer code a bit messy, and it will need to be done under a compilation switch so as not to break existing users.

Suggest we leave this issue open and then we can updated it when done.

RobMeades commented 3 weeks ago

I've just begun implementing against the new ESP-IDF I2C API, however it seems to be missing one vital feature: it does not permit I2C stop bits to be suppressed. In the old API one had full control over this; we need it in order to determine the number of bytes available in the GNSS device (write 0xFD followed by no stop bit to the GNSS device, read two bytes and that gives you the amount of data it has buffered). Unless I've missed something...?

I have raised a feature request on ESP-IDF: https://github.com/espressif/esp-idf/issues/13952

RobMeades commented 3 weeks ago

FYI, the ESP-IDF I2C API does have that feature, in fact i2c_master_transmit_receive() does exactly that, it just doesn't say that it does that in the API description.

I'm on to the next issue, which is that it doesn't seem possible to implement our uPortI2cAdopt() API on top of the new ESP-IDF I2C API. I have asked (https://github.com/espressif/esp-idf/issues/13968) if Espressif can see a way to do it.

RobMeades commented 3 weeks ago

Hmmm, I'm now hitting a couple more issues which seem to be known and fixed on ESP-IDF main but not yet ported to a release branch:

https://github.com/espressif/esp-idf/issues/13962 https://github.com/espressif/esp-idf/issues/13922

I think we might wait a little while and let it settle down...

RobMeades commented 16 hours ago

FYI, Espressif have now provided an API that allows uPortI2cAdopt() to be implemented, see https://github.com/espressif/esp-idf/commit/992d8bc5f20556adb62571d55a1517a9848d4b51.

Once this, and hopefully the two fixed issues mentioned above, have made it into a tagged ESP-IDF release we will try again.