How do i Restart leostck from desktop?

A shrunk down Leonardo-compatible board, thumb drive sized with native USB support. [Product info]
Post Reply
Karlous1234
Posts: 2
Joined: Sat Dec 26, 2015 7:22 pm

How do i Restart leostck from desktop?

Post by Karlous1234 » Sat Dec 26, 2015 7:36 pm

Hi. It seems I can only re upload a new sketch to the leostck after it has been reset or plugged in (as it is currently running an old sketch). I use remote desktop to the PC with the leostck and if I simply try to upload a new sketch it fails (as the leostck is running my current sketch) I obviously have no way to reset it or unplug it due to it not physically be next to me. SO my question is how can I send a command to the leostck from the desktop it's running on to make the leostck restart (basically power cycle it, so it stops running the current sketch, fully reboots, and allows me time to upload a new sketch before it begins to run its current sketch again). I need a CMD command or python command or some serial command (I can ping it via serial port, so I need a similar command to reboot it) but I don't want to reset it and loose the current script, just power cycle it. Thanks :?:

angusgr
Freetronics Staff
Freetronics Staff
Posts: 853
Joined: Tue Apr 09, 2013 11:19 pm
Location: Melbourne, Australia
Contact:

Re: How do i Restart leostck from desktop?

Post by angusgr » Wed Dec 30, 2015 6:07 am

Setting the serial port speed to 1200 bps will reset the LeoStick into its bootloader. It's a bit odd, I know, but this how Arduino Leonardo does it as well! (This is how the auto-reset in the Arduino IDE works.)

Bear in mind that when the serial port changes the LeoStick will go into its bootloader, so the COM port you were connected to will vanish and a new COM port will appear with the bootloader running on the other end. (If you don't connect to the bootloader, then that COM port vanishes and the original COM port reappears when the sketch starts running.)

Remember that this bootloader reset trick _only_ works when a sketch is running on the LeoStick so it can emulate a serial port. If the sketch somehow gets corrupt and the serial port doesn't enumerate, you'll need to do a hard reset!

Karlous1234
Posts: 2
Joined: Sat Dec 26, 2015 7:22 pm

Re: How do i Restart leostck from desktop?

Post by Karlous1234 » Sun Jan 22, 2017 11:35 pm

Hi, sorry that did not work, it still continues to run the script i loaded and did not do a reboot. IS there any script i can use to make the leostick do a full reboot just like i had plugged it in the usb slot for the first time?

Post Reply