-
• #77
Seems interesting, however I don't really understand how I could retrieve the stack trace
-
• #78
use https://maximeborges.github.io/esp-stacktrace-decoder/
upload .elf file and enter the Stack trace CPU wise to get detail about the function0x40394ffe: newlib_include_assert_impl at /home/yerpj/JP/Espruino/esp-idf-4/esp-idf/components/newlib/assert.c:97 0x4038e266: xQueueGenericSend at /home/yerpj/JP/Espruino/esp-idf-4/esp-idf/components/freertos/queue.c:1043 0x4038e266: xQueueGenericSend at /home/yerpj/JP/Espruino/esp-idf-4/esp-idf/components/freertos/queue.c:1043 0x40393e88: multi_heap_internal_unlock at /home/yerpj/JP/Espruino/esp-idf-4/esp-idf/components/heap/multi_heap.c:148 0x40393e4c: multi_heap_free_impl at /home/yerpj/JP/Espruino/esp-idf-4/esp-idf/components/heap/multi_heap.c:214 0x40380ef4: heap_caps_free at /home/yerpj/JP/Espruino/esp-idf-4/esp-idf/components/heap/heap_caps.c:383 0x40395024: free at /home/yerpj/JP/Espruino/esp-idf-4/esp-idf/components/newlib/heap.c:40
I have currently no experience to investigate this ESP behaviour, but at the same time it seems legit to point at the heap being full.
I hope that people used to work with ESP32 will have good time tinkering with this ESP32-C3 and eventually provide improvements. -
• #80
use jump to find settings
1 Attachment
-
• #81
Hi, im slowly getting to a position to build Espruino for the C3. Ive put Ubuntu v24.4 on an old dell 3050 for this. Im not experienced with Ubuntu just to say.
I think I have the same issue as @Jean-Philippe_Rey when running '>sudo BOARD=ESP32C3_IDF4 RELEASE=1' with the error 'idf.py not found'.
This was after running the provision script and checking that idf.py did run in Espruino and Espruino/bin from the terminal prompt.
I found putting the directory names in front of idf.py in the file /Espruino/make/targets/ESP32_IDF4.make fixed this.
When running the Espruino build line, Im getting past theis idf.py not found error now and hitting another error 'packaging cannot be imported' . So something missing in my ubuntu, I suppose. But idf.py will build a bin on its own in the idf/examples??
Ill push on. Ive only got a little time over the next couple weeks. -
• #82
I think I have the same issue as @Jean-Philippe_Rey when running '>sudo BOARD=ESP32C3_IDF4 RELEASE=1' with the error 'idf.py not found'.
what guide tells you to run sudo?
see https://forum.espruino.com/conversations/395499/?offset=50#17389052
-
• #84
the point was also that maybe you or Jean-Philippe_Rey were following some outdated/broken guide/README so would be good to fix that
-
• #85
No doc told me to run sudo. I was unable to execute some script for whatever reason and with sudo it didn't complain. I am very bad at Linux and permission mechanisms, but I learned that giving rights in a proper way was better than using sudo everytime ;-)
-
• #86
Me also, I cant find a guide that uses sudo, but was in my notes, an error on my part.
And now without Sudo, in a clean git clone of Espruino, without any changes to the make files:
source ./scripts/provision.sh ESP32C3_IDF4
BOARD=ESP32C3_IDF4 RELEASE=1 make flashIs building to completion (i will sort flashing). :)
Thanks again @fanoush. I appreciate your help.
-
• #87
use this export
export PORT=<your serial port>
-
• #88
Thanks @MaBe and others got both the mini and OLIMEX c3-Devkit (link above) flashed today. Both working in the WebIDE , ESP32.reboot() and .getstate() working, program upload from IDE is good. Connected to WIFI ok. Looking very good. Im off for a couple of weeks but will test properly on return. Will look the i2C and IO first. Great job folks.
-
• #89
Hi, ive been working with the ESP32-C3 build for a few weeks now and have to say the new cmake build method seems very robust. Ive had success using it on my Linux box inside VS code terminal, using some of the ESP-IDF extension functions as well **. (I could make notes on that if useful to anyone).
So as others advised above, the build steps in Linux terminal, high level are:
git clone https://github.com/espruino/Espruino.git
cd espruino(check which usb port board is plugged into with > ls /dev )
export PORT=/dev/ttyACM0 (or whatever port)
source ./scripts/provision.sh ESP32C3_IDF4
BOARD=ESP32C3_IDF4 DEBUG=1 make flash (note no sudos anywhere :)I am also using BINDIR=. on the make command because it creates a build structure seemingly more typical for cmake and enables debugging as provided by VS code with the idf extensions.
The debug single step and break points seems to be working (not used in earnest) with some code not liking to be paused (as expected). The JTAG usb connection is pretty neat in that OpenOCD can run on the com port AND the espruino WebIDE can connect simultaneously over the one USB connection. Ive been able to set break points in the VScode UI while using the webIDE to drive Espruino in the webIDE. Note Ive not been able to run OpenOCD on the waveshare ESP-C3-Zero but it runs on the Olimex ESP33-c3DevkitLipo .
Im conscious the goal is to move to ESP-IDF v5 , im trying to build a set of wifi tests, refactoring @tve s esp8266 tests that I hope will help. Hopefully along the lines of @Gordon s previous generic test approach. Ive just ordered an Original Espruino wifi board to baseline the tests.
Anyway learning allot :). Any suggestions always welcome.
** the main tricks to get working in Vs code was to add the required project config files to the espruino folder after cloning, added by running the extension command >ESP-IDF: Add .vscode Configuration Folder command.
and then to build espruino with the BIN dir set to the espruino folder itselfBOARD=ESP32C3_IDF4 RELEASE=1 make flash BINDIR=.
or
BOARD=ESP32C3_IDF4 DEBUG=1 make flash BINDIR=.
So that the build intermediate files and build output are in /Espruino/build and Main folder is /Espruino/main containing CMakeLists.txt -
• #90
im trying to build a set of wifi tests, refactoring @tve s esp8266 tests
please also check this tests from @Wilberforce
https://github.com/espruino/Espruino/tree/master/targets/esp32/tests
-
• #92
Thanks! Really interesting to know you're having luck with OpenOCD - I never even considered trying that, but it'll make debugging miles less painful.
Just FYI I'm aware the builds are a bit tricky for most users to get started with, so I'm now building C3 as a part of the GitHub actions (cutting edge) and they're available at https://www.espruino.com/binaries/travis/master/
-
• #93
Many thanks, hope we get more tester on board for those devices.
-
• #95
Has anyone had any luck with the ESP32C3 ADC? I could really do with it for a customer's board, and I've been trying here but can't get it to work. First call returns full range (4095) and all other calls seem to return 0.
As far as I can tell it's calling adc1_config_width, adc1_config_channel_atten, adc1_get_raw as expected but it's just not getting anything out.
-
• #96
Hi @Gordon , I had a quick go this eve and analogRead(0) behaves for me the same as you describe on my two different devices. I tried single stepping with Vscode debug as mentioned above, but didn’t work well.
In case you’ve not seen there is an ESP-IDF example,
See the file /Espruino/esp-idf-4/esp-idf/examples/peripherals/adc/single_read/single_read/main/single_read.c -
• #97
Thanks! I did give it a go and as far as I can see we do basically all the same stuff other than the calibration (but that happens after adc1_get_raw anyway)?
I wondered whether it was related to having to set the pin state to 'analog' as in some microcontrollers, but I don't see that as an option here.
The odd thing is I really thought that it would be pretty google-able to see other people with the same issue, but I can't turn up anything obvious at all!
-
• #98
Hi @Gordon , Ive had another go at the analogRead(), But without success. I have been able to build the ESP-IDF example sited above and single step in VScode as basline. It does work. So board is capable !? Ive tried:
- comparing the idf config files of working example and Espruino build- no obvious relevent differences.
- Ive filled the espruino readADC() with debug prints and it looks like all the parameters for the main calls into esp-idf are the same on the the multiple runs of analogRead .
- Ive put initADC () inside readADC() so ADC is initialised on each run of analogRead();
- and changed #define adc_channel_max 5 //sga changed from 8
All with no joy . Ugg
The example does use a different call to the IDF for the raw read.: esp_adc_cal_raw_to_voltage() and relies on a calibration function. Im happy to have a go at refactoring the espruino version to use this , at least as proof of concept. (my C coding is at the cut and past level ) but downing tools for today. Did you have any other ideas ?
2 Attachments
- comparing the idf config files of working example and Espruino build- no obvious relevent differences.
-
• #99
Thanks for giving it a try!
That example does this, right?
adc_raw[0][0] = adc1_get_raw(ADC1_EXAMPLE_CHAN0); ESP_LOGI(TAG_CH[0][0], "raw data: %d", adc_raw[0][0]); if (cali_enable) { voltage = esp_adc_cal_raw_to_voltage(adc_raw[0][0], &adc1_chars); ESP_LOGI(TAG_CH[0][0], "cali data: %d mV", voltage); }
So we are still using
adc1_get_raw
in both cases? And I guess it returns something other than 4095 or 0 when you run the example?Hard to know really - I'm off next week so I won't get a chance to give this a try, but I wonder if it's related to pin state? Like if you could check the contents of the various registers for GPIO0 in the example and Espruino I wonder if they are the same?
-
• #100
Yes of course @Gordon ... we are still using adc1_get_raw in both cases, my mistake.
On holiday myself now but did manage to check GPIO2 registers last week, but still no joy when setting up register similiarly before analogRead() in Espruino case. A bit of detail in the attached.The observed value in the example in the IO_MUX_GPIO2_REG of x001802 seems consistant with the Esp32-c3 reference manual section
5.7 Analog Functions of GPIO Pins
Some GPIO pins in ESP32-C3 provide analog functions. When the pin is used for analog purpose, make sure that pull-up and pull-down resistors are disabled by following configuration:
• Set IO_MUX_GPIOn_MCU_SEL to 1, and clear IO_MUX_GPIOn_FUN_IE, IO_MUX_GPIOn_FUNWPU, IO MUX_GPIOn_FUN_WPD.
2 Attachments
I don't think that's a real problem. I have a feeling on the standard ESP32 build the task watchdog is disabled in menuconfig so you could look at doing that.
It's just complaining that the
espruinoTask
process doesn't complete (but we don't expect it to). It should however idle when it's not running code or has user input (seejshSleep
) so I'm not sure why that's not enough for the task watchdog