-
hmm, there must be something different in our testing.
To compare Original Espruino Board with ESP32 I wrote some Q&U functions (quick and ugly)
As a first result I couldn't find any way to come down to 20ms, as you mentioned.
Strange results, in my eyes, are:- setting a pin is 3 times slower on ESP32
- to figure out how much time goes to ESP-IDF, a simple test function is added to Source, which calls jshPinSetValue with true and with false. This takes a few ms only.
- array copy from a big array already takes much more than 20 ms
- LedShiftout which is similiar to the command in your module takes even more time
if setting a pin only takes some microsecs, why does setting with pin.set() take close to a millisec
var pin; switch(process.env.BOARD){ case "ESPRUINOBOARD": pin = B5; break; case "ESP32": pin = D5; break; } function test(fnc){ var t = new Date(); eval(fnc); console.log(fnc.substr(3), ":" ,parseInt(new Date() -t)); } function tstLoop(cnt){ for(var i = 0; i < cnt; i++){} } function tstArr(cnt){ var o;for(var i = 0; i < cnt; i++){o = new Uint8Array(1024);} } function tstPin(cnt){ for(var i = 0; i < cnt; i++){pin.set();} } function tstArrCopy(cnt){ var c,o = new Uint8Array(1024); for(var i = 0; i < cnt; i += 4){ c = new Uint8Array(o,i,64); } } function tstDigitalWrite(cnt){ var dfnc = digitalWrite.bind(null,[pin,pin,pin,pin,pin,pin,pin]); for(i = 0; i < cnt; i++){ dfnc(33); } } function tstShiftOut(cnt){ var arr = new Uint8Array(64); var sfnc = shiftOut.bind(null,[pin,pin,pin,pin,pin,pin],{clk:pin}); for(var i = 0; i < cnt; i++){ sfnc(arr); } } function tstLedShiftOut(cnt){ var arr = new Uint8Array(1024); var sfnc = shiftOut.bind(null,[pin,pin,pin,pin,pin,pin],{clk:pin}); for(var i = 0; i < cnt; i++){ sfnc(new Uint8Array(arr,i*64,64)); } } function tstjshPinSetValue(cnt){ ESP32.test(pin,cnt); } test("tstLoop(1000)"); test("tstArr(100)"); test("tstPin(1000)"); test("tstArrCopy(16)"); test("tstShiftOut(16)"); test("tstLedShiftOut(16)"); test("tstDigitalWrite(16)"); switch(process.env.BOARD){ case "ESP32": test("tstjshPinSetValue(6144)"); break; }
Result in Millisconds of running test on both boards
Test Espruino Board ESP32 Loop(1000) 197 230 Arr(100) 109 134 Pin(1000) 342 915 ArrCopy(16) 151 76 ShiftOut(16) 14 30 LedShiftOut(16) 652 396 DigitalWrite(16) 8 19 jshPinSetValue(6144) not available 11 - setting a pin is 3 times slower on ESP32
-
@gordon, thanks for your help, but looks like this will not run, at least on ESP32.
Scan takes 396 msec, which is too slow.
I'm pretty sure, the way how pins are set in ESP32 slows it down that much.
Tested a loop with set/reset a pin, even that takes a lot of time.There is a pure ESP32 solution using I2S in parallel mode, having density and full colors using PWM.
But as said, this would only work for ESP32, and is not part of standard Espruino. -
-
I would like to do some testing on this.
@Gordon, could you please take a look to attached code before I start testing ?
Usually 4 eyes see more than 2Pins are the same as used in an working ESP32-only solution. This part should be correct.
I've some questions:
- what is repeat in shiftOut.bind ?
- why do you have enable pin twice in digitalWrite ?
- we only have 4 address bytes, how would we control 32 rows ? Seems to be a non Espruino
questions, but may be you have some ideas should we init enable to 1 ?
function LedMatrix(){ var me = this; var gr,buf; //graphics object and buffer in graphics object var sfnc,dfnc; //function calls to send data to LED Matrix var Pr1,Pr2,Pb1,Pb2,Pg1,Pg2; //Color Pins var Pa,Pb,Pc,Pd; //address pins var Platch,Pclock,Penable; //control pins me.init = function(R1,R2,B1,B2,G1,G2,A,B,C,D,Latch,Clock,Enable){ Pr1 = R1; Pr2 = R2; Pb1 = B1; Pb2 = B2; Pg1 = G1; Pg2 = G2; Pa = A; Pb = B; Pc = C; Pd = D; Platch = Latch; Pclock = Clock; Penable = Enable; gr = Graphics.createArrayBuffer(64,32,8); buf = gr.buffer; return gr; }; sfnc = shiftOut.bind(null,[Pr1,Pr2,Pb1,Pb2,Pg1,Pg2],{clk:Pclock,repeat : 8}); dfnc = digitalWrite.bind(null,[Penable,Platch,Pd,Pc,Pb,Pa,Penable]); me.scan = function(){ enable.reset(); for (var y=0;y<16;y++) { sfnc(new Uint8Array(u,y*64,64)); dfnc(33|y<<1); } enable.set(); }; } var led = new LedMatrix(); function test(){ var ledGraphik = led.init(2,16,4,17,15,27,5,18,19,21,26,22,25); ledGraphik.setBgColor(0); ledGraphik.clear(); ledGraphik.SetColor(17); ledGraphik.clear(); ledGraphik.fillRect(0,0,3,3); led.scan(); }
- what is repeat in shiftOut.bind ?
-
-
Just found this in ESP32 Forum https://github.com/espressif/esp-idf/releases/tag/v3.1
Will start end of next week to get it running for Espruino.
In a first very quick check got this:- mbedTLS: Update to v2.9.0, as mentioned in this forum this causes some problems
- Add option to continue running if PSRAM was enabled but not detected at boot will bring us tons of variables
- mbedTLS: Updated to v2.12.0, how does this match to change above ?
- mbedTLS: Update to v2.9.0, as mentioned in this forum this causes some problems
-
-
-
@Wilberforce
its still in pre beta status. Therfore its not in github yet.
I'll attach actual source for you.
Still in vacation, and just a shoe is flying into my direction, telling me stop this reply ;-) -
@Wilberforce
to be open, I don't understand your point and need some advice.
What I would like to automate is one part, which always happens to me after we get a new version.- structure of components is different to older versions.
Therefore we need to include some more headerfiles, libraries and binarys. And remove some others. All of these changes are done in espruino/make/familiy/esp32.make.
Usually I've to search a lot to figure out these changes.
My idea now is, to use all .mk files which are available after compiling components.
Please see attached file, which is a first step to replace a lot assignments to INCLUDE,LIBS and LDFLAGS
If my understanding of your tool is totally wrong, and you are already doing this, please help me out. - structure of components is different to older versions.
-
Only FYI,
I would like to automate ESP-IDF make to Espruino Make
In a first step all .mk files in template folder are searched and converted to an additional make file
This is a first step only, but may be, its of interest
Sorry, but I'm in vacation on an island right now, and don't have time to work on this for about a month. -
@StuartRothrock
cannot find any example nor component for USB HID on ESP32.
Existing HID examples are for bluetooth only, and based on Neil Kolban
Do you have anything else helpful for ESP32 ? -
sounds interesting, there is a command in Espruino, http://www.espruino.com/Reference#l_E_setUSBHID
I'm pretty sure, this was never tested on ESP32.
AFAIK, its supported for STM32 only, and there is no general interface for USB in jshardware.js
Therefore it would need a change in Espruino core and Gordon should be involved.
Usually, he has some nice ideas ;-) -
-
To add my 2 cents.
There are some non technical facts, which could be mentioned- Three successful Kickstarter sessions, all in time. Who else made this ?
- 50 Releases, more than 5000 commits
- Everything is available in Github
- Living community, for example, AllObjects has 1728 comments in forum, and lot of others have more than 500
- Used all over the world, is there a chart or a worldmap with buyers ?
- Chart of how many are running on which board ?
- A list of ES6 support would show progress
- supported boards
- special ports like testing to run Espruino on a watch
- Three successful Kickstarter sessions, all in time. Who else made this ?
-
@Wilberforce
I did not check usage in ESP-IDF, but without TLS, compilation is not running.
There are some error messages pointing to this.
I've in mind that ESP32 supports some crypto in HW, but cannot find the source anymore.
A question could go the other direction, do we need TLS in Espruino for ESP32 ?
I think, in a next step, I will try to update TLS in Espruino. -
-
@wilberforce,
I started to get Espruino compiled with V3.1-beta.
There is a change in DPORT handling, NEOpixel uses that.
Some makefile and path changes need to be done.
Right now I'm at a point where linker tells about multiple definitions around mbedtls_sha256_init and other mbedtlssha256 functions.
Message is like this:
***/home/esp32/V3_1_prerelease/template/build/mbedtls/libmbedtls.a(sha256.o): In functionmbedtls_sha256_init': /home/esp32/V3_1_prerelease/esp-idf/components/mbedtls/mbedtls/library/sha256.c:82: multiple definition of
mbedtls_sha256_init'
libs/crypto/mbedtls/library/sha256.o:/home/esp32/V3_1_prerelease/Espruino/libs/crypto/mbedtls/library/sha256.c:79: first defined here
/home/esp32/V3_1_prerelease/template/build/mbedtls/libmbedtls.a(sha256.o): In functionmbedtls_sha256_free': sha256.c:(.text.mbedtls_sha256_free+0x0): multiple definition of
mbedtls_sha256_free'
libs/crypto/mbedtls/library/sha256.o:sha256.c:(.text.mbedtls_sha256_free+0x0): first defined here
Don't know, how to get rid of this :-( Hopefully somebody out there knows, how to get rid of this
-
Is there any way to create a board specific API documentation ?
Implementation on different boards sometimes add specific commands.
And don't support some core functions.
At least for some boards we could add a file similar to http://www.espruino.com/Reference to download -
@Wilberforce
There is a call in API to get the minimal size of heap (heap_caps_get_minimum_free_size)
AFAIK, this is the minimum size which happened during processing.
The idea is to find out, which function uses how much heap.
For example, create http-server and check this value, reset, create https and check, etc. etc.
Up to now, I did not work on this, with other words, no experience yet ;-) -
@Wilberforce
V3.01 does not, but there is a prerelease V3.1 which supports with/without PSRAM
I'll take a look to that to see how to get it running with Espruino.
Already known is renaming of directories and header files
Prerelease comes very soon after release, much faster than in the past.
Lets see how long we have to wait for release of V3.1 -
-
Actual ESP-IDF release supports WROOM or WROVER boards.
Problem is the or, you cannot build a binary which runs WROOM and WROVER
There was an simple extension in master for some month before release, but it did not make it to release 3.0
Since Espressif does not give any information like a roadmap, we have to wait and hope for 20000 or even more jsVars.
Obviously you could build your own firmware for WROVER boards. You only have to switch PSRAM support on in menuconfig. Espruino itself is ready for that. See line 51 to 54 in targets/esp32/main.c -
ESP32 needs a lot power during WiFi.
Its a ESP32 problem not related to Espruino.
Check your power supply.
Search for ESP32 brownout on google, or on the Espressif forum (https://esp32.com/)
Life could be much easier, doing things correctly , .....
Good news first, I got it running.
Bad news, ESP32 seems to be too slow.
Scan takes 70 msecs, so refresh rate is 14 hz only which means flickering like crazy.
Another bad part is converting from Graphics buffer to the format needed for the LED Matrix.
I'm pretty sure there are better ways for converting, but I'm pretty sure it will always be slow.
An option could be a small c-function for converting, and may be shiftout could be optimized (?)
Anyway, if somebody wants to test with other boards, this could be a good start