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!

-----Original Message-----
From: Chris Albertson <albertson.ch...@gmail.com> 
Sent: December 2, 2020 6:20 PM
To: Enhanced Machine Controller (EMC) <emc-users@lists.sourceforge.net>
Subject: Re: [Emc-users] USB - Serial question

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.  The host
(Linux) is constantly polling the USB port

So let's say the device was faster than the PC.   then the device would
wait for "setup packets" before enumerating.  What if the PC sent "setup"
before the device was alive.  Then nothing happens and the PC keeps "setup"
until the device boots.

I think this is done 1000 times per second so the connection is started only
a millisecond after the slower end is running.  Then the next thing is they
have to agree on speed and power usage.

The protocol takes care of one being faster, power, and which USB standard
is to be used.

I don't think you need to even fully understand if you use a USB library to
handle it.

On Wed, Dec 2, 2020 at 1:04 PM John Dammeyer <jo...@autoartisans.com> wrote:

>
>
> > From: Chris Albertson [mailto:albertson.ch...@gmail.com]
> > OK, then you likely don't need a FT232 chip.   The microcontroller,
> > whichever one you use, will likely have USB2 built-in.   Or just make
> sure
> > it does, so many chips have this.
> > On Wed, Dec 2, 2020 at 12:00 PM <ken.stra...@gmail.com> wrote:
> >
> > > To clarify:
> > > I am working on an accessory for a Tormach mill running PathPilot 
> > > (a flavour of LinuxCNC). It is for personal use so I don't need to 
> > > especially
> worry
> > > about product cost but obviously I'd rather not spend a lot on
> something
> > > that may eventually be abandoned when I get a better idea. I could
> modify
> > > the Tormach source code to solve my timing problems but I'd prefer 
> > > to
> use
> > > it
> > > unchanged to ease the installation of their updates.
>
> It appears the issues isn't so much whether a processor with internal 
> or external USB is used.  Even an internal one can be disabled so it 
> won't be enumerated by the PC OS.
>
> The problem appears to be that the Arduino project takes longer to do 
> what it does on start-up than LinuxCNC does to send a couple of 
> requests out the USB/Serial port.
>
> There are two problems as I see it.
> 1. If you wake up the USB too soon but don't listen to it then you 
> miss the messages and hang then waiting for them.
> 2. If you don't initialize the USB port then from LinuxCNC perspective 
> the device doesn't exist and it probably won't initialize or respond
anymore.
>
> Since I don't know exactly what Ken is expecting from the Tormach 
> software it's hard to give really good suggestions.  I'd make opening 
> the Serial Port for the USB connection the highest priority operation in
the Arduino
> project.   Now at least you can get the messages.
>
> With this in mind what does the Tormach do if the USB is not plugged in.
> Then after the Ardunio has powered up, done the motion control 
> operations it needs to do and is ready, you plug in the USB?
>
> Does the Tormach then evaluate that there is now a serial port and 
> send those one or two messages?
>
> Ie. First evaluate all the permutations on the Tormach side.  You may find
> you have no choice but to modify the Tormach.    Or alternatively you lie
> to the Tormach and tell it you are ready when you aren't.  But then 
> hold off on any other commands from it until you are.
>
> Of course if that means "Is the Tool changer out of the way so I can 
> home?" question may need an NO even if it is.  Then a YES after the 
> Arduino is done.
>
> John Dammeyer
>
>
>
>
>
> _______________________________________________
> 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



_______________________________________________
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to