Pages: [1]   Go Down
Author Topic: Mega 2560 > Me.  (Read 1035 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I must be an idiot.  I just picked up a Mega 2560 for a project I've been piecing together that requires comm with a number of other devices.  Anyway, sketches that work just fine on my Uno, don't work on the Mega.  Everything seems to compile and upload just splendidly, but then things get odd.  Serial comm seems to be working nominally, but I can't get any digital, PWM, or analog ports to work - specifically, I can't even get a single LED to light up (other than one plugged in to pin 13 - but even that I can't control - it only lights up upon reset and serial comm).

Any ideas here?  I must be missing something that's terribly obvious.
Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 208
Posts: 8842
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Are you doing anything strange like direct port access?

Does the Blink example not blink the on-board LED?
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Austin, TX
Offline Offline
Faraday Member
**
Karma: 71
Posts: 6146
Baldengineer
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Any ideas here?  I must be missing something that's terribly obvious.
I'm placing bets it is around line 12 or 47 of the code you didn't post.
Logged

Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.com

Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I haven't done any port manipulation; only digital and analog write commands.  If I remember correctly (I don't have the board available at the moment to confirm), the on-board LED did work for at least some of the test cases I tried out with it.  I will test again tomorrow, though.

I actually tried the same sketch on two separate Megas, both with failing results, followed by success on an Uno...  If nothing else, it makes me fairly confident that it's something that I'm doing wrong - not a hardware issue as I had initially suspected.
Logged

Austin, TX
Offline Offline
Faraday Member
**
Karma: 71
Posts: 6146
Baldengineer
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Okay. In that case I'm suspecting it is lines 6 or 22 of the code you still haven't posted.
Logged

Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.com

Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


I'm placing bets it is around line 12 or 47 of the code you didn't post.
[/quote]

Clever...   smiley-lol Yeah, I figured that would come up, but I don't think there were even 12 lines of code in total in the digitalWrite or analogWrite sketches I tried (corresponding to the proper pin types).
Logged

Austin, TX
Offline Offline
Faraday Member
**
Karma: 71
Posts: 6146
Baldengineer
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm not use to troubleshooting nonexistent code so well.  Obviously it is line 5.  Hard to believe you missed it!
Logged

Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.com

Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm sure there will be yet another comment on not posting code here, but is there a distinction beyond calling different pins and tx/rx ports on an Uno and Mega?  If not, shouldn't identical code working properly on one board and not another be an indication that the problem is elsewhere?
Logged

2nd star on the right
Offline Offline
Full Member
***
Karma: 0
Posts: 103
Everything I am is classified under the official secreats act!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

You did install the Mega's drivers and set the board preference to the correct mega did you?
I'm using the mega adk that uses a separate driver config!
Logged

Sorry for the noobish post but my knowledge is 10 years out of date!

Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

To be fair, here is an example (I just tried running it again).  This is the example code provided with the IDE under basic > blink.

/*
  Blink
  Turns on an LED on for one second, then off for one second, repeatedly.
 
  This example code is in the public domain.
 */


void setup() { 
  // initialize the digital pin as an output.
  // Pin 13 has an LED connected on most Arduino boards:
  pinMode(13, OUTPUT);     
}

void loop() {
  digitalWrite(13, HIGH);   // set the LED on
  delay(1000);              // wait for a second
  digitalWrite(13, LOW);    // set the LED off
  delay(1000);              // wait for a second
}


I do know that I have the proper board selected (Mega 2560), but I'm not sure about drivers... do you mean bootloader?  If so, that's something I haven't yet ventured into, but I had assumed  it would come preloaded with the correct bootloader.  Or maybe there are some drivers I'm not familiar with?

Logged

Forum Administrator
Cambridge, MA
Offline Offline
Faraday Member
*****
Karma: 12
Posts: 3538
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hmm, if blink isn't working there's definitely some issue.  What happens when you try to upload?  What operating system are you on?  Which version of the Arduino software are you using?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Mellis-

Uploading seems to work as expected and completes without throwing any errors.  I'm working on Lion OSX, using Arduino 1.0 at the moment (I'll need to update to 1.0.1 it seems), but I've also tried with 0022.  I'll update to 1.0.1 here and see if there's any magic there.
Logged

Pages: [1]   Go Up
Jump to: