A new way to flash the modules

The Annex CNN channel
Post Reply
User avatar
cicciocb
Site Admin
Posts: 2078
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 444 times
Been thanked: 1368 times
Contact:

Re: A new way to flash the modules

Post by cicciocb »

[Local Link Removed for Guests] wrote: [Local Link Removed for Guests]Mon Oct 24, 2022 1:55 pm Just updated my ESP32 Dev board from 1.44.2 to 1.47.2 to do some speed tests.
I have a large/complex maths routine that used to take 1124ms to complete.
It now takes only 550ms, so maths has halved in execution time. :)
Unfortunately, I'm now getting a "Return without gosub at line 583" error. :?

I'll double check to make sure the error is not mine but it's been fine for many firmware versions and never had a memory leak.

EDIT:
OK, quite sure it's a bug but hard to explain. I'll try to explain using a snippet.
Original version which worked with 1.44.2 was like this:-

SubroutineName:
a few lines of code here
Do
Touch.read
Pause 20
If (touch.x > X) and (touch.y < 80) then
tft.text.pos X,65
tft.print " "
tft.text.pos X,80
tft.print " "
Exit Do
Endif
Loop
Return

I've had to change it to this to prevent the error using 1.47.2

SubroutineName:
a few lines of code here
Label1:
Touch.read
Pause 20
If (touch.x > X) and (touch.y < 80) then
tft.text.pos X,65
tft.print " "
tft.text.pos X,80
tft.print " "
Goto Label2
Endif
Goto Label1
Label2:
Return

The version using goto lines works as expected.
In brief, replacing the Do/Loop containing an Exit Do with the same function but using "goto" has fixed the problem.
Thanks for the feedback, I think I forgot to check the exit do command, I'll check in the next release
BeanieBots
Posts: 349
Joined: Tue Jun 21, 2022 2:17 pm
Location: South coast UK
Has thanked: 185 times
Been thanked: 112 times

Re: A new way to flash the modules

Post by BeanieBots »

@Andy, Yes, your suggestion would be cleaner.
This is code that has evolved over several years (actually.... decades) and was started before Do/Loop was even supported!
It's ported from an old PICAXE project and proved to be beyond its capability. Not sure even an ESP32 is up to the job but I keep trying.
It's an absolute mess with all the tweaks and is now over 1000 lines.
I re-visit for a few a days every now and then and make it even messier :oops:
I'll post as soon as it works to a reasonable level. It's an implementation of a neural network.

@cicciocb, I think you are right. There are several other Do/Loops which seem to be OK. That's the only one with an exit do and the only one which fails.
The recent increase in speed has made this project more feasable which is why I've started looking again, so thanks for the continued improvements.
Jan Volk
Posts: 93
Joined: Wed Mar 03, 2021 1:35 pm
Been thanked: 28 times

Re: A new way to flash the modules

Post by Jan Volk »

Hi Francesco,

I've been busy with cicciocb.com/FLasher/
Is it correct that with an ESP32-C3 module flashed with Annex ESP32 installer with option "Annex" this only works in AP mode and not in your own network?
"Annex without BLE" may not have been compiled for the ESP32-C3 yet?

Jan Volk
User avatar
cicciocb
Site Admin
Posts: 2078
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 444 times
Been thanked: 1368 times
Contact:

Re: A new way to flash the modules

Post by cicciocb »

[Local Link Removed for Guests] wrote: [Local Link Removed for Guests]Tue Oct 25, 2022 6:05 pm Hi Francesco,

I've been busy with cicciocb.com/FLasher/
Is it correct that with an ESP32-C3 module flashed with Annex ESP32 installer with option "Annex" this only works in AP mode and not in your own network?
"Annex without BLE" may not have been compiled for the ESP32-C3 yet?

Jan Volk
No, it should work in both AP and STA.
Try to use another router, maybe share your telephone connection. There could be some incompatibilities with some routers.
Yes, The version without BLE is not released.
Jan Volk
Posts: 93
Joined: Wed Mar 03, 2021 1:35 pm
Been thanked: 28 times

Re: A new way to flash the modules

Post by Jan Volk »

Hi Francesco,

Never had any problems with my router before. But it all works perfectly with the normal ESP32 with cicciocb.com/FLASHER/ and then also with Chrome and Firefox via my own network.
ESP32-C3 seems to crash after changing network settings in config? (no network activity)

Jan Volk
Jan Volk
Posts: 93
Joined: Wed Mar 03, 2021 1:35 pm
Been thanked: 28 times

Re: A new way to flash the modules

Post by Jan Volk »

Hi Francesco,

Some additional information. I mentioned that the ESP32-C3 can connect to Chrome and Firefox after flashing. With Firefox the connection is very bad. And what also struck me during flashing that it went much faster with ESP32-C3 than with normal ESP32 and that with Logs & Console the ip address appears with the normal ESP32 and not with the ESP32-C3. Is there any further information needed so I can see it for myself?

Jan Volk
User avatar
cicciocb
Site Admin
Posts: 2078
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 444 times
Been thanked: 1368 times
Contact:

Re: A new way to flash the modules

Post by cicciocb »

[Local Link Removed for Guests] wrote: [Local Link Removed for Guests]Tue Oct 25, 2022 9:07 pm Hi Francesco,

Some additional information. I mentioned that the ESP32-C3 can connect to Chrome and Firefox after flashing. With Firefox the connection is very bad. And what also struck me during flashing that it went much faster with ESP32-C3 than with normal ESP32 and that with Logs & Console the ip address appears with the normal ESP32 and not with the ESP32-C3. Is there any further information needed so I can see it for myself?

Jan Volk
Hi Jan, the specificity of the ESP32-C3 (and also the -S2 and -S3) is that they can be connected directly without using a dedicated USB to Serial chip (ie the CH340).
As the USB is supported by the chip itself, it stops to work after the flashing process (and must be reset manually)
This explains why there are no messages in the Logs & Console window.

The same, after each reset, the USB is "disconnected" and "reconnected" again to the PC (you should hear the "ding" on windows at each reset).
This explains why the connection is lost with the terminal emulators and why you don't have any particular sign of life. Probably the chip works but you cannot see it working.
As I suggested to ZIM, you should use the online Terminal Emulator as I implemented an auto-reconnect mechanism for that purpose (look [Local Link Removed for Guests].

About the flashing speed, this is also normal as the serial communication is limited to 115200 baud for the "classic" USB to serial chip while this is not applicable to the direct USB support (it goes at the maximum possible speed of the chip so very fast).
Jan Volk
Posts: 93
Joined: Wed Mar 03, 2021 1:35 pm
Been thanked: 28 times

Re: A new way to flash the modules

Post by Jan Volk »

Hi Francesco,

Thanks for the information and answering my questions.
I did some more tests in AP mode and almost everything seems to work. Save to folders tested and wlog test html test and print test.
Print test unfortunately does not appear to work and you have already described that in the previous post what is the cause of it not working. Test with Tera Term and Annex TK 1.22.
What Zim pointed out, using a serial network print can't work for me either because I work in AP mode and therefore no internet.
I found the schematic of my T-PicoC3 on github and indeed the module appears to have only an internal USB for ESP32-C3 and also an internal USB for RP2040.
That may also be the reason why modules with an ESP32-C3, ESP32-S2, ESP32-S3 with an external USB to UART Bridge are for sale to avoid the above problems?
I may also have some serial log traffic with the ESP32-C3 when flashing and after if there is interest?
Does anyone have experience that ESP32-C3 with internal USB and Version 1.47.2 also works in STA modes or with the ESP32-S2 or ESP32-S3 with internal USB?
I may need to change something in my router settings, but don't know what?
Note: In "Output Editor Config File Manager" in "Config" Ap mode I only filled in the Name and Pass and nothing else and after Save did not change in Network and Internet settings in Windows10. Am I doing something wrong?
But looking back a few versions and there it is. Maybe a router setting?

Jan Volk
Jan Volk
Posts: 93
Joined: Wed Mar 03, 2021 1:35 pm
Been thanked: 28 times

Re: A new way to flash the modules

Post by Jan Volk »

I translated my Dutch text with Google Translate and later saw that it was poorly translated so sorry for any confusion.

Jan Volk
User avatar
cicciocb
Site Admin
Posts: 2078
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 444 times
Been thanked: 1368 times
Contact:

Re: A new way to flash the modules

Post by cicciocb »

Have you flashed thé usb version?
Post Reply