The problem is with the USB device. If a FT232 chip is used it seems to be doing the enumeration as soon as it is plugged in. The simple solution is to avoid using the FT232 and use something else where you have control over when and if enumeration occurs.
The good news is that this "something else is free and you already have it -- the USB pins in the microcontroller. In the Arduino IDE what start the enumeration is the ".begin()" method that is called on the USB connection object. Look in the IDE File->Examples->USB to see an example The example that is built into the IDE uses a keyboard or mouse object but these are subclasses of something called (from my poor memory) "PluggableUSB" and the source code for PluggableUSB explains hove to make you own class that maybe you would call "MyCNC". Then when you call MyCNC.begin() the enumeration occurs and never before the call to MyCNC.begin() You can experiment with the examples provided. On Thu, Dec 3, 2020 at 5:23 AM <ken.stra...@gmail.com> wrote: > Les Newell wrote: > Another option is to regularly poll the serial buffer using > Serial.available() while you are initializing. If you don't spend too much > time in each loop() cycle, serialEvent() does most of the work for you. > > Polling with Serial.available is my current approach for normal processing > -- moving steppers, actuating pneumatics, controlling pump, etc -- and I'll > probably extend it to handling initialization. > > -----Original Message----- > From: Les Newell <les.new...@fastmail.co.uk> > Sent: December 3, 2020 7:28 AM > To: emc-users@lists.sourceforge.net > Subject: Re: [Emc-users] USB - Serial question > > I'm a software guy so here are some possible software solutions. > Why not wait for PathPilot to send it's setup query then do your > initialization? You still have plenty of time to do your initialization > while the machine is being homed etc. > Another option is to regularly poll the serial buffer using > Serial.available() while you are initializing. If you don't spend too much > time in each loop() cycle, serialEvent() does most of the work for you. > The hardest option would be to write your own serial interrupt routine and > do all of your serial in the ISR. You need to be comfortable with talking > directly to the ATMega hardware registers to do this. > > Les > > > > On 03/12/2020 00:53, ken.stra...@gmail.com wrote: > > Chris wrote: I think USB takes care of this for you. "set up" > > packets are sent by the host (the PC) and never by the device (mouse, > > disk, or whatever) The device never starts doing anything until after it > hears from the host. > > > > You've precisely described my problem! I need to do somewhat time > > consuming initialization -- home some steppers, actuate a pneumatic > > cylinder, prime a pump, verify coolant pressure, etc. Soon after > > PathPilot starts it scans for my USB device and, if found, sends a > > query to ensure that I'm actually alive. If I ignore or reject the > > alive query then PathPilot ignores me until my USB disconnects and then > reconnects. > > > > My problem is that I may not yet know if I will ever be alive and > > ready when I'm first asked. I have a plan to queue any host requests > > received while I'm still initializing. > > > > Probably more explanation than you wanted! > > > > _______________________________________________ > Emc-users mailing list > Emc-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/emc-users > > > > _______________________________________________ > Emc-users mailing list > Emc-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/emc-users > -- Chris Albertson Redondo Beach, California _______________________________________________ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users