Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 8 Replies) Can't upload sketch over Bluetooth (Read 16189 times)
Gillian
Junior Member
**
Offline


Posts: 31
Joined: Nov 28th, 2014
Can't upload sketch over Bluetooth
Dec 2nd, 2014 at 2:32am
Print Post  
Hello,

With the Arduino IDE, I am able to upload my sketch with Bluetooth (see this)

Here is the output in the Arduino IDE's console:
Quote:

C:\Program Files (x86)\Arduino/hardware/tools/avr/bin/avrdude -CC:\Program Files (x86)\Arduino/hardware/tools/avr/etc/avrdude.conf -v -v -v -v -patmega2560 -cwiring -PCOM13 -b115200 -D ial.cpp.hex:i 

avrdude: Version 5.11, compiled on Sep  2 2011 at 19:38:36
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "C:\Program Files (x86)\Arduino/hardware/tools/avr/etc/avrdude.conf"

         Using Port                    : COM13
         Using Programmer              : wiring
         Overriding Baud Rate          : 115200
avrdude: wiring_open(): releasing DTR/RTS
avrdude: wiring_open(): asserting DTR/RTS
avrdude: Send: . [1b] . [01] . [00] . [01] . [0e] . [01] . [14] 
avrdude: Recv: . [1b] 
avrdude: Recv: . [01] 
avrdude: Recv: . [00] 
avrdude: Recv: . [0b] 
...
avrdude done.  Thank you.



But with Visual Micro, I get this error:
Quote:

Uploading to I/O board using 'COM13'
Uploader started for board Arduino Mega w/ ATmega2560 (Mega 2560)
Upload method will be: bootloader
Uploading via Bootloader 
Flushing the serial port
C:\Program Files (x86)\Arduino\hardware\tools\avr\bin\avrdude "-CC:\Program Files (x86)\Arduino/hardware/tools/avr/etc/avrdude.conf" -v -v -v -v -patmega2560 -cwiring -PCOM13 -b115200 -D mega2560/multiserial.hex:i"
avrdude: Version 5.11, compiled on Sep  2 2011 at 19:38:36
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "C:\Program Files (x86)\Arduino/hardware/tools/avr/etc/avrdude.conf"

         Using Port                    : COM13
         Using Programmer              : wiring
         Overriding Baud Rate          : 115200
avrdude: ser_open(): can't open device "\\.\COM13": Élément introuvable.


avrdude: wiring_open(): releasing DTR/RTS
avrdude: wiring_open(): asserting DTR/RTS
avrdude: ser_drain(): read error: Descripteur non valide


It looks like it can connect to the Bluetooth for like half a second, I see a led of my arduino blink 2-3 times, then Bluetooth disconnects and this error message appear.

Any idea why? Embarrassed
« Last Edit: Feb 5th, 2015 at 11:57pm by Tim@Visual Micro »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Can't upload sketch over Bluetooth
Reply #1 - Dec 2nd, 2014 at 10:01am
Print Post  
I'll have to get a bluetooth board and try it. The commands both vm and arduino are using are the same so must be to do with an extra delay or something.
  
Back to top
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Can't upload sketch over Bluetooth
Reply #2 - Dec 3rd, 2014 at 5:33pm
Print Post  
Please confirm which shield or board you are using. I'll get hold of the same one 

Thanks
  
Back to top
IP Logged
 
Gillian
Junior Member
**
Offline


Posts: 31
Joined: Nov 28th, 2014
Re: Can't upload sketch over Bluetooth
Reply #3 - Dec 4th, 2014 at 7:10pm
Print Post  
Hello,

I'm using HC-05 bluetooth module, on JY-MCU board (v1.06), can be found on ebay for 5-6€.

Here is setup:



I hope you understand Smiley


But as you said, it's probably a timeout delay being too short. But why does it work with Arduino IDE and not Visual Micro? Is there any difference of using avrdude?
« Last Edit: Dec 4th, 2014 at 7:35pm by Gillian »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Can't upload sketch over Bluetooth
Reply #4 - Dec 4th, 2014 at 7:22pm
Print Post  
Thanks I'll give it a try

Prior to upload both visual micro and arduino often (depending on the board config) open the port, set the dtr, wait a short time, flush the port, close the port and then run avrdude.

Visual Micro is written with windows .net. so uses the .net serial port functions.

Arduino is java based so doesn't use the .net framework serial port system instead it uses it's own native functions which access a low part of the windows api than .net

This difference can cause slight variations to the upload when timing is an issue. 

From your report I expect the opening of the port and closing it again, when using blue tooth, is causing the problem. Maybe the port needs more time to settle after open/close. 

I will also look into the vm options, if I recall there are some registry settings you can use to alter the delays but will have to look into it. Give me a few days, thanks. In the meantime you can switch on "file>preferences>external editor" in the arduino ide which allows you to code in vm then switch to arduino and click upload but that means no debugging.
  
Back to top
IP Logged
 
Gillian
Junior Member
**
Offline


Posts: 31
Joined: Nov 28th, 2014
Re: Can't upload sketch over Bluetooth
Reply #5 - Dec 4th, 2014 at 7:47pm
Print Post  
I updated my fritzing schematic because the capacitor was in a confusing place, now more clear where it goes.

