usb com port number??

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

  1. macrumors regular

    Joined:
    Jul 21, 2010
    #1
    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

    Joined:
    Mar 19, 2008
    Location:
    North Shore, MA
    #2
    Have you installed the drivers for the USB adaptor?
     
  3. Moderator

    balamw

    Staff Member

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

    I recommend the Keyspan adapters http://www.tripplite.com/cables/usb-adapters-/en/3914 for their great support software around the drivers. Expensive, but they work.

    B
     
  4. thread starter macrumors regular

    Joined:
    Jul 21, 2010
    #4
    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

    Joined:
    Mar 19, 2008
    Location:
    North Shore, MA
    #5
    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
    Keyspan/Tripplite
     
  6. Moderator

    balamw

    Staff Member

    Joined:
    Aug 16, 2005
    Location:
    New England
    #6
    Can you post a picture or any identifying marks from it?

    B
     
  7. macrumors 68000

    ulbador

    Joined:
    Feb 11, 2010
    #7
    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:

    /dev/usb/tts/0
    /dev/tty.usbserial
    /dev/tty.USBSERIAL
    /dev/cu.BIGLONGDEVICENAME

    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

    Joined:
    Jun 23, 2003
    #8
    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

    MacTech68

    Joined:
    Mar 16, 2008
    Location:
    Australia, Perth
    #9
    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

    tty.PL2303-3B1

    in /dev

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

    Joined:
    Oct 13, 2008
    Location:
    Achewood, CA
    #10
    [previous post redacted]

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

    Joined:
    Jul 21, 2010
    #11
    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

    Joined:
    Jul 21, 2010
    #12
    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