Robot-Will / Stino

A Sublime Text Plugin for Arduino
Other
1.58k stars 250 forks source link

Stino won't upload to Arduino Leonardo #133

Closed lemrey closed 9 years ago

lemrey commented 10 years ago

I'm trying to upload some code to a Leonardo board but when selecting the Upload menu entry (I also tried the CTRL+ALT+U shortcut but it is the same) Stino just compiles the code. It seems like uploading doesn't even start.

jacobcarpenter commented 10 years ago

I just upgraded to the latest Arduino beta (1.5.6-r2) and am experiencing this same behavior. I'm trying to upload to an Uno R3. Like OP says, compilation completes, and then it seems like it thinks everything is done. No upload message.

jacobcarpenter commented 10 years ago

Oh. Actually, I was able to resolve this issue by selecting Arduino Uno on the Arduino > Arduino AVR Boards menu in ST/Stino. Now it seems to upload just fine...

adilsoncarvalho commented 10 years ago

I am experiencing the same issue on a Leonardo board. It works when I use Arduino 1.0.5

It compiles but no upload is started. I've tried setting other boards on the Arduino > Arduino AVR Boards and after a saw the RX led flashing then I've got the expected errors because the board is incompatible with my Leonardo one.

Compiling internal_led_fade...
  ...lots of c.o files...
Binary sketch size: 4818 bytes (of a 28672 byte maximum, 16.80 percent).
Estimated memory use: 155 bytes (of a 2560 byte maximum, 6.05 percent).
[Stino - Done compiling.]
Forcing reset using 1200bps open/close on port /dev/tty.usbmodemfa131.

I am running SublimeText 3 build 3059 and Mac OS 10.9.2 on a Macbook Pro 17"

syriley commented 10 years ago

I'm getting the same issue here with my Arduino Leonardo on a macbook pro. Showing verbose output on the upload produces this:

[Stino - Done compiling.]
Forcing reset using 1200bps open/close on port /dev/cu.usbmodem1421.
Ports {['/dev/cu.Bluetooth-Incoming-Port', '/dev/tty.Bluetooth-Incoming-Port', '/dev/cu.SimonsiPhone-WirelessiAP', '/dev/tty.SimonsiPhone-WirelessiAP', '/dev/cu.Bluetooth-Modem', '/dev/tty.Bluetooth-Modem', '/dev/cu.usbmodem1421', '/dev/tty.usbmodem1421']}/{['/dev/cu.usbmodem1421']} => {['/dev/cu.usbmodem1421']}
Found new upload port: /dev/cu.usbmodem1421.
carmilso commented 10 years ago

I have the same problem in my linux with Arduino Leonardo. Sublime Text don't upload the sketch to it!

eppfel commented 10 years ago

Bump! Arduino Leonardo on MAC OSX Mavericks. Upload with Arduino IDE works fine. Nothing is printed after [Stino - Done compiling.]

Holokai commented 10 years ago

Any update on this? Really looking forward to switching back to Sublime...

Same Specs as adilsoncarvalho above: "I am running SublimeText 3 build 3059 and Mac OS 10.9.2 on a Macbook Pro 17""

duncaneddy commented 10 years ago

Make sure to check that you have the right Arduino AVR board and serial port selected.

Go to

"Arduino -> Arduino AVR Boards -> {YOUR BOARD TYPE}"

and

"Arduino -> Serial Port -> /dev/tty.usbmodem{SOME NUMBER}"

Then it should upload successfully.

vindolin commented 10 years ago

I can confirm the bug, I cannot upload to my Leonardo and Sparkfun Pro Micro board with Stino.

cyrildiagne commented 10 years ago

Any fix for this issue ? Facing the same problem with a Leonardo board

edorgeville commented 10 years ago

:+1: this issue

jrocharodrigues commented 10 years ago

Same problem here... Any solution?

iDandelions commented 10 years ago

I have made it work on a mac, but it's a bit of a hack as I haven't had time to fully understand the code. I only have a Leonardo board and the changes I made will probably adversely affect other boards.

If you want to try:

I have edited uploader.py in the app directory of the plugin.

Comment out the following lines as they remove the /dev/ part of the port which causes it to fail on a mac.

                # if self.args['cmd'] != 'avrdude':
                #   if serial_port.startswith('/dev/'):
                #       serial_port = serial_port[5:]

The Leonardo board requires a serial connection to be made and then closed to reset the board. It wasn't happening on my board using the uploader.py code but I could force it using the python shell running the same code a line at a time. The only difference was the delay between the open and the close. I have added a delay before and after the close() statement in the touchSerialPort function.

def touchSerialPort(serial_port, baudrate):
    cur_serial = pyserial.Serial()
    cur_serial.port = serial_port
    cur_serial.baudrate = baudrate
    cur_serial.bytesize = pyserial.EIGHTBITS
    cur_serial.stopbits = pyserial.STOPBITS_ONE
    cur_serial.parity = pyserial.PARITY_NONE
    cur_serial.open()
    time.sleep(1) #<----- add this line
    cur_serial.close()
    time.sleep(3) #<----- add this line

It doesn't work every time, so something isn't quite correct with the timing.

As I said, the fix is a bit of a hack, but until a proper solution is found it might get you going.

bcolloran commented 10 years ago

this also works on for Arduino Leonardo under Ubuntu 14.04 (intermittently, maybe 50/50 so far). But def enough to get me going, and Sublime is so much better than the Arduino IDE that I'll take it!

iDandelions commented 9 years ago

I've had another look at the Leonardo uploading issue again. This code is more robust at getting the Leonardo to reset during the upload process:

See if this new version of touchSerialPort in uploader.py is any better:

def touchSerialPort(serial_port, baudrate):
    cur_serial = pyserial.Serial()
    cur_serial.port = serial_port
    cur_serial.baudrate = baudrate
    cur_serial.bytesize = pyserial.EIGHTBITS
    cur_serial.stopbits = pyserial.STOPBITS_ONE
    cur_serial.parity = pyserial.PARITY_NONE
    cur_serial.open()
    cur_serial.setDTR(True) 
    time.sleep(0.022)    
    cur_serial.setDTR(False)  
    cur_serial.close()
    time.sleep(3)

The commented out lines can be un-commented and the first line of the three changed to the following:

                if not self.args.get('cmd.path').endswith('avrdude'): #<- updated line
                    if serial_port.startswith('/dev/'):
                        serial_port = serial_port[5:]

Getting closer!

geonicz commented 9 years ago

Windows machine. Arduino 105,106,157. Hack doesn't work :(

tcustodio commented 9 years ago

Same problem here. Updated today to Arduino 1.0.6 and switched back to Sublime but this is still happening.

Robot-Will commented 9 years ago

Please try the new version by manual installation. See issue #179. Thanks.

Robot-Will commented 9 years ago

I fixed some errors and you can try it. Thanks.

Win7, ST3065, Arduino 1.0.6, new-stino, Leonardo [Stino - Start building "Blink"...] Creating E:\Documents\Arduino_build\Blink\Blink.ino.cpp.o... Creating E:\Documents\Arduino_build\Blink\Blink\b.cpp.o... Creating E:\Documents\Arduino_build\Blink\core_arduino\WInterrupts.c.o... Creating E:\Documents\Arduino_build\Blink\core_arduino\wiring.c.o... Creating E:\Documents\Arduino_build\Blink\core_arduino\wiring_analog.c.o... Creating E:\Documents\Arduino_build\Blink\core_arduino\wiring_digital.c.o... Creating E:\Documents\Arduino_build\Blink\core_arduino\wiring_pulse.c.o... Creating E:\Documents\Arduino_build\Blink\core_arduino\wiring_shift.c.o... Creating E:\Documents\Arduino_build\Blink\core_arduino\CDC.cpp.o... Creating E:\Documents\Arduino_build\Blink\core_arduino\HardwareSerial.cpp.o... Creating E:\Documents\Arduino_build\Blink\core_arduino\HID.cpp.o... Creating E:\Documents\Arduino_build\Blink\core_arduino\IPAddress.cpp.o... Creating E:\Documents\Arduino_build\Blink\core_arduino\main.cpp.o... Creating E:\Documents\Arduino_build\Blink\core_arduino\new.cpp.o... Creating E:\Documents\Arduino_build\Blink\core_arduino\Print.cpp.o... Creating E:\Documents\Arduino_build\Blink\core_arduino\Stream.cpp.o... Creating E:\Documents\Arduino_build\Blink\core_arduino\Tone.cpp.o... Creating E:\Documents\Arduino_build\Blink\core_arduino\USBCore.cpp.o... Creating E:\Documents\Arduino_build\Blink\core_arduino\WMath.cpp.o... Creating E:\Documents\Arduino_build\Blink\core_arduino\WString.cpp.o... Creating E:\Documents\Arduino_build\Blink\core_arduino\avr-libc\malloc.c.o... Creating E:\Documents\Arduino_build\Blink\core_arduino\avr-libc\realloc.c.o... Creating E:\Documents\Arduino_build\Blink\core.a... Creating Blink.elf... Creating Blink.eep... Creating Blink.hex... Sketch uses 4,700 bytes (16.4%) of program storage space. Maximum is 28,672 bytes. Global variables use 87 bytes (3.4%) of dynamic memory, leaving 2,473 bytes for local variables. Maximum is 2,560 bytes. [Stino - Done building "Blink" in 18.6s.] [Stino - Start uploading...] Forcing reset using 1200bps open/close on port COM5. Ports {['COM5']}/{['COM5']} => {[]} Ports {['COM5']}/{['COM5']} => {[]} Ports {['COM5']}/{['COM5']} => {[]} Ports {['COM5']}/{['COM5']} => {[]} Ports {['COM5']}/{['COM5']} => {[]} Ports {['COM5']}/{['COM5']} => {[]} Ports {['COM5']}/{['COM6']} => {['COM6']} Found new upload port: COM6. Connecting to programmer: .

Found programmer: Id = "CATERIN"; type = S

Software Version = 1.0; No Hardware Version given.

Programmer supports auto addr increment.

Programmer supports buffered memory access with buffersize=128 bytes.

Programmer supports the following devices:

Device code: 0x44

[Stino - Done uploading.]

tcustodio commented 9 years ago

Seems fixed, Sublime now uploads to leonardo correctly. Hope this helps everyone else. Thanks for being so quick to fix this.

albuckley commented 9 years ago

This fix is required:

On Debian/Ubuntu systems you need only to add this 2 lines to the file:

~/.config/sublime-text-3/Packages/Stino/stino/pyarduino/arduino_target_params.py

at line 323

target_tools_avrdude_path = os.path.join(ide_path, 'hardware/tools/avr')

and this at 332 of same file

params['runtime.tools.avrdude.path'] = target_tools_avrdude_path

Solution copied from: https://github.com/Robot-Will/Stino/issues/258