Maybe the problem has something to do with SerialPort.WriteTimeout ? It's default value is 500 ms, which correspond roughly to the time between start of bluetooth connection and disconnection that I'm seeing. Or maybe it's ReadTimeout. Anyway you should try setting them to a greater value like 5000 ms. Maybe you could quickly build a VM with this change applied, and give it to me so I can test? Smiley
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Can't upload sketch over Bluetooth
Reply #6 - Dec 4th, 2014 at 8:06pm
Print Post  
Unfortunately its not that simple there is no read/write in what i described. I suspect if it is the issue it will be the time between the port.close and running avrdude.exe

I am busy on other project right now but will try it as soon as I can. 

You can use the verbose output from the upload attempt and make a .bat file that does the upload for you.
  
Back to top
IP Logged
 
Gillian
Junior Member
**
Offline


Posts: 31
Joined: Nov 28th, 2014
Re: Can't upload sketch over Bluetooth
Reply #7 - Dec 4th, 2014 at 8:07pm
Print Post  
Ok, thank you Wink
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Can't upload sketch over Bluetooth
Reply #8 - Dec 13th, 2014 at 6:17pm
Print Post  
Something to try please. Just an experiment...

In arduinoide/hardware/arduino/avr you will find the boards.txt text file. please edit with notepad or texteditor and find the entry for the 2560 board you are using. It will look like this

Code
Select All
mega2560.name=Arduino Mega 2560 or Mega ADK

mega2560.upload.protocol=wiring
mega2560.upload.maximum_size=253952
mega2560.upload.speed=115200
 



please add a command as follows then re-start the vm ide:-

Code
Select All
mega2560.upload.disable_flushing=true 



I hope this makes sense.

Thanks
  
Back to top
IP Logged
 
Gillian
Junior Member
**
Offline


Posts: 31
Joined: Nov 28th, 2014
Re: Can't upload sketch over Bluetooth
Reply #9 - Dec 14th, 2014 at 3:29pm
Print Post  
Hello,

It didn't make a difference. With this modification I am still able to upload with Arduino IDE and not with VM.

The only change I noticed, is that the message "Flushing the serial port" is not displayed anymore in the VM's output window. Still the same errors as in first post Sad

FYI, I am now using latest Arduino IDE, 1.5.8, so avrdude changed to version 6.0.1.
« Last Edit: Dec 14th, 2014 at 3:36pm by Gillian »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Can't upload sketch over Bluetooth
Reply #10 - Dec 14th, 2014 at 5:47pm
Print Post  
Hi,

Thanks very much for trying that. It cuts out quite a bit of processing and suggests my previous timing discussion is not valid.

It must be something simpler. Please try another test where you run the output from visual micro from a batch file (.bat).

Code
Select All
C:\Program Files (x86)\Arduino\hardware\tools\avr\bin\avrdude "-CC:\Program Files (x86)\Arduino/hardware/tools/avr/etc/avrdude.conf" -v -v -v -v -patmega2560 -cwiring -PCOM13 -b115200 -D mega2560/multiserial.hex:i" 



Thanks for all the testing
« Last Edit: Dec 14th, 2014 at 5:50pm by Tim@Visual Micro »  
Back to top
IP Logged
 
Gillian
Junior Member
**
Offline


Posts: 31
Joined: Nov 28th, 2014
Re: Can't upload sketch over Bluetooth
Reply #11 - Dec 14th, 2014 at 7:07pm
Print Post  
After copying cygwin1.dll into avrdude.exe's folder (because it gave me an error about that) and adding quotes to the first part of the command line, it worked, uploaded successfully.

I hope you can find a solution for VM Smiley
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Can't upload sketch over Bluetooth
Reply #12 - Dec 14th, 2014 at 7:34pm
Print Post  
Thanks, please try this boards.txt key

mega2560.upload.serial_ignore=true

ps: the quotes are not the issue, they were only required for the .bat. well spotted. sorry forgot to say run from arduino folder or copy cygwin.dll. That was an annoying change in the latest 1.5.7+ toolchains
« Last Edit: Dec 14th, 2014 at 7:39pm by Tim@Visual Micro »  
Back to top
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Can't upload sketch over Bluetooth
Reply #13 - Feb 5th, 2015 at 11:59pm
Print Post  
Don't know why this got marked as Solved. Sorry I haven't had time to test a blue tooth upload yet.

I can say that the latest releases manage blue tooth ports better and also has a few minor improvements but I am not sure it will solve this issue.
  
Back to top
IP Logged
 
Gillian
Junior Member
**
Offline


Posts: 31
Joined: Nov 28th, 2014
Re: Can't upload sketch over Bluetooth
Reply #14 - Mar 18th, 2015 at 12:05am
Print Post  
Well I marked it as solved because this was solved indirectly in that other topic: http://www.visualmicro.com/forums/YaBB.pl?num=1417488083/8#8 . I should have linked to it here Wink
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Can't upload sketch over Bluetooth
Reply #15 - Mar 18th, 2015 at 3:24pm
Print Post  
Ahh, okay great. Thanks for the reminder
  
Back to top
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint