Arduino Forum

Using Arduino => Introductory Tutorials => Topic started by: arduiko on May 22, 2018, 03:27 am

Title: Learn how to delete COM port to make the plug and play instant, no more delay
Post by: arduiko on May 22, 2018, 03:27 am
Hello,

So to doing that is very simple, but keep in mind that if you want to be able to reupload a sketch to your board again, you need to reburn the bootloader on your board via a programmer as USBTinyISP, because the COM port is used when uploading a sketch, so the reburn will give back the COM port.

Also COM port is used for Serial Communication, so if you remove it, you will only have HID protocol to communicate with your PC.

Here's the instruction:
- Just put in comment the line below in {Arduino Path}\hardware\arduino\avr\cores\Arduino\USBCore.cpp
Code: [Select]

static u8 SendInterfaces()
{
    u8 interfaces = 0;

    // To comment to suppress COM port
        CDC_GetInterface(&interfaces);       
        PluggableUSB().getInterface(&interfaces);

    return interfaces;
}

//  Endpoint 0 interrupt
ISR(USB_COM_vect)
Code: [Select]

else
{
// To comment to suppress COM port
InitControl(setup.wLength);     //  Max length of transfer
ok = ClassInterfaceRequest(setup);   
}
Title: Re: Learn how to delete COM port to make the plug and play instant, no more delay
Post by: lastchancename on Jun 23, 2018, 03:35 am
You may like to rephrase your subject and post - to become more obvious to beginners that are looking for a fast-booting program.

Experienced devs already know these tricks, but your explanation while concise is hard to follow.
Perhaps it's your second language.  Also many devs will burn the code using ISP and eliminate the bootloader as well, so the reference to the serial (bootloader) startup delay becomes irrelevant.

One small point is that Arduinos don't have a COM port - so that needs to be rewritten.
You get the idea.
A useful post, but of no use if beginners can't understand why you wrote it.

Also CAUTION - you are teaching beginners to implement a non-standard platform that can be achieved in other ways.
Title: Re: Learn how to delete COM port to make the plug and play instant, no more delay
Post by: Robin2 on Jun 23, 2018, 09:42 am
I can see how some people might find this technique useful but IMHO this Topic is much too advanced to be in the Introductory Tutorials Section of the Forum. Perhaps move it to the Exhibition / Gallery section.

Leaving it here will just have the effect that someone without adequate experience will try to implement it and will end up with a non-functioning Arduino and a very poor impression of Arduino products.

...R
Title: Re: Learn how to delete COM port to make the plug and play instant, no more delay
Post by: arduiko on Jun 27, 2018, 12:55 pm
Why do you care about SendInterfaces(), do you use it for you application ?
Else yes it's used elsewhere but it's not avoid the hardware to run properly if you modify it like I did.
If you try to delete this function and all its call, Arduino will not respond, that's why I did in that way
Title: Re: Learn how to delete COM port to make the plug and play instant, no more delay
Post by: arduiko on Jul 13, 2018, 07:30 pm
I made an error :/

Sorry if you experienced not working arduino, but if you have take an ISP programmer as I said, you was able to fix the problem.

So to delete the COM port, you only need to comment this line and not the others:

Code: [Select]

static u8 SendInterfaces()
{
   u8 interfaces = 0;

   // To comment to suppress COM port
       CDC_GetInterface(&interfaces);

   PluggableUSB().getInterface(&interfaces);

   return interfaces;
}