Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reset before Upload #160

Open
peterquiel opened this issue Dec 10, 2015 · 2 comments
Open

Reset before Upload #160

peterquiel opened this issue Dec 10, 2015 · 2 comments

Comments

@peterquiel
Copy link

The arduino micro rests if an serial connection is open with 1200 baud an closed again.
A software reset before uploading makes uploading a new firmware a one click/command action.

A command like

stty /dev/device 1200 && sleep 3 

before uploading did the job for me.

Would be great to have an optional reset command parameter that is executed before uploading the firmeware.

@m42e
Copy link

m42e commented Jan 7, 2016

diff --git a/cmake/Platform/Arduino.cmake b/cmake/Platform/Arduino.cmake
index e5003e1..e0c412b 100644
--- a/cmake/Platform/Arduino.cmake
+++ b/cmake/Platform/Arduino.cmake
@@ -1208,10 +1208,14 @@ function(setup_arduino_bootloader_upload TARGET_NAME BOARD_ID PORT AVRDUDE_FLAGS

     list(APPEND AVRDUDE_ARGS "-Uflash:w:${TARGET_PATH}.hex")
     list(APPEND AVRDUDE_ARGS "-Ueeprom:w:${TARGET_PATH}.eep:i")
+    set (RESET_COMMAND stty -f ${PORT} 1200 && sleep 2 )
+    add_custom_target(${UPLOAD_TARGET}-reset
+                        ${RESET_COMMAND}
+        )
     add_custom_target(${UPLOAD_TARGET}
                      ${ARDUINO_AVRDUDE_PROGRAM}
                      ${AVRDUDE_ARGS}
-                     DEPENDS ${TARGET_NAME})
+                     DEPENDS ${TARGET_NAME} ${UPLOAD_TARGET}-reset)

     # Global upload target
     if(NOT TARGET upload)

@oldmud0
Copy link

oldmud0 commented Apr 7, 2017

The only problems is that stty doesn't work on Windows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants