New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: allow multiple VID/PID pairs when detecting serial ports #632

Closed
nopdotcom opened this Issue Apr 23, 2016 · 1 comment

Comments

Projects
None yet
3 participants
@nopdotcom

nopdotcom commented Apr 23, 2016

PlatformIO Version (platformio --version): PlatformIO, version 2.9.0.dev0

Description of problem

Some boards’ serial ports don’t get auto-discovered when they’re using a variant PID.

VID/PID pairs can vary for a board depending on the mode they’re in. I’m on a MediaTek LinkIt 7688 DUO. In pure bootloader mode, it shows up as 0E8D:AB00; when running a sketch, it uses 0E80:AB0**1**.

Detection parameters are defined in the boards.txt: https://github.com/MediaTek-Labs/linkit-smart-7688-duo-arduino/blob/master/mtk/avr/boards.txt#L10

smart7688.vid.0=0x0E8D
smart7688.pid.0=0xAB00
smart7688.vid.1=0x0E8D
smart7688.pid.1=0xAB01

I don’t think there is any need need to support multiple -DUSB_PID settings. In the 7688 DUO case, we always want to use AB0**1** when building; when looking for the serial port to upload, just detect the AB00 as well.

This is used quite a bit in core Arduino; the Leonardo definition is an example: https://github.com/arduino/Arduino/blob/master/hardware/arduino/avr/boards.txt#L267

leonardo.vid.0=0x2341
leonardo.pid.0=0x0036
leonardo.vid.1=0x2341
leonardo.pid.1=0x8036
leonardo.vid.2=0x2A03
leonardo.pid.2=0x0036
leonardo.vid.3=0x2A03
leonardo.pid.3=0x8036

In this case, the PID 0036 is the pure bootloader, and the 8036 is the CDC ACM device.

VID 2341 belongs to “Arduino SA”, and 2A03 belongs to “dog hunter AG”. This is fallout from the Arduino.cc breakup.

(For more fun, see the Arduino Micro definition at https://github.com/arduino/Arduino/blob/master/hardware/arduino/avr/boards.txt#L306 which tries to deal with the Arduino vs Genuino mess. I recommend totally ignoring this.)

@ivankravets ivankravets added this to the 2.9.0 milestone Apr 23, 2016

@ivankravets

This comment has been minimized.

Member

ivankravets commented Apr 23, 2016

@valeros I propose to replace vid and pid by hwid. Hardware ID should be a list of pairs [vid, pid]. For example,

    "leonardo": {
        "build": {
            "core": "arduino",
            "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_LEONARDO",
            "f_cpu": "16000000L",
            "mcu": "atmega32u4",
            "usb_product": "Arduino Leonardo",
            "variant": "leonardo",
            "hwid": [
              ["0x2341", "0x8036"],
              ["0x0036", "0x2A03"]
            ]
        },
        "frameworks": ["arduino"],
        "name": "Arduino Leonardo",
        "platform": "atmelavr",
        "upload": {
            "disable_flushing": true,
            "maximum_ram_size": 2560,
            "maximum_size": 28672,
            "protocol": "avr109",
            "require_upload_port" : true,
            "speed": 57600,
            "use_1200bps_touch": true,
            "wait_for_upload_port": true
        },
        "url": "http://arduino.cc/en/Main/arduinoBoardLeonardo",
        "vendor": "Arduino"
    }

The first item of array should be used for https://github.com/platformio/platformio/blob/develop/platformio/builder/scripts/frameworks/arduino.py#L121

Please update all boards with https://github.com/arduino/Arduino/blob/master/hardware/arduino/avr/boards.txt . Also need to add VID/PID from @arduino-org

valeros added a commit that referenced this issue Apr 25, 2016

ivankravets added a commit that referenced this issue Apr 28, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment