Go Down

Topic: Serial port is grayed (Read 6093 times) previous topic - next topic

spirit1988

I couldn't make my Arduino work. I think the problem has to do with the board's firmware, because I'm using Linux (Kubuntu 12.04) and the Arduino model is Mega 2560. I've flashed the Arduino as it says in this tutorials:


http://arduino.cc/en/Hacking/DFUProgramming8U2
http://www.wayneandlayne.com/blog/2011/02/16/fixing-linux-firmware-issues-on-arduino-mega-2560/

But serial port is still grayed. I'm executing the program as root, so I shouldn't have any permission issue. Please, any1 can help me?

SurferTim

AFAIK, greyed means no permissions. Check two things.

Find the group assigned to the usb port. From a shell
Code: [Select]
cd /dev
ls tty*

You can replace the "tty*" with the device that is greyed out. See what group has r/w permissions. Mine shows the device owner as "root", and group "dialout" has r/w permission.

Then determine the groups your user belongs to. From a shell
Code: [Select]
groups

Insure you are a member of the group that has r/w permissions. With Ubuntu 11.10, the group required to access the Arduino is group "dialout".

perhof


Code: [Select]
cd /dev
ls tty*



to actually show the permissions it should be
ls -l tty*
but as mentioned - the IDE is already running as root so it shouldn't be permissions.

Is the board showing up as a serial port at all?
Code: [Select]
ls /dev/ttyACM*
You should see a device named ttyACMx. Most likely ttyACM0.

If not, check if it's listed if you issue this command
Code: [Select]
lsusb
I don't remember the exact name and ID of the board but I believe it starts with Atmel.

If it is listed by lsusb but doesn't show up as a tty device, search through /var/log/dmesg for errors related to the device id shown by lsusb.

If it is indeed listed as /dev/ttyACMx but doesn't show up in the IDE it might be locked by some other process.
There could also be something wrong with your Arduino installation/configuration.


spirit1988

Thanks for the replies! I have the ttyACM0 device when I connect my Arduino:

Code: [Select]

$ ls -l /dev/ttyACM*
crw-rw---- 1 root dialout 166, 0 jul 12 10:57 /dev/ttyACM0

$ dmesg
...
[ 2307.912135] usb 5-1: new full-speed USB device number 8 using uhci_hcd
[ 2308.114370] cdc_acm 5-1:1.0: ttyACM0: USB ACM device

$ lsub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 003: ID 5986:0102 Acer, Inc Crystal Eye Webcam
Bus 006 Device 003: ID 0458:003a KYE Systems Corp. (Mouse Systems) NetScroll+ Mini Traveler / Genius NetScroll 120
Bus 005 Device 008: ID 2341:0042 


The last one is the Arduino, the device with ID 2341:0042. The problem is that is not listed as Acmel right? I've already flashed the firmware so It shouldn't be the problem. Maybe I have some hardware issue?

SurferTim

It appears the entry in /dev is correct. I would log in to the computer as your user (not root) and check your groups. You must be a member of the dialout group to access the Arduino. From a shell:
Code: [Select]
groups

One of the entries should be dialout. If not, you must add it to your user.

spirit1988

I am:

Code: [Select]

$ groups
bizancio adm uucp dialout sudo admin vboxusers escritor burning


perhof

Quote
$ ls -l /dev/ttyACM*
crw-rw---- 1 root dialout 166, 0 jul 12 10:57 /dev/ttyACM0


You must be a member of the dialout group OR be root.

SurferTim

@perhof: That is true, but it should not be necessary to login as root. To me, that has bad security problems.

perhof


@perhof: That is true, but it should not be necessary to login as root. To me, that has bad security problems.


You're absolutely right.
I just thought that we shouldn't get stuck on device permissions when it was stated that it had been tried as root.
And I think that an Ubuntu user, at least the admin user created during install is a member of the dialup group by default.

SurferTim

I have done two installs of Ubuntu 11.10.

The first install of Ubuntu/Arduino (months ago) did not add the dialout group, but during the Arduino install, it threw a warning that it wasn't able to add the group. I added it, and all was well.

The second install (a couple weeks ago, same CD) successfully added the dialout group by itself sometime. I didn't check after the Ubuntu install, so maybe it was the Arduino install that changed that. It did ask for my password to modify the group, which the first install did not do. The second install worked right out of the box.  :)

So I have had mixed results with that, the latest being the best.

spirit1988

I forgot to mention, this is the error I got from Arduino program when I try to upload a script:

Code: [Select]

Tamaño binario del Sketch: 1.632 bytes (de un máximo de 258.048 bytes)
processing.app.SerialNotFoundException: Puerto serial '/dev/ttyACM0' no encontrado. ¿Estás seguro que seleccionaste el correcto del menú Herramientas > Puerto Serial?
at processing.app.Serial.<init>(Serial.java:191)
at processing.app.Serial.<init>(Serial.java:77)
at processing.app.debug.Uploader.flushSerialBuffer(Uploader.java:77)
at processing.app.debug.AvrdudeUploader.uploadViaBootloader(AvrdudeUploader.java:172)
at processing.app.debug.AvrdudeUploader.uploadUsingPreferences(AvrdudeUploader.java:67)
at processing.app.Sketch.upload(Sketch.java:1706)
at processing.app.Sketch.exportApplet(Sketch.java:1662)
at processing.app.Sketch.exportApplet(Sketch.java:1634)
at processing.app.Editor$DefaultExportHandler.run(Editor.java:2346)
at java.lang.Thread.run(Thread.java:662)


(translation: serial port '/dev/ttyACM0' was not found. Are you sure you've selected the right port in Tools / Serial port?)

I've manually changed the default port in .arduino/preferences.txt to /dev/ttyACM0 because it was other port (don't remember exactly what port). But I was having the same result.

Another curios thing is that if I do this:

Code: [Select]

echo "hello" >> /dev/ttyACM0


I get a response from the Arduino lights.

perhof

Is the TX light on or flashing while the board is connected?

If you for some reason still is affected by the old firmware bug and has a board sending lots of serial data this trick would make the port show up:
Keep the reset button pushed while plugging in the board to USB.
With the reset button still pressed, navigate to the tools menu and see if you can access the serial port menu while reset is held.
This prevents any sketches in flash to run but the 8u2 chip will be active and idling so the board should respond.

spirit1988

The TX light is on all the time the USB is connected. RX light is off. ON light is on.

I've tried doing what you say but nothing happened, I mean, I'm still having the port grayed out. Is there a way to debug the program? Should I download the source and try tu run it from source?

perhof

If TX is on all the time you're most likely locking the USB interface with to much serial data. It sounds an awful lot like a problem with the firmware.

Run this:
Code: [Select]
lsusb -v -d 2341: | grep -i bcdDevice
A good board should have version 0.01
A board that needs a new firmware would have 0.00

If it's not the firmware,
do you have access to a Windows computer? You could try connecting your board to that one and install the drivers. See if that makes a difference.
Maybe you could upload some other sketch (blink?) from Windows to see if it has anything to do with serial data from the sketch you have in flash.

Quote
Is there a way to debug the program? Should I download the source and try tu run it from source?


I'm not sure which program you are talking about.
If you mean the Arduino IDE, yes if the one you have is installed from some repository then download the latest version from arduino.cc instead, unpack it and just run it from the unpacked dir.
Which version are you using now?

spirit1988


If TX is on all the time you're most likely locking the USB interface with to much serial data. It sounds an awful lot like a problem with the firmware.

Run this:
Code: [Select]
lsusb -v -d 2341: | grep -i bcdDevice
A good board should have version 0.01
A board that needs a new firmware would have 0.00


I have 0.01 version. But I'm getting this message: Couldn't open device.

Code: [Select]

bizancio@bizancio-Aspire-5720Z:~/Escritorio/arduino-1.0.1$ lsusb -v -d 2341: | grep -i bcdDevice
Couldn't open device, some information will be missing
 bcdDevice            0.01


If I do a complete dump I got this data:

Code: [Select]

bizancio@bizancio-Aspire-5720Z:~/Escritorio/arduino-1.0.1$ lsusb -v -d 2341:

Bus 005 Device 003: ID 2341:0042  
Couldn't open device, some information will be missing
Device Descriptor:
 bLength                18
 bDescriptorType         1
 bcdUSB               1.10
 bDeviceClass            2 Communications
 bDeviceSubClass         0
 bDeviceProtocol         0
 bMaxPacketSize0         8
 idVendor           0x2341
 idProduct          0x0042
 bcdDevice            0.01
 iManufacturer           1
 iProduct                2
 iSerial               220
 bNumConfigurations      1
 Configuration Descriptor:
   bLength                 9
   bDescriptorType         2
   wTotalLength           62
   bNumInterfaces          2
   bConfigurationValue     1
   iConfiguration          0
   bmAttributes         0xc0
     Self Powered
   MaxPower              100mA
   Interface Descriptor:
     bLength                 9
     bDescriptorType         4
     bInterfaceNumber        0
     bAlternateSetting       0
     bNumEndpoints           1
     bInterfaceClass         2 Communications
     bInterfaceSubClass      2 Abstract (modem)
     bInterfaceProtocol      1 AT-commands (v.25ter)
     iInterface              0
     CDC Header:
       bcdCDC               10.01
     CDC ACM:
       bmCapabilities       0x06
         sends break
         line coding and serial state
     CDC Union:
       bMasterInterface        0
       bSlaveInterface         1
     Endpoint Descriptor:
       bLength                 7
       bDescriptorType         5
       bEndpointAddress     0x82  EP 2 IN
       bmAttributes            3
         Transfer Type            Interrupt
         Synch Type               None
         Usage Type               Data
       wMaxPacketSize     0x0008  1x 8 bytes
       bInterval             255
   Interface Descriptor:
     bLength                 9
     bDescriptorType         4
     bInterfaceNumber        1
     bAlternateSetting       0
     bNumEndpoints           2
     bInterfaceClass        10 CDC Data
     bInterfaceSubClass      0 Unused
     bInterfaceProtocol      0
     iInterface              0
     Endpoint Descriptor:
       bLength                 7
       bDescriptorType         5
       bEndpointAddress     0x04  EP 4 OUT
       bmAttributes            2
         Transfer Type            Bulk
         Synch Type               None
         Usage Type               Data
       wMaxPacketSize     0x0040  1x 64 bytes
       bInterval               1
     Endpoint Descriptor:
       bLength                 7
       bDescriptorType         5
       bEndpointAddress     0x83  EP 3 IN
       bmAttributes            2
         Transfer Type            Bulk
         Synch Type               None
         Usage Type               Data
       wMaxPacketSize     0x0040  1x 64 bytes
       bInterval               1



If it's not the firmware,
do you have access to a Windows computer? You could try connecting your board to that one and install the drivers. See if that makes a difference.
Maybe you could upload some other sketch (blink?) from Windows to see if it has anything to do with serial data from the sketch you have in flash.


In Windows XP worked! I could be able to load a program on my Arduino (the blinking LED example). But... the reality is that I'm not confortable working with Windows and I'll keep trying to make it work in my Kubuntu install. By the way, my Kernel version is "3.2.0-24-generic".


Quote
Is there a way to debug the program? Should I download the source and try tu run it from source?


I'm not sure which program you are talking about.
If you mean the Arduino IDE, yes if the one you have is installed from some repository then download the latest version from arduino.cc instead, unpack it and just run it from the unpacked dir.
Which version are you using now?



I'm using arduino IDE 1.0.1.

Now I've loaded a script into the board using Windows, TX light is off all the time. Just L light is blinking every second (the same for the Led on PIN 13). But, I'm still having the menu grayed.

Go Up