View previous topic :: View next topic |
Author |
Message |
bhowden
Joined: 01 Dec 2011 Posts: 3
|
Posted: Wed Jun 25, 2014 8:05 pm Post subject: Programmer hang when programming Arduino Mega2560 |
|
|
This one seems really weird. I have a Mega 2560 Arduino with USB port. I set the programmer to ARDUINO STK500V2 and the baud rate to 115200. I coded up a simple blink test:
$regfile = "m2560def.dat"
$crystal = 16000000
$hwstack = 32
$swstack = 8
$framesize = 16
Dim I As Integer
Config Portb = Output
For I = 1 To 15
Portb.6 = 1
Waitms 300
Portb.6 = 0
Waitms 350
Next I
Compiled with no errors or warnings, went to programmer screen, did a chip Identify (worked properly), erased the chip, worked properly, wrote buffer to chip which worked properly and the light started blinking. Now the weird part.
I changed the wait interval to 400 ms like this:
$regfile = "m2560def.dat"
$crystal = 16000000
$hwstack = 32
$swstack = 8
$framesize = 16
Dim I As Integer
Config Portb = Output
For I = 1 To 15
Portb.6 = 1
Waitms 400
Portb.6 = 0
Waitms 350
Next I
It compiles fine and the programmer reports the proper results from identify and erase but when I write the buffer to the chip the programmer hangs with the progress bar just over half way across. Almost any change in the program results in the hang but the original program always works. I saw the forum post on the !!! issue with the USB driver but I don't think this is the same.
Any ideas? Am I crazy?
On an unrelated note, I notice that the OK and Cancel buttons are missing from the options screen. I have just been tabbing one stop past the last update field on the screen and hitting enter which seems to work but for some reason, google doesn't turn up anybody else with this issue. I can't be the only one......
Brian
(BASCOM-AVR version : 2.0.7.5 , Latest : 2.0.7.7 ) |
|
Back to top |
|
|
bzijlstra
Joined: 30 Dec 2004 Posts: 1179 Location: Tilburg - Netherlands
|
Posted: Thu Jun 26, 2014 8:12 am Post subject: END |
|
|
Do you have an END in your program?
I don't see anything wierd in your program.
Have fun
Ben Zijlstra |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Thu Jun 26, 2014 12:48 pm Post subject: |
|
|
i would recommend to update. but you can also try the attached dat file. maybe the problem is caused by a setting. _________________ Mark |
|
Back to top |
|
|
bhowden
Joined: 01 Dec 2011 Posts: 3
|
Posted: Fri Jun 27, 2014 1:44 am Post subject: |
|
|
Well, I will be dammed! I had always treated the final end statement as a bit of a legacy hold over from early the early basic language and assumed that EOF would do the same thing. In this case, it seems to have cleared the issue I was having. As a general request, the compiler should probably issue a warning in this situation. Thanks again for the suggestion.
While it appears I don't need the 2560 dat file could I impose upon you to post a copy of the latest m328pdef.dat file? I also have an Arduino UNO R3 board but I am not having any luck talking to it. Even the identify command fails with a communication error.
Brian |
|
Back to top |
|
|
Duval JP
Joined: 22 Jun 2004 Posts: 1161 Location: France
|
Posted: Fri Jun 27, 2014 6:41 pm Post subject: |
|
|
Hello,
After a lot of pb with arduino uno R3 and arduino 2560
programmer Bascom is Arduino for the uno and Arduino STK500V2 for 2560
led is not to the same pin !
I find the good setting for them , setting for Arduino 2560 follow:
'-------------------------------------------------------------------------------
' ARDUINO-UNO V3.BAS
' (c) 1995-2011, MCS Electronics
' This is a sample file for the Mega328P based ARDUINO board
' Select Programmer 'ARDUINO' , 115200 baud and the proper COM port timeout 200
'-------------------------------------------------------------------------------
$regfile = "M328pdef.dat"
$crystal = 16000000
Config Clockdiv = 1 ' either use this or change the divider fuse byte
Config Pinb.5 = Output
'(
Do
Waitms 200
Toggle Portb.5
Loop
')
Do
Set Portb.5
Waitms 500
Reset Portb.5
Waitms 500
Loop
End 'end program
--------------------------------------------------------
'-------------------------------------------------------------------------------
' ARDUINO-M2560 V3.BAS
'
' (c) 1995-2014, MCS Electronics
' This is a sample file for the Mega2560 based ARDUINO board
' Select Programmer 'ARDUINO stk500V2' , 115200 baud and the proper COM port timeout 200
'-------------------------------------------------------------------------------
$regfile = "m2560def.dat"
$crystal = 16000000
'Config Clockdiv = 1 ' either use this or change the divider fuse byte
Config Pinb.7 = Output 'pin 13 arduino
Do
Waitms 200
Toggle Portb.7
Loop
'(
Do
Set Portb.7
Waitms 2000
Reset Portb.7
Waitms 2000
Loop
')
End 'end program
Bon courage !
|
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Fri Jun 27, 2014 7:50 pm Post subject: |
|
|
hi JP
why did you remark the code :
Do
Waitms 200
Toggle Portb.5
Loop
doesnt it work? _________________ Mark |
|
Back to top |
|
|
bhowden
Joined: 01 Dec 2011 Posts: 3
|
Posted: Fri Jun 27, 2014 9:40 pm Post subject: |
|
|
Hi JP.
Thank You VERY MUCH!!!! I could have sworn I tried that combination with the UNO but sure enough, using your settings it worked first try. Also, I would never have guessed that the mega uses a different mapping from pin number to port. At first glance that seems just plain dumb! Again, many thanks, you have saved me many hours of frustration.
Brian |
|
Back to top |
|
|
Duval JP
Joined: 22 Jun 2004 Posts: 1161 Location: France
|
Posted: Sat Jun 28, 2014 10:06 am Post subject: |
|
|
Hi Mark,
no ! everything is working with arduino, I put a remark only to show the 2 ways (toggle or reset)
Hi Brian,
Arduino are a nice idea, a lot of shields not very expensive, but !
I hate one thing : THE NUMBERS OF THE PIN'S CONNECTORS are not the same as THE ATMEL µC.
I'm working on MEGA 2560 + the shield ITDB2 mega + Display ITDB02 5inches from ITEAD Studio and I lost a long time to understand how to connect all together :No landmark on the display connector, no explanation about the power supply... the array showing the pins arrangement is
Actually I can display, Text, circle, line, box
I mixed the works of Ben Zijlstra , Six1 and others guys , I will post the code when it will be stable.
JP
|
|
Back to top |
|
|
|