Skip to content
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

Enabling RMT/semaphores in complex code can cause analogread to return values 2x too big #290

Closed
marcmerlin opened this issue Mar 28, 2017 · 6 comments

Comments

@marcmerlin
Copy link
Contributor

As first reported here MartyMacGyver/ESP32-Digital-RGB-LED-Drivers#7
using the RMT neopixel driver causes analogread to return 4096 for 50%-100% and proper values from 0 to 50%.
Sadly if you are sampling data that needs to go in the 50 to 100% range (joystick), it's impossible to get usable data.
If i comment out just these 3 lines of code, then analogread works properly again:
//RMT.conf_ch[RMTCHANNEL].conf1.mem_rd_rst = 1;
//RMT.conf_ch[RMTCHANNEL].conf1.tx_start = 1;
//xSemaphoreTake(ws2812_sem, portMAX_DELAY);

@projectgus
Copy link
Contributor

projectgus commented Mar 28, 2017

This feels like it could be a power glitch. Do you still see the bug if you reconfigure RMT to use a different pin which isn't connected to RGB LEDs?

@marcmerlin
Copy link
Contributor Author

marcmerlin commented Mar 28, 2017

example code showing the failure: marcmerlin/IoTuz@305b9f7
@projectgus sure, I just tried this:

--- a/IoTuz.cpp
+++ b/IoTuz.cpp
@@ -378,7 +378,7 @@ void IoTuz::begin()
     //pixels.setPixelColor(0, 10, 10, 10);
     //pixels.show();
 #else
-    ws2812_init(RGB_LED_PIN, LED_WS2812B);
+    ws2812_init(0, LED_WS2812B);

I still get:
Analogread test before LEDs enabled, returns 1780 or so): 1767
Turning on LEDs
Before colors
After colors
Analogread test after LEDs enabled, returns 3 if RMT is turned on): 3

@marcmerlin
Copy link
Contributor Author

marcmerlin commented Apr 4, 2017

Hi @projectgus, since this is likely a platform problem (can't tell if it's arduino-esp32 or the chip underneath), is there someone this could get assigned to?
It would be trivial for you to replicate on your own IoTuz I believe

@projectgus
Copy link
Contributor

Are you able to reproduce this on non-IoTuZ hardware?

@marcmerlin
Copy link
Contributor Author

I will give that a shot since I now have some, and get back to you.

@marcmerlin
Copy link
Contributor Author

I was able to reproduce on WROVER, but I then updated arduino-esp32 again, and as of
commit 2b075f3
Author: Me No Dev me-no-dev@users.noreply.github.com
Date: Tue Apr 4 02:50:27 2017 +0300
the problem is fixed.
I can now use the RMT neopixel library MartyMacGyver/ESP32-Digital-RGB-LED-Drivers
and analogread now returns proper enough looking values
I'm going to mark this closed, thanks @me-no-dev for the newer arduino-esp32

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants