-
-
Notifications
You must be signed in to change notification settings - Fork 754
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ESP32 IDF4 Build - I2C.Setup function results in Invalid Arguments on clock speed #2589
Comments
This link seems to identify the problem. i2c_get_clk_src() proides clock selection functionality in the IDF V4.4 for the specific device.. |
testing is WIP |
Thanks! This all looks good - if you could get your changes as a PR (or just a patch I can apply) that'd be great. On the I2C pin front, on STM32 where we have a similar situation of hard-coded pins, we have a checkPinsForDevice function which calls So I think you could do:
Which would work if the pininfo file was correct - I'm not sure it is right now, I think we only do UART: https://github.com/espruino/Espruino/blob/master/boards/ESP32.py#L187-L190 But it would be a nice one to fix, as it's also used for the nice graphics in https://www.espruino.com/ESP32#gpio-pins - for example the one for an STM32 board shows what peripherals are where: https://www.espruino.com/Pico#pinout |
Thanks,Working toward PR. |
Thanks! I've just pushed changes that add the relevant data for I2C1 - I wasn't too sure about UART/SPI/etc on other boards |
…s to make nicer docs pages, maybe good for #2589) fix default pin for ESP32 SPI2
@gfwilliams reccomendations to use the jshFindPinForFunction() is now working , with his board definition file changes, in my test version with this code: In addition Ive changed ESP32.Py to include pin definitions for I2C2 with : Ive tested the setup in both the ESP32-C3 and ESP32 builds. These test builds are from the action workflows in my github clone of Espruino. The default Pins are now working on both for I2C1 and on the ESP32 for I2C2**. The debug logging you can see in the new I2Csetup function above results in the following test results:
(further test results and PR to follow) |
That looks excellent - thanks for your work on this! |
** regarding the default I2C2 pins on the ESP32. I have made sure that on both I2C1 and I2C2 the default pins have not changed from the previous Espruino builds to avoid any breaking changes. However: With this in mind I would suggest (And will change in my PR) adding this to the documentation for i2c.setup in jswrap-spi_i2c |
Have you been able to test? I would assume with ESP32 that what Espruino did was most likely wrong to begin with - so if you can change it to match what everyone else did I think it would be better to do that than to try and soldier on with nonstandard pins |
Hi , Yes I Did test, and rechecked today. Ive checked with an I2C desplay device including monitoring with a logic analyser. Conclusion as before: On an ESP32 target pre any changes (Espruino 2V24 ) using default (ie no config object passed in I2C.setup() ) , for correct operation a device needs to be wired with SDA on P22 and SCL on 21. This is opposite to the documentation and pinout diagrams ive found. |
Wow, ok - thanks! That's crazy. I wonder what's up with that then... |
An error occurs using espruino in the ESP32-C3 IDF 4 build. when setting up the i2C.
In more detail: When building with the command line:
BOARD=ESP32C3_IDF4 DEBUG=1 make flash
The error occurs when executing the espruino command:
I2C1.setup({scl:D9,sda:D8});
The error text is :
The text was updated successfully, but these errors were encountered: