I have been dipping my toes into ESP32 and MongooseOS.
ESP32 and Mongoose OS - First Application
These posts hopefully help others, and if nothing else will assist with keeping track of where I'm at.
I had great success with the NeoPixel, although it was simply loading someone else hard work, and then tweaking it.
Spurred on, I decided to try a Dallas Temperature sensor App.
There seems to be a couple and I wanted to use the one based on C.
My device is currently Flashed with the demo-js which provides the uptime, free ram and total ram at regular intervals (more of why it's running later)
Click on Import and it adds to to MyApps.
Click on Flash and you'd assume that it would Flash it to the device ....
The Flash icon changes and it seems to just sit there spinning and continuing to run the Flashed program.
It appears that you need to build the programme first.
Clicking on the icon next to the file dropdown offers this and the message in the Device Logs shows it.
After a period it returns this message, but doesn't give any other clues on the GUI.
Once you've built it ... which I assume grabs all the other parts/libs/etc and compiles it, will it flash correctly.
Now when you hit the flash icon, the Device Logs show the uploading process
Crash the Browser
For some reason the App starts out and reports that it can't find any device, and then for whatever reason it produces garbage.
This also has the effect of killing the browser and any other open tabs you have open.
My Laptop runs an older version of Firefox, so I thought I would try running it in Chrome.
While it gave a few different looks, the end result was the same. ... Flash, run and crash.
Mos.exe opens in the default browser, and there are no obvious configuration options shown in this version of the gui.
Personally I think the ability to personalize it might be useful.
Firefox updated (just in case), and again same problem.
I have tried various tricks to reinstate Mongoose, but in order to recover the browser, it is necessary to kill mos.exe.
On Windows this can be done by the Task manager.
Searching for causes
Last night when I encountered this, I was using my Laptop I had changed over to using a DS18B20 with the obligatory 4k7 pullup resistor between volts and data.
And then I recalled something about these being 3v3 devices.
A mild panic ensued that I had destroyed the GPIO with 5v, and I was thinking how stupid I was.
I decided to fix that by connecting the Volts to one of the 3v outputs shown and try again.
Same problem, flashes and reports no sensors then garbage and crash.
I then decided that 5v might not be the issue as the NeoPixels were running on 5v and it seemed to survive just fine ... but??
I was going to try to repeat the problem at home using my computer and the cable I knew worked, but for various reasons that didn't happen.
So a new day, and I brought the cable I had at home and decided to flash the device with the demo-js app, and it should prove if it works or not.
I was pleasantly surprised when it flashed and ran quick happily (which is why it was showing the data)
First rule of fixing ... repeat the problem.
So I proved that the comm port works just fine and the device is not suffering from some other issue.
Next trick is to flash it with the App and see what happens.
The flash process went fine (after you build it) and the comm port showed some meaningful information.
However it crashed with garbage being sent down the USB port ....
So I know the cable isn't causing it.
In the latest attempt I removed the connection to the Data Pin on the DS18B20.
So I know the data pin pull-up (4k7 to volts) is not causing it.
It seems the issue has to be the App and it's interaction with the LOLIN32 Pro device.
I was surprised when I saw the 'arduino' in the name, but you can program these devices using the Arduino IDE.
This might be worth a trial, but they are in the MongooseOS git
How does it communicate
The file main.cpp does not include any setting for the baud rate and simply does a printf
There is no reference to baud rate or the setup of the connection.
However the file mos.yml specifies the libraries used.
What differs in the demo-c or demo-js is it uses a different source.
So the next step is to check if there is a difference.
Libraries
There is plenty of links to the libraries used, and searching through them finds you back at the same uart library.
If you click on the 'api ref' in the top right corner, it takes you to here
https://mongoose-os.com/docs/reference/api.html#arduino-compat
Eventually I find the default settings for the uart baud rate in here
https://github.com/cesanta/mongoose-os/blob/master/fw/src/mgos_uart.c
and yes it is 115200, just what the port is set at.
What is cauing this
About now I'm doubting this is the problem, and why does it wait for a while before filling the screen with garbage.
So this time I rebuilt the App, flashed it and waited with my finger hovering over the reset button.
You can see the timing on the very left.
[Jan 8 00:38:13.092] mgos_sys_config_init WDT: 30 seconds [Jan 8 00:38:13.108] No sensors found [Jan 8 00:38:13.108] Arduino DallasTemperature library simple example [Jan 8 00:38:43.138] Task watchdog got triggered. The following tasks did not reset the watchdog in time: [Jan 8 00:38:43.153] - mgos (CPU 0/1), backtrace: 0x400852c0 0x400830c6 0x400fa9da 0x400fa88f 0x400faa03 0x400fa998 0x400ef963 0x400f31c9 [Jan 8 00:38:43.153] [Jan 8 00:38:43.153] Tasks currently running: [Jan 8 00:38:43.153] CPU 0: IDLE [Jan 8 00:38:43.153] Aborting. [Jan 8 00:38:43.153] abort() was called at PC 0x400d10d8 on core 0 [Jan 8 00:38:43.153] [Jan 8 00:38:43.153] Backtrace: 0x40086b3b 0x40086c3b 0x400d10d8 0x400815e6 0x400d160d [Jan 8 00:38:43.153] --- BEGIN CORE DUMP --- [Jan 8 00:38:43.153] {"arch": "ESP32", "cause":29, [Jan 8 00:38:43.153] "REGS": {"addr": 1073425304, "data": " [Jan 8 00:38:43.153] O2sIQD5sCICwB/s/LwAAAC8AAAAMAAAA/////wAAAAD+////AAAAAJAH+z8AAAAAQQf7P+8G+z8wAAAAAAAAAPkG+z/vvq3e776t3u++rd7vvq3e776t3u++rd7vvq3e776t3u++rd7vvq3e776t3u++rd7vvq3e776t3u++rd7vvq3e776t3u++rd7vvq3e776t3u++rd7vvq3e776t3u++rd7vvq3e776t3u++rd7vvq3e776t3u++rd7vvq3e776t3u++rd7vvq3e776t3u++rd7vvq3e776t3u++rd7vvq3e776t3u++rd7vvq3e776t3u++rd7vvq3e776t3u++rd4AAAAAAAAAAAAAAAAFAAAAAAAAAAEAAADvvq3e776t3iEABgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAdAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}, [Jan 8 00:38:43.231] "DRAM": {"addr": 1073405952, "data": " [Jan 8 00:38:43.231] 2fj9zRAeeeT5ay3ARLN18AAAAAB8MghAAAAAAAAAAACECPs/hAj7PwAAAAAAAAAAqcT5P6nE+T8BAAAAAAAAAEoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABKAAAA
So it isn't garbage as such, it is the device doing a core dump after some sort of abort after about 25 seconds.
It seems that the WDT is set for 30 seconds (very top line), and for whatever reason the code assumes it will see a Dallas device, and therefore will report the temperature.
Now just for fun I connected the sensor to pin13 and it still didn't work, so I have two issues to deal with.
However I'm making some progress ... just not in the direction I was hoping for .... my neopixels.
Mark
Top Comments