-
Notifications
You must be signed in to change notification settings - Fork 237
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
Neopixel and Onewire conflict on esp32-c3 #1126
Comments
It looks like a conflict in the RMT support - since both Neopixels and OneWire use that by default. If sounds like you got those using separate RMT channels, so they should operate independently. At least that's my understanding of the ESP-IDF APIs. Is that consistent with your study of this behavior? |
Exactly. I haven't done much with the RMT devices, but I believe I configured things so Neopixel and OW use disjoint hardware. Either there's a bug in one of the C modules or ESP-IDF (or the HW). Update:
|
I spent a couple of hours debugging the RMT issue and have gotten nowhere. The code all looks good and the values I've printed also look good. Next step might be to write an esp-idf C program to try to reproduce the issue. I don't think I can do that now. I also tried to use the OneWire GPIO driver and that doesn't work at all. The way modGPIO is used does not work. For example, to write a '1' the OW driver calls The OW driver also has a bug where the timings are mixed up. Specifically:
This does affect the esp8266 and I remember some issues a few weeks ago... I also noted that none of the OW drivers support reliable operation with parasitically powered devices. For that, when asking devices to "operate", for example, for DS18B20 the convert and copy-scratchpad commands, the master has to actively drive the bus high and not expect that the pull-up resistor will suffice. Whether it works without the active drive depends on voltage level, number of devices on the bus, length of the bus, etc. Update: I 'fixed' modGPIO not to mess with the pin when switching mode and now the OW gpio driver works. (Messing with the pin value when switching modes is a bad feature of modGPIO, but that's a different topic). For reference, the diff for modGPIO is:
|
On support for the parasitically powered devices... I connected 3 parasitically powered DS18B20 to a pin and implemented a "convert all" feature which causes all of them to acquire the temperature at the same time. With a 2.2K pull-up this caused the bus voltage to drop to 1.5, which the devices didn't really like (3.3V is already a bit marginal). I implemented a
|
The support for parasitic power is great. I had looked at that a little while back but obviously didn't get to it. Integrating the changes shouldn't be too bad. I don't see a problem with the ESP8266 support. Is that just noted because you haven't tested it or are you aware of an issue? @colinl was still seeing occasionally failures. I wonder if this would help in his case. I don't think he's using parasitic power, so maybe not, but there is still some degree of magic here so anything seems possible. |
This is a little tangled. The comments in the source code for the constants agrees with you: moddable/modules/drivers/onewire/esp/owb_gpio.c Lines 73 to 76 in 2420f19
But, Application Note 126 from Maxim disagrees. Here's the timing diagram -- A&B are used for "1" and C&D are used for "0" The source code in the Application Note 126 is consistent with the image (see page 5). A + B == C + D == 70, which makes the read and writing durations the same, FWIW. That's the not the case is using A&C and B&D. |
Not so much 'occasional', as 'under certain circumstances'. On a D1 Mini, with one of my sensors, I can make it work reliably but if make an insignificant change to the node red flow (I am using node-red-mcu), such as adding a debug node, then solidly gets null temperature values on that sensor. Going back to the working flow makes it work again. |
LOL! You're correct. I don't think this matters much WRT functioning but would be nice to straighten out. |
See discussion in Moddable-OpenSource#1126 - onewire and neopixel's use of RMT conflict on esp32-c3 even though "it should work". Needs resolving but for now switching to GPIO with a little hack in the GPIO module works too.
See discussion in Moddable-OpenSource#1126 - onewire and neopixel's use of RMT conflict on esp32-c3 even though "it should work". Needs resolving but for now switching to GPIO with a little hack in the GPIO module works too.
Build environment: Linux
Target device: Lolin pico-c3 (similar to Adafruit qtpyc3)
Description
The first use of the onewire bus causes the neopixel to cease functioning. Sometimes XS also hangs or crashes.
Steps to Reproduce
Other information
The manifest sets the RMT channels to be used by OneWire to tx=1 and rx=2 to accomodate the fact that on the C3 channels 0&1 are for tx and 2&3 are for rx. Channel 0 is used by Neopixel. On the onewire pin I see some pulses that don't actually look like a proper reset pulse. Doing a bus.search instead of reset has similar effects.
Editing modonewire.c line 44 to switch the ESP32 to use GPIO makes the Neopixel work normally and I see a reasonable reset pulse and search issues reasonable looking pulses.
main.js:
manifest.json (adapted from the onewire example manifest):
The text was updated successfully, but these errors were encountered: