Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 16 of 16

Thread: Connection lost to Arduino after editing VENDOR_ID and PRODUCT_ID, How to recover?

  1. #1
    Senior Member
    Join Date
    Mar 2015
    Posts
    295

    Connection lost to Arduino after editing VENDOR_ID and PRODUCT_ID, How to recover?

    Hi,

    I am trying to make Teensy 4.1 look like LunchControl XL MIDI controller so that SD MixPre would accept it and connect.

    Using name.c I got MIDI and Manufacturer name changed, but the MixPre did not recognise the device

    So I changed in usb_desc.h

    Code:
    #elif defined(USB_MIDI_SERIAL)
      #define VENDOR_ID		0x1235
      #define PRODUCT_ID		0x0061
    and that worked, the MixPre now recognises there device (but some problems still on initialisation)

    The problem now is that Arduino does not see the Teensy 4.1, How to recover that?

  2. #2
    Senior Member
    Join Date
    Mar 2015
    Posts
    295
    To add,

    Arduino sees a serial port (generic port not teensy) and serial monitor works on it as it should, but when loading the sketch I get

    "No Teensy boards were found on any USB ports of your computer.
    Please press the PROGRAM MODE BUTTON on your Teensy to upload your sketch.
    An error occurred while uploading the sketch"

    And pressing the button does not help

  3. #3
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    27,366
    Before you fix this, could you take a moment to save the HEX file you uploaded to your Teensy? I'd like to try it here and see if I can reproduce the problem. To save the HEX file, in Arduino click Sketch > Export Compiled Binary. To share it here, if using Quick Reply click Go Advanced to get to the editor which lets you attach a file to your message.

    To recover your Teensy back to its original state, press and hold the pushbutton for 13 to 17 seconds. At the 13 second mark, the red LED near the USB connector will blink to give you the visual indication you're at the 4 second window where releasing the button will cause full memory wipe and restore to a known-good program. When you release, the red LED will turn on bright while it's erasing the flash. It's slow. over 1 minute for Teensy 4.1. Just let it run. Eventually your board will reboot and the orange LED will blink, as it did when the board was brand new. Your PC should detect Teensy as a RawHID device (not Serial, no COM port) as it was when brand new. The default program for a brand new Teensy is RawHID because older versions of Windows don't necessarily have the serial driver, but HID drivers are always present in all versions of Windows.

  4. #4
    Senior Member
    Join Date
    Mar 2015
    Posts
    295
    After all pressing the program button worked, it just does not look like that on Arduino IDE

    So when I changed usb_desc.h back to normal and pressed the button it loaded and after that works as normal.

    Would be great to be able to change the VENDOR_ID and PRODUCT_ID directly from code. and if possible that Arduino IDE would still load normally using a selected port, or maybe some way to force it to do that. (other than the button, have to open a box to access that)

    Thanks for the recovery instructions, will try that also
    Last edited by Garug; 12-08-2022 at 08:37 AM.

  5. #5
    Senior Member
    Join Date
    Mar 2015
    Posts
    295
    A side question as related to editing the libraries.

    The LaunchControl XL is a 12 Mbit/sec device, could this be the reason for remaining initialisation connection problems?

    I found the

    USB1_PORTSC1 |= USB_PORTSC1_PFSC; // force 12 Mbit/sec

    in usb.c but did not test it yet. Rather would not touch the libraries.

    Edit: good news with the LaunchControl XL, got it connected to MixPre via Teensy 4.1 so now can monitor the messages to finally get rid of LaunchControl XL and just control the MixPre. But this requires changing the VENDOR_ID and/or PRODUCT_ID, did not test yet if both are needed.
    Last edited by Garug; 12-08-2022 at 08:49 AM.

  6. #6
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    27,366
    Sounds like you're not going to share the HEX file which made it unresponsive to pressing the pushbutton?

  7. #7
    Senior Member
    Join Date
    Mar 2015
    Posts
    295
    No problem sharing that but I solved the problem before I came back here, and the button press worked anyway. I thought not needed and should be easy to reproduce just changing the

    Code:
    #elif defined(USB_MIDI_SERIAL)
     // #define VENDOR_ID		0x16C0
     // #define PRODUCT_ID		0x0489
    
      #define VENDOR_ID		0x1235
      #define PRODUCT_ID		0x0061
    But the current code has just the same problem; I will see on next post If I can figure out how to post it

  8. #8
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    27,366
    After uploading a program which uses different USB ID numbers, clicking Upload again in Arduino can't put Teensy board into programming mode because the software on the PC side don't know about the different ID numbers. But just a quick press of the pushbutton is supposed to get back into programming mode. The 15 second button press is not supposed to be necessary.

    If you somehow created a HEX file that made Teensy 4.1 unresponsive to a quick press of the pushbutton, I would really like to recreate that problem here and investigate how it happened.

  9. #9
    Senior Member
    Join Date
    Mar 2015
    Posts
    295
    well it says

    "The following errors occurred:

    LaunchControlXL_V002.ino.TEENSY41.hex: Invalid File"

    So here it is

    https://drive.google.com/drive/folde...usp=share_link

  10. #10
    Senior Member
    Join Date
    Mar 2015
    Posts
    295
    Ok, so maybe this is not what you are looking for, The button works, it is just Arduino IDE does not indicate the load was success.

    But a question. For this case there is no need to change the VENDOR_ID and PRODUCT_ID for Serial, only for MIDI. Would it be possible to change those only for MIDI?

  11. #11
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    27,366
    I tried to download the file from Google Drive, linked from msg #9, but I do not have access.

    Click image for larger version. 

Name:	screenshot.png 
Views:	5 
Size:	65.2 KB 
ID:	29959

    If you want me to investigate this problem, please post the HEX file here on this forum. To do so, in the Quick Reply editor click Go Advanced. The full edit lets you attach a file to your message.

  12. #12
    Senior Member
    Join Date
    Mar 2015
    Posts
    295
    Sorry, now it should be accessible.

  13. #13
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    27,366
    Please post the file here on this forum, not Google.

  14. #14
    Senior Member
    Join Date
    Mar 2015
    Posts
    295
    I tried, it did not work.

    Anyway I think the problem just was that the Product and Vendor ID are not correct so Arduino IDE does not recognise the board.

    It has been now working fine by just pressing the button on board (but the IDE does not indicate the load was success, but it was)

    The question, would it be possible to change Product ID and Vendor just for MIDI?

  15. #15
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    16,698
    If pushing the Button works - then just select 'Verify' Build then press the Button when complete.

    When full Upload is selected the IDE looks for the return value of the call to the Teensy Loader and that will never work in this case, so the IDE can only show 'fail' - and pushing the Button is not something the IDE can monitor.

    Not sure about selectively changing the PID_VID 'partially': Seems not as the Device is a single unit presented to the Host with multiple capabilities.

  16. #16
    Senior Member
    Join Date
    Mar 2015
    Posts
    295
    If it is not possible to have VENDOR_ID and PRODUCT_ID separately defined for MIDI and Serial, would it be possible to define them via name.c like MANUFACTURER_NAME and PRODUCT_NAME can be, how?

    This is what I have now on the name.c that is on same directory as the .ino

    Code:
    // To give your project a unique name, this code must be
    // placed into a .c file (its own tab).  It can not be in
    // a .cpp file or your main sketch (the .ino file).
    
    #include "usb_names.h"
    
    // Edit these lines to create your own name.  The length must
    // match the number of characters in your custom name.
    //Launch Control XL n
    
    
    
    
    #define MIDI_NAME   {'L','a','u','n','c','h',' ','C','o','n','t','r','o','l',' ','X','L'} // Launch Control XL
    #define MIDI_NAME_LEN  17
    #define MANU_NAME   {'F', 'o', 'c', 'u', 's', 'r', 'i', 't', 'e', ' ', 'A', '.', 'E', '.', ' ', 'L', 't', 'd'}
    #define MIDI_MANU_LEN  18
    
    // Do not change this part.  This exact format is required by USB.
    
    struct usb_string_descriptor_struct usb_string_product_name = {
            2 + MIDI_NAME_LEN * 2,
            3,
            MIDI_NAME
    };
    
    struct usb_string_descriptor_struct usb_string_manufacturer_name = {
            2 + MIDI_MANU_LEN * 2,
            3,
            MANU_NAME
    };

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •