Pages: [1] 2   Go Down
Author Topic: USB communications on mega 2560  (Read 1001 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Jr. Member
**
Karma: 0
Posts: 64
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I've just bought a mega 2560.  first thing was to connect it to working ubuntu arduino 1 ide and load up one of the string examples via usb cable.  it appears to load ok, flashing lights, etc.  but no communication between arduino terminal and program.

checked same with uno which works fine, checked that i had selected mega 2560 and i had. Is it possible that you can not serial.print to the usb port? gaaakkk!

it's ok, I'm hoping this is something stupid i've done, but i would have expected usb serial communication to work same on uno and mega 2560.

what gives?
Logged

Toronto, Canada
Offline Offline
Edison Member
*
Karma: 2
Posts: 1234
"Keep it R.E.I.L. - "Research, Experiment, Investigate and Learn"
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Did you check the Hardware setting and ports on your PC if it match the Arduino USB port ?

I not sure if you need a new driver for the Mega board...
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 64
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm running Ubuntu 10.10 Linux, not windows. 
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 64
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

i did get a few of the simple example routines to work, but they are intermittent. could be that the shield is the problem. the pinouts agree, but maybe there is a problem with the reset circuit.  need to think about this some more.

Logged

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

i did get a few of the simple example routines to work, but they are intermittent. could be that the shield is the problem. the pinouts agree, but maybe there is a problem with the reset circuit.  need to think about this some more.

You've shown no code and now you mention a mysterious "shield."  I'm not sure what kind of answers you are expecting.  Except: Yes, you can Serial.print() from a Mega 2560 just like you can with a Uno.  So something else is up.
Logged

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

Offline Offline
Jr. Member
**
Karma: 0
Posts: 64
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

here'a the code, look familiar?:
Code:
/*
  Character analysis operators
 
 Examples using the character analysis operators.
 Send any byte and the sketch will tell you about it.
 
 created 29 Nov 2010
 by Tom Igoe
 
 This example code is in the public domain.
 */

void setup() {
 
  // Open serial communications:
  Serial.begin(9600);

  // send an intro:
  Serial.println("send any byte and I'll tell you everything I can about it");
  Serial.println();
}

void loop() {
  // get any incoming bytes:
  if (Serial.available() > 0) {
    int thisChar = Serial.read();

    // say what was sent:
    Serial.print("You sent me: \'");
    Serial.write(thisChar);
    Serial.print("\'  ASCII Value: ");
    Serial.println(thisChar);

    // analyze what was sent:
    if(isAlphaNumeric(thisChar)) {
      Serial.println("it's alphanumeric");
    }
    if(isAlpha(thisChar)) {
      Serial.println("it's alphabetic");
    }
    if(isAscii(thisChar)) {
      Serial.println("it's ASCII");
    }
    if(isWhitespace(thisChar)) {
      Serial.println("it's whitespace");
    }
    if(isControl(thisChar)) {
      Serial.println("it's a control character");
    }
    if(isDigit(thisChar)) {
      Serial.println("it's a numeric digit");
    }
    if(isGraph(thisChar)) {
      Serial.println("it's a printable character that's not whitespace");
    }
    if(isLowerCase(thisChar)) {
      Serial.println("it's lower case");
    }
    if(isPrintable(thisChar)) {
      Serial.println("it's printable");
    }
    if(isPunct(thisChar)) {
      Serial.println("it's punctuation");
    }
    if(isSpace(thisChar)) {
      Serial.println("it's a space character");
    }
    if(isUpperCase(thisChar)) {
      Serial.println("it's upper case");
    }
    if (isHexadecimalDigit(thisChar)) {
      Serial.println("it's a valid hexadecimaldigit (i.e. 0 - 9, a - F, or A - F)");
    }

    // add some space and ask for another byte:
    Serial.println();
    Serial.println("Give me another byte:");
    Serial.println();
  }
}

Exact same thing that comes with the download.  After more fussing, I find if i load it to the MEGA 2560 from Ubuntu installation of Arduino 1 IDE, it appears to load but will not run and the "L" led flashes slowly. If i change the board to UNO, and load it same way it works.  I thought it might matter WHEN I switched the board selection in the IDE so i went all the way out, then reloaded IDE, switched board to MEGA 2560, and no joy - works with UNO, doesn't with MEGA.

Now we come to the good part.  It works fine with either board on the Windows XP Arduino 1.0 IDE installation. AND, if I load it using the Windows IDE, it will run both on Windows and Ubuntu, so it must have something to do with the way the IDE loads the code under Ubuntu - possibly something's messed up in the Ubuntu cores, or ??

So i submit that there is a difference in the way the Ubuntu loader works between the UNO and the MEGA 2560 which matters.  If there is a difference between the UNO and MEGA loaders in Windows, it doesn't matter.

I might add that I had the same trouble everyone else has loading new sketches over earlier short sketches on the UNO from Ubuntu until I started putting delay(5000) at the head of the setup.  Before i caught on to that, I would have to go to the windows installation, which didn't seem to have this timing interface problem, and load a trivial example, which i could then overwrite in ubuntu.

to summarize, problem could be:
1. UNO and MEGA do not treat USB port same and it matters on Linux but not on pc.
2. Ubuntu loader that works on UNO but not on MEGA has software problem in cores (maybe)?
3. soemthing else related to Ubuntu handling of loading on MEGA.

I'm going to try loading my serious code from Windows next to see if it loads properly.

What does the slow flashing "L" mean?


Logged

Miramar Beach, Florida
Offline Offline
Faraday Member
**
Karma: 116
Posts: 5400
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Where did you get the IDE v1.0? Is that version now available on the Ubuntu repository, or did you download it from the Arduino site?

I haven't checked the repository version in a while.
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 64
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Tim,
both windows and ubuntu IDE's were downloaded from Arduino site.  A more complex sketch which loads on UNO from Ubuntu IDE does not load correctly on MEGA and produces flashing L. So far, i have not been able to load anything to the MEGA from Ubuntu Arduino 1.0 IDE.  I'm running Ubuntu 10.10 and I surely cannot be the only one, can I?

This isn't something that is going to shatter my day, but it does seem odd.  It could be that there actually is a bug in the Ubuntu MEGA load, or the Ubuntu based libraries and core contain something that's hostile to usb serial, that is not in the pc version.  

now that I know i can make this work by loading on windows, it isn't a big problem, but I'd much rather be running on Linux.

It also appears that Sparkfun's Screwshield which is a very nice prototyping connection board that works fine with the UNO, doesn't work with the MEGA.  Symptom is bizarre LED flashing which bespeaks reset interface on shield??

i might add that the traces on the prototyping section of this board are connected in a pattern which seems beyond my imagination to use.  It would have been nice to have a row down the middle that would support installation of max232 so i could get some rs232 signals in and out, but if there is a way to do this without a lot of trace cutting which is difficult on this very well-made board, i havn't figured it out, but then topology was never a strong suit of mine.

If anyone wants to pursue any this, I'll be glad to try other things.

and thanks to all who tried to help me with this.

john
« Last Edit: February 17, 2012, 11:10:02 am by jferg » Logged

Miramar Beach, Florida
Offline Offline
Faraday Member
**
Karma: 116
Posts: 5400
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Did you download the Ubuntu repository version of the Arduino IDE before downloading v1.0 from the Arduino site?

I know this sounds strange, but I would recommend installing the IDE from the Ubuntu repository. It is not just the IDE it installs, but all the avr-gcc and avr-libc files will be upgraded to the debugged versions.

IDE v1.0 on Ubuntu v11.10 works great, if you download v0022 from the repository first. It does for me anyway.

Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 64
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Tim,
this sounds good.  I'll let you know.  urk! you say ubuntu 11.10?  I'm running 10.10.  is it possible that the debugged code is only available for 11.10 ?



best regards, john
« Last Edit: February 17, 2012, 12:23:55 pm by jferg » Logged

Miramar Beach, Florida
Offline Offline
Faraday Member
**
Karma: 116
Posts: 5400
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm not on my Ubuntu box right now. I am being held prisoner by a Windoze box. I imagine all version packages have been upgraded.

I used the Ubuntu "package manager" to install Arduino IDE. It advised me that it was going to upgrade other packages too (avr-gcc and avr-libc). After installation, when I ran it, it showed IDE v0022.

Later, when v1.0 was released, I downloaded it from the Arduino site and ran the arduino shell script from that folder. Works great.
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 64
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

it does seem likely that my ubuntu installation is screwed up.  synaptics loads 18 not 22 on 10.10,
so it looks like what i should do is waste the /usr/share/arduiono that's there, then install 22 then 1.0

it may be that my avr-libraries are also obsolete.

ah well............
Logged

Miramar Beach, Florida
Offline Offline
Faraday Member
**
Karma: 116
Posts: 5400
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I am kinda surprised. Maybe Ubuntu updates only the few most recent releases. As I recall, v0018 doesn't support the mega2560. Wish I could be more help.  smiley-sad
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 64
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

looks like i need to update Ubuntu to 11.10. nuts.
Logged

Miramar Beach, Florida
Offline Offline
Faraday Member
**
Karma: 116
Posts: 5400
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

FYI: Ubuntu 11.10 has a non-kde GUI. Some don't like it. It does take a bit of getting used to. I can adapt to almost anything.


Logged

Pages: [1] 2   Go Up
Jump to: