chipKIT® Development Platform

Inspired by Arduino™

Fubarino bootloader - switch to usb-serial issue

Created Tue, 30 Oct 2012 10:09:31 +0000 by pito


pito

Tue, 30 Oct 2012 10:09:31 +0000

FubarinoSD 795H, WinXP, MPIDE latest test, bootloader 1_1_6 Bootloader has been flashed and an upload of a sketch to fubarino works.

After the sketch is uploaded I would expect it switches to usb-console smoothly, so when I click on Serial monitor after the upload is done the actual code starts as expected and I will see some output. Currently I am not able to run a simple sketch with some Hello World - like stuff as the opening of the Serial monitor (or terminal ie Teraterm) a) shows an empty screen, or b) I get a message the comX is busy, or c) the connection has not been established (or it is dropped), and d) even I did hw reset I saw nothing.

That all the same with a few sec delay at the beginning of the code (before a printf). That is probably not the issue with other boards as they use the FTDI Uart. p.


EmbeddedMan

Tue, 30 Oct 2012 12:55:48 +0000

Pito,

One thing you have to be careful of is to make sure that you give the PC enough time to fully enumerate the new 'device' that just appeared on the USB. Under Windows, you hear the little "USB device leaving the bus" sound as the bootloader turns off USB and the Fubarino reboots, and then the "USB device has joined the bus" sound as the sketch's USB Serial function gets turned on. You have to wait until after that point to start the serial monitor. If you start the serial monitor earlier than that, you can expect problems like what you describe.

Now, I'm saying all of this never having run Fubarino under a Linux system. I'm hoping that people who have more Linux experience than I do can comment on this, as (except for the above case) I've never seen this type of behavior in all of my development of the FubarinoSD.

Rick? Any ideas?

*Brian


pito

Tue, 30 Oct 2012 14:42:20 +0000

you hear the little "USB device leaving the bus" sound as the bootloader turns off USB and the Fubarino reboots, and then the "USB device has joined the bus" sound

Those are loud church bells :).

I've been trying it again. I see results on the Serial monitor screen when using 5sec delay in the setup(). When I start the bootloader (2xbell) in order to do a new upload (clicking on the upload icon), the Serial monitor disappears and the upload starts, however I have to restart to bootloader again (2xbell) - because it says "Serial port Com18 is not found" (a small window pops up and offers me the other ports), then I have to click "Cancel" and start the upload again - then it uploads (2xbell). Then I have to open the Serial monitor and in ~1-2sec the results is printed. When I am slow with opening the Serial monitor I see no results on it.

The "Com already in use" came when I pressed "OK" in the small popup window - it changed the com port - this was done by error as my usb-com is com18 and the BT com port is com8. p.


EmbeddedMan

Tue, 30 Oct 2012 15:26:30 +0000

That is all expected behavior when you are using it as you are. The key is to make sure you always close the Serial Monitor BEFORE you put the FubarinoSD into bootload mode - otherwise the PC and MPIDE become confused.

And, you have to be careful to open the serial monitor at the right time - remember, with USB based chipKIT boards (like FubarinoSD) opening up the Serial Monitor does NOT restart the sketch. The sketch starts running when the upload is complete, and when you open up the serial monitor has no impact on the running code. So if your system prints out data before you open the serial monitor, you will not see the data. That's why I either put a 5s delay before I start printing stuff (and then make sure I open the serial monitor in time) or I write a little bit of code that waits for a byte from the PC before starting to print stuff out (thus insuring that the serial monitor is running before allowing the sketch to continue).

*Brian


pito

Wed, 31 Oct 2012 09:02:36 +0000

Brian, thanks! Clear. My confusion came with my assumption the serial monitor window could stay open when restarting the bootloader. p.