Open GoogleCodeExporter opened 8 years ago
This is because The CS1 Host software only looks for the ACM prefix. I need to
add a check for USB prefix as well. That should fix it!
Original comment by hra...@gmail.com
on 4 May 2012 at 6:09
[deleted comment]
[deleted comment]
[deleted comment]
OK. got it to work by adding following lines in __init__.py . beneath the line
122 i added the following lines:
try:
com = "/dev/ttyUSB%d" % each
if 'win' in sys.platform:
com = "COM%d:"% each
serial.Serial(com)
self.comList[com] = com
except:
pass
Of course as i am not a coder i dont know if this could make a new problem. but
for now it seams to work with both (MEGA 1280 and MEGA 2560). Hope that u can
use this
Best greets
Martin
Original comment by designpr...@googlemail.com
on 10 May 2012 at 8:46
Attachments:
I tried to upload firmware to the MEGA1280 with the "Upload Firmware" Botton
but got timeout errors.
researched a bit in the net and fond a solution:
the arguments for avrdude had to be changed to the following:
'avrdude -D -C firmware/avrdude/avrdude.conf -q -p atmega1280 -P %s -c arduino
-b 57600 -U flash:w:firmware/bin/firmware.hex:i'
then of course the upload to Mega2560 didnt work any more. so i added an if
...: else ...: action to checkout what kind of Board is connected.
The final result looks like:
def uploadFirmwareAction(self):
self.currentCom = str(self.coms.currentText())
self.disconnectSerial()
if 'win' in sys.platform:
avrdudePath = os.path.join( 'firmware', 'avrdude', 'win32' )
avrdudeCfg = os.path.join( 'firmware', 'avrdude', 'win32','avrdude.conf' )
avrdude = os.path.join( avrdudePath, 'avrdude.exe' )
os.environ['PATH'] = "%s;%s" % ( avrdudePath, os.environ['PATH'] )
if os.system('%s -D -C %s -q -p atmega2560 -P %s -c stk500v2 -b 115200 -U flash:w:firmware/bin/firmware.hex:i' % (avrdude, avrdudeCfg, self.currentCom) ):
raise Exception("Error uploading firmware to arduino.")
else:
if '/dev/ttyUSB' in self.currentCom:
if os.system('avrdude -D -C firmware/avrdude/avrdude.conf -q -p atmega1280 -P %s -c arduino -b 57600 -U flash:w:firmware/bin/firmware.hex:i' % self.currentCom ):
raise Exception("Error uploading firmware to arduino.")
else:
if os.system('avrdude -D -C firmware/avrdude/avrdude.conf -q -p atmega2560 -P %s -c stk500v2 -b 115200 -U flash:w:firmware/bin/firmware.hex:i' % self.currentCom ):
raise Exception("Error uploading firmware to arduino.")
self.connectButton()
at the research in the net i found a little type-error mistake in your code.
-cstk500v2 should be -c stk500v2
i changed that too in the windows-upload-firmware-action-code-snipped but dont
know how to test it because i dont know how to compile CS1 in linux for
windows. and of course i dont know how to implement the 2560/1280 checking in
the windows-upload-firmware-action-code-snippet. but i will try to find out now.
Original comment by designpr...@googlemail.com
on 11 May 2012 at 9:08
Attachments:
ok got no clue how to check for arduino-boardversion in
windows-upload-firmware-action-code-snipped.
what i can say is that:
the driver for the mega1280 in windows is from FTDI and is located in
c:\windows\system32\drivers\ name: "ftser.sys"
the driver for mega2560 in windows is from Arduino LLC and is located in
c:\windows\system\drivers\ name: "usbser.sys"
maybe a checking for the used driver in the
windows-upload-firmware-action-code-snipped could do the trick.
on the net i found a good example code for checking the boardversion (
http://totaki.com/poesiabinaria/wp-content/uploads/2011/07/sconstruct ).
but i cant implement and try that because as i mentioned above i dont know how
to compile cs1 for windows in linux. so no chance to test my code in windows or
wine.
hope this helps!
Best
Martin
Original comment by designpr...@googlemail.com
on 11 May 2012 at 11:09
Thanks for the help, Martin!!!
The only way I could find to detect the board type is by using avrdude to
retrieve the signature ID:
avrdude -c stk500 -p m2560 -P /dev/ttyUSB0
this command line should return this:
avrdude: AVR device initialized and ready to accept instructions
Reading | ############################################### | 100% 0.02s
avrdude: Device signature = 0x1e9801
0x1e9801 is the device signature for a mega 2560 board.If you run this command
on your 1280, you'll probably see this:
avrdude: AVR device initialized and ready to accept instructions
Reading | ############################################### | 100% 0.02s
avrdude: Device signature = 0x1e9703
avrdude: Expected signature for ATMEGA2560 is 1E 98 01
Double check chip, or use -F to override this check.
As you can see, it retreives the device ID of your board, which can give a clue
to the host of WHAT board type you have an what command line to use! ;)
It's kinda "hacky" way to detect, but it should work for this cases.
I'll add this check to the main host trunk asap.
thanks for the contribution, Martin... really appreciate!!
-H
Original comment by hra...@gmail.com
on 31 May 2012 at 9:01
Original comment by hra...@gmail.com
on 31 May 2012 at 9:02
Original issue reported on code.google.com by
designpr...@googlemail.com
on 3 May 2012 at 12:26