Serial monitor dead after uploading

Windows XP,Vista,7,8 and 8.1 etc
Post Reply
Phono
Posts: 91
Joined: Tue May 05, 2015 6:08 am
Location: Ermont, France

Serial monitor dead after uploading

Post by Phono » Sat Jul 09, 2016 8:16 pm

Hi all,
I have installed the latest STM32 package on Arduino IDE 1.6.9 and it works well, except that when I recompile and upload again the code, if the Serial monitor was open at compile time, it remains open, but does not communicate any more with the target after the target restarts. The input line is greyed out during the upload, and returns white when the target resumes execution, but no communication. I must close and reopen the serial monitor.
The status windows says : failure opening port COM3 (or a similar wording, I cannot reproduce it right now).
In the Maple IDE, the serial monitor would close when uploading -- but not reopen after !

User avatar
mrburnette
Posts: 1829
Joined: Mon Apr 27, 2015 12:50 pm
Location: Greater Atlanta
Contact:

Re: Serial monitor dead after uploading

Post by mrburnette » Sat Jul 09, 2016 11:17 pm

Youd PC sounds like if is enumerating a new port after download. That is, if you check Arduino IDE before download and after download, then the comm port number is different. Since an open monitor window is tied-to the comm port, if the enumeration changes, the monitor port is orphaned and must be closed and restarted after the new port is selected.

Ray

User avatar
RogerClark
Posts: 7156
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Serial monitor dead after uploading

Post by RogerClark » Sun Jul 10, 2016 3:29 am

The Maple IDE is a customized version of the Arduino IDE that does things like close the com port prior to uploading and then opens it again afterwards

The normal Arduino IDE does not do this.

So you must close the Serial monitor prior to upload, and only open it again after the serial device has been re-initialised after the upload is complete and the serial device has been reconnected.

I recall also there is an issue with Windows versions prior to W10 where the USB driver has a problem when a connection is open (via the Serial monitor) and the usb device disconnects

Paul (Teensy) has written about this, but I can't find his posts at the moment.


But the bottom line, is that as the IDE is outside of our control, you have to manually close and re-open the serial monitor yourself.

simonf
Posts: 180
Joined: Sun Jul 26, 2015 4:03 pm

Re: Serial monitor dead after uploading

Post by simonf » Sun Jul 10, 2016 3:03 pm

I can confirm you normally need to close the serial monitor and reopen it for it to reattach. In visual studio using visual micro it will quite often freeze the PC if you don't close the port before it re-enumerates. I find the same thing with putty.

So Close serial monitor ---> Upload ----> reopen serial monitor and sometimes the COM port will have changed TOO

User avatar
mrburnette
Posts: 1829
Joined: Mon Apr 27, 2015 12:50 pm
Location: Greater Atlanta
Contact:

Re: Serial monitor dead after uploading

Post by mrburnette » Sun Jul 10, 2016 5:57 pm

This is all very easy to understand if one remembers Maple DFU is bootloader-centric and USB serial is sketch-centric. On the PC side, the port is enumerated separately; therefore ghe two are mutually exclusive.

Yes, it could have beenndone differently - but it was not. We inherited what we have from Leaflabs. A different approach would require a radical departure - well, especially for Windows since a compound driver would need to be written and signed.

Ray

racemaniac
Posts: 554
Joined: Sat Nov 07, 2015 9:09 am

Re: Serial monitor dead after uploading

Post by racemaniac » Tue Jul 12, 2016 3:00 pm

mrburnette wrote:Yes, it could have beenndone differently - but it was not. We inherited what we have from Leaflabs. A different approach would require a radical departure - well, especially for Windows since a compound driver would need to be written and signed.

Ray
It's indeed not an easy task, but the signing is a solved problem i thought? i was also wondering how some open source projects did it with a batch file that installs their driver without needing to do special things in windows, and apparantly it's just a batch file you run as admin, that signs the certificate with your own private sign key (so only valid on your own pc), but that's enough :D.

User avatar
RogerClark
Posts: 7156
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Serial monitor dead after uploading

Post by RogerClark » Tue Jul 12, 2016 10:33 pm

Driver signing is currently overcome using the customised Libwdi exe which one of the forum members whote for us.

So a new customised libwdi installer would need to be written.

New USB VID / PID pairs would be needed as it would need to be a composite device, so we would need to apply for that through one of the open source organisations which sub license USB IDs

Then a completely new bootloader would need to be written, and then the core would need to be uodated to work with the new bootloader system.

So, yes, its technically possible, but I doubt anyone on the forum has the time to do this.

I recall @jcw started to work on an alternative bootloader system, but I dont know if he every finished, and he doesnt seem to be active on the forum at the moment.

Yiu could try PMing him to find out what happened with this new bootloader

Post Reply