-
Yeah I think the ESP32 SDK has been going a bit weird lately -- and you're right its becoming increasingly hard to build something reliable on top of it. Its a bit strange that at version 3 -- Espressif is still introducing breaking changes to their API etc. I also get lots of memory errors and failures when doing http / https requests.
Anyways lets hope as the SDK matures things will get sorted out.
-
I tried it out and it worked (rotation with no crashing). However after, I started adding some intervals for other stuff and the quality of the readings degraded significantly -- it couldn't really figure out when a rotation was happening or not. I would spin it, and the value wouldn't change, but sometimes it would -- kind of unreliable. I guess this is because its using software interrupts? For my build the encoder is important, so I'll probably dedicate a small mcu like an ATTINY85 or an ESP-01 with Arduino on it, just to read the rotation. Then feed that into my ESP32.
-
-
No, we've been through this before here:
http://forum.espruino.com/conversations/325755/
I can wire up an ESP8266 to a rotary encoder and spin it as fast as I can, and nothing bad happens like a reset.
Using this code:
var step = 0; pinMode(NodeMCU.D8,"input_pullup"); pinMode(NodeMCU.D2,"input_pullup"); require("Encoder").connect(NodeMCU.D2,NodeMCU.D8,function (direction) { step += direction; print(step); });
I can do this as long as I want. True I get a "New interpreter error: FIFO_FULL" error, but it doesn't affect anything.
____ _ | __|___ ___ ___ _ _|_|___ ___ | __|_ -| . | _| | | | | . | |____|___| _|_| |___|_|_|_|___| |_| espruino.com 1v99 (c) 2018 G.Williams Espruino is Open Source. Our work is supported only by sales of official boards and donations: http://espruino.com/Donate Flash map 4MB:1024/1024, manuf 0x1c chip 0x3016 >load() =undefined ERROR: Pin state not supported ERROR: Pin state not supported 1 0 1 0 1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 111 112 113 114 New interpreter error: FIFO_FULL 115 116 117 118 119 120 121
So this is about a clear difference between the ESP8266 and the ESP32. It works on the ESP8266, it doesn't on the ESP32.
-=hfc
-
-
Hey Gang,
I know there have been a few goes in Github around the "watch" function (which the rotary encoder module uses behind the scenes), on the ESP32, and generally it works fine for buttons. But when using a full encoder module, such as this one:
https://www.ebay.com/p/5pcs-Ky-040-Rotary-Encoder-Module-for-Arduino-AVR-Pic/1386840178
I get continual restarts on 2v01 (it was the same on previous versions, so its not a regression).
So lets take the standard code from the Espruino example page :
https://www.espruino.com/Encoder
var step = 0; require("Encoder").connect(D26,D25,function (direction) { step += direction; console.log("encoder step ",step); });
What this causes on my ESP32s is basically this:
>reset() =undefined WARNING: gap set scan error code = 103 WARNING: set rssi scan not implemeted yet ____ _ | __|___ ___ ___ _ _|_|___ ___ | __|_ -| . | _| | | | | . | |____|___| _|_| |___|_|_|_|___| |_| espruino.com 2v01 (c) 2018 G.Williams Espruino is Open Source. Our work is supported only by sales of official boards and donations: http://espruino.com/Donate >load() =undefined WARNING: gap set scan error code = 103 WARNING: set rssi scan not implemeted yet encoder step 1 encoder step 2 encoder step 3 encoder step 4 encoder step 5 encoder step 6 encoder step 7 encoder step 8 encoder step 9 /mnt/c/Users/rhys/esp32/V3.1/EspruinoBuildTools/esp32/build/esp-idf/components/freertos/queue.c:1616 (xQueueReceiveFromISR)- assert failed! abort() was called at PC 0x40093110 on core 0 Backtrace: 0x400962cb:0x3ffbd810 0x40096423:0x3ffbd830 0x40093110:0x3ffbd850 0x40084b72:0x3ffbd870 0x40084c71:0x3ffbd8b0 0x40084d1f:0x3ffbd8d0 0x4012def9:0x3ffbd8f0 0x4008501c:0x3ffbd910 0x40084ecc:0x3ffbd940 0x40084fe7:0x3ffbd960 0x400836a9:0x3ffbd980 0x401d3003:0x3ffbd970 0x7ffffffc:0x4009497c Rebooting... ets Jun 8 2016 00:22:57 rst:0xc (SW_CPU_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT) configsip: 0, SPIWP:0xee clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00 mode:DIO, clock div:2 load:0x3fff0018,len:4 load:0x3fff001c,len:2588 load:0x40078000,len:7192 load:0x40080000,len:5288 entry 0x40080278 E (518) spiram: SPI RAM enabled but initialization failed. Bailing out. WARNING: Bluetooth is disabled per ESP32.enableBLE(false) ERROR: Wifi: event_handler STA_START: esp_wifi_connect: 12298(SSID is invalid) encoder step -1 encoder step -2 encoder step -3 encoder step -4 encoder step -5 encoder step -6 encoder step -7 encoder step -8 encoder step -9 encoder step -10 encoder step -11 encoder step -12 encoder step -13 encoder step -14 encoder step -15 encoder step -16 encoder step -17 encoder step -18 encoder step -19 encoder step -20 encoder step -21 encoder step -22 encoder step -23 encoder step -24 encoder step -25 encoder step -26 encoder step -27 encoder step -28 encoder step -29 encoder step -30 New interpreter error: FIFO_FULL encoder step -31 encoder step -32 encoder step -33 encoder step -34 encoder step -35 encoder step -36 encoder step -37 encoder step -38 encoder step -39 encoder step -40 encoder step -41 encoder step -42 encoder step -43 encoder step -44 encoder step -45 encoder step -46 encoder step -47 encoder step -48 encoder step -49 encoder step -50 encoder step -51 encoder step -52 encoder step -53 encoder step -54 >
.. and these restarts continue until I stop rotating the encoder, after which the ESP32 restarts a last time and continues normal functioning. So any ideas?
Thanks :)
-=hfc
-
-
Thanks for the links Gordon, I checked them out, and you're right -- that for sure is the right approach. In my case I'm using it with something called the M5 Stack ( https://m5stack.com ), and thats a pretty neat little box, with lots of stackable options. Its totally usable as is, just not for making games or say, realtime UIs. Also, I know Jumjum and Wilberforce are working hard on the current challenges of integrating the latest versions of the ESP IDF.. . :)
-
-
Yeah I'm using it as well for a project and while the software SPI trick certainly sped it up (I was using hardware SPI), its still pretty glacial. Interestingly, here is a guy who's got a number of games, including DOOM, running on an ESP32 and an ILI9341.
https://hackaday.io/project/163464-gaming-on-the-esp32-odroid-go
Its PRETTY fast. So there is potential....
-
Hi Rovale,
analogWrite, should work on the ESP32, depending on what version you are using. I've used it a fair amount. I know in recent versions of Espruino (for various reasons -- changes in the Espressif SDK specifically), there have been a few features that are currently regressed (such as WS2812 support), on the ESP32. But I did not notice anything about the analogWrite specifically.
That said, unless I am mistaken, the analogWrite is a software feature -- not a hardware one -- so its timing is not super precise (as opposed to say, if it were interrupt driven). So its possible that setting the value after the PIN parameter causes the LED to dim, due to timing issues, though I have not specifically tried to drive an LED using this feature on the ESP32.
I did try using analogWrite on the ESP8266 about a year or so ago, and it usually led to LEDs having a slight dimming. Specifically I was trying to control an RGB LED (not a WS2812, but one LED with three differently colored diodes, fed by three output pins), and there were issues with color consistency and dimness which I attributed to the software implementation.
My suggestion would be to use digitalWrite for off and fully on, and then analogWrite for dimming or brightening the LED in between. Unless you need a luminosity profile that is extremely precise, it should be good enough for most projects I would imagine.
More info here:
-
@MaBe Thats why I'm kind of curious. That setting is one that didn't work for him. The changes he made in his working final flashing seemed to be "--flash_size=detect" and "--baud 460800" and "espruino_1v99_esp8266_4mb_combined_4096.bin", which I assume elimited the wrong address (" 0x7c000 for file ...") problem. So maybe it was the the removal of the addresses, and the use of the combined file that did it.
I'm just wondering what the working change was. For me I always use the standard from the README file and has never been a problem for me.
Nice page btw: http://www.espruino.com/EspruinoESP8266 -- I see its been updated :)
-
-
-
-
-
-
-
-
-
@user94443 This command line you're using:
esptool.py -p /dev/serial0 write_flash 0x1000 espurna-1.13.2-itead-sonoff-th.bin
Is that Espruino? Or something else. It looks like "Espruna", which is not related to this project at all. The only thing I can recommend is you get another ESP8266 and see if you can replicate the problem. If you can't, then suspicion falls on the original board.
-
-
@maman Thats great! I'm happy you got the problem resolved. It can be very annoying to have mysterious, unexpected issues like this.
@allObjects Yes, it was part of a wireless lighting product I was developing. In the end I couldn't get the costs down enough and abandoned it.
-
@allObjects Well I was doing the work in production quantity, so we're talking about 100s of boards from different sources, which I did deliberately. One of the reasons was to exactly test reliability of different mantufacturers and find out which ones could be used effectively for productization. I thought the data I gathered was extremely valuable, at the time. But yes time is important! :P
Rotary encoders for whatever reason seem to be problematic on the ESP32 and ESP8266. Maybe because "setWatch" uses polling instead of interrupts? I'm not sure. At least your setup is not crashing as it did for me.
http://forum.espruino.com/conversations/332965/#comment14722654
You could try different pins. This could at least improve the situation.