-
Notifications
You must be signed in to change notification settings - Fork 25
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
Thank you so much for great lib, I cannot figure out I2C RD/WR. #66
Comments
Sorry, but I can't help you with this. Although I started py-esp32-ulp, I did not practically use it much myself. |
I have not tried I2C from the ULP yet, so I can perhaps try to give some pointers, rather than a concrete answer. Your code snippet looks like it might have been derived from this code https://github.com/wardjm/esp32-ulp-i2c/blob/master/ulp.s . Note that the Arduino code is doing some initialisations, that might be needed. From a quick glance it feels like the initialisations are basically a copy of what is in the ULP code, but maybe you can find something in the init code that is missing from the ULP code. Init code that writes to peripheral registers also works when executed by the ULP - but you might need to dig a bit into the macros/functions used (such as The other pointer I can give, is that there exist a "bit-banged" implementation of I2C in ULP code. See: https://github.com/tomtor/ulp-i2c . Here the I2C protocol is essentially implemented in ULP code. The implementation uses assembler macros, which py-esp32-ulp does not support (yet?), so you would have to "manually expand" the macro calls to get it to run. The ULP is quite a challenge to work with - a lot of trial and error involved. But there is a "compat test" in our test suite, which verifies that the I2C_RD opcode results in the same binary output as the "official" binutils-esp32-ulp assembler from Espressif would have output. So I would assume we're generating the right machine code. Would be good to hear how you progress with this. |
Thank you so much! It is honor to have a good advice from both of owner and contributor. Great thanks to you, again. |
@sam0910 Did you ever get I2C to work from the ULP? |
It has been a year ago, time goes so fast. by the way congrats! it is public micropython repo. |
There is now a disassembler in this project (see Perhaps you can use that to disassemble the ulp binary, which https://github.com/tomtor/ulp-i2c (bit banged I2C) builds, to see how it's done there, or to get the assembly code as it was expanded by the macros. |
I've notified the disassembler by github notification, but I didn't know that is used for. |
@sam0910 I see you closed this issues. Does that mean that you managed to get a bit-banged implementation (or something else) to work? Did the disassembler help you? It would be great if you could share some hints as to what you got working and maybe how - I am sure others following this repo would also be interested. |
Greetings!
Thank you for the great lib for micropython.
I could have done many things with your lib, controlling lcd brightness during deepsleep,
communicate with between ULP and main core. It is so great!
I've asked in micropython forum, But I cannot still firgure out hot to get the I2C RD/WR.
I've got some sensors which doesn't have interrupts, I would like to wirte and read a single byte.
Referring the ESP32 technical reference manual,
, intializing I2C connection, but it doesn't work.
Could you please help me to get there?
The text was updated successfully, but these errors were encountered: