usb com port number??

Discussion in 'Mac Programming' started by unixperience, Jan 26, 2011.

  1. macrumors regular

    Jul 21, 2010
    Hello, I am trying to program a microcontroller and have a usb to serial converter.
    the program needs to know which usb port I'm using. all i could find was the device address
    I've looked in the /dev folder for tty.usb or cu.usb but there is no usb listing in my /dev folder!!!
    Any idea how I find out what port to use? here is the sample linux code if this helps anyone

    avrdude -pm644p -P/dev/ttyUSB0 -cbutterfly -b57600 -u -U flash:w:Lesson1.hex -F

    basically I need to change the ttyUSB0 to whatever port I am actually using, thanks for any help you can give
  2. macrumors 6502a

    Mar 19, 2008
    North Shore, MA
    Have you installed the drivers for the USB adaptor?
  3. Moderator


    Staff Member

    Aug 16, 2005
    New England
    Yeah, unfortunately there are no standard drivers for these beasts unlike mass storage or HID.

    I recommend the Keyspan adapters for their great support software around the drivers. Expensive, but they work.

  4. thread starter macrumors regular

    Jul 21, 2010
    the adapter I have is for a school project. It is supposed to work with mac, unfortunately everyone has just used windows for the project and can't quite remember how to get it to work with mac.

    the adapter is for an amtel AVR device. if that helps anyone. I just can't download anything to my chip because I don't know how to identify the usb port I'm using
  5. macrumors 6502a

    Mar 19, 2008
    North Shore, MA
    You need to figure out what controller chip the adapter is using and install the correct drivers for it. USB to serial adaptors will not work out of the box.

    The most common ones are:
    Prolific PL-2303
    FTDI FT232R
  6. Moderator


    Staff Member

    Aug 16, 2005
    New England
    Can you post a picture or any identifying marks from it?

  7. macrumors 68000


    Feb 11, 2010
    Open up the System Profiler and see if the device actually shows up under the USB heading.

    If it is actually working, it could be any number of devices:


    The best way to check would just to unplug it, then plug it in and type in an already open terminal:

    ls -alrt /dev/

    If the device is actually working, then the relevant device or device folder will be towards the very bottom (and SHOULD have something to do with usb, tty or cu).
  8. macrumors 6502

    Jun 23, 2003
    This is a somewhat roundabout way, but I've found it much easier to use VMware to run a Linux VM in which to use my USB to serial converters than trying to get them to work in Mac OS X. Minimal setup and hassle, and some of the Mac serial drivers have a tendency to cause nasty kernel panics. YMMV.
  9. macrumors 68000


    Mar 16, 2008
    Australia, Perth
    Open Apple System Profiler and checking the USB Product ID and Manufacturer ID's. Then you might be able to determine what chipset the adapter is and get a driver for that.

    I have a Prolific USB to RS232 adapter (used in many older Nokia phone cables) that I use for my old Barcode Scanner.

    Apple System Profiler gives me:

    USB-Serial Controller:

    Version: 3.00
    Bus Power (mA): 500
    Speed: Up to 12 Mb/sec
    Manufacturer: Prolific Technology Inc.
    Product ID: 0x2303
    Vendor ID: 0x067b

    Installing the kext "osx-pl2303.kext" (installed by the Prolific driver) gives me


    in /dev

    another driver that works with this adapter is a different kext name and a different tty in dev.
  10. macrumors regular

    Oct 13, 2008
    Achewood, CA
    [previous post redacted]

    If you're using a USB programmer like an AVRISP mkII, all you need to do is say
    avrdude -P usb ...
    but I don't think that works when using a USB-to-serial cable.
  11. thread starter macrumors regular

    Jul 21, 2010
    Thanks for all the help. i found the device (it was in fact the FDTI FT232R) and using the alert command I found it was ttys000 or ttys001 depending on what usb i used(makes enough sense)

    unfortunately though it says "programmer is not responding"

    so thanks for your help thus far. if you want to take a swing at the new error, haha your more than welcome, but thanks to everyone for your help

    ps i have the windows on a vm and bootcamp to do this project currently, i just hate windows and it said it works on mac... i just don't know how, so that's why i was trying
  12. thread starter macrumors regular

    Jul 21, 2010
    actually I got it working!!!!

    thanks again everyone!!!!

    if anyone is interested, the alert command made about 5 changes when i plugged in the device(previously i used the most recent change to find the usb number)
    this time i used the first change (tty.usbserial-A1000bB2) plugged that into my makefile and it worked fine. so the lesson is don't just check the very last file change

Share This Page