|
From: Tim R. <ti...@pr...> - 2024-06-09 18:01:30
|
Kustaa Nyholm wrote: > > The device enumerates fine and the HID descriptors are fetched and all > that initial stuff works. > > I only use EP2 to talk to the device, I only send and received 64 byte > reports. So, EP02 and EP82 are both interrupt pipes? > When it fails I the read polls always timeout. Re-opening the device > restores normal communication. > > Question: am I correct that apart from possible renumeration my device > firmware cannot know > if the device handle is closed or opened on the host side? No. The only thing it will notice is that it stops getting IN or OUT tokens during its scheduled slot time -- it no longer gets a chance to send or receive. > My question is if it is ok to just rely on the assumption that when > ever the SIE in the MCU > signals for the EP2 that the buffer is available not owned by the > firmware > there is a new output report (out EP) or I can fill in the buffer with > next input report (in EP)? That's a question that is very specific to the PIC 18F4550, which has a rather primitive interface. However, the input and output sides of an endpoint are completely unrelated. Activity on one should not impact the other in any way. That's a common misconception in USB. > I have assumed that the USB SIE takes care of the communication up to > the transfer level, > transmitting, re-transmitting and ACKing as necessary or NACK:in if my > main loop has > not have time processes the previous transfer. > > Is this correct? In general, yes. The 18F4550 hardware should be handling the wire-level interface, even if your loop is mucked up. Have you done any packet tracing, as suggested on the PIC mailing list? > I do have an interrupt service that handles all the EP0 control stuff. > But once the > communication with the EP2 has started I should not see any of that > stuff anyway > unless the device gets enumerated? You can't rely on that. Since you are a HID device, the HID driver gets involved here. It might be sending status requests to your control endpoint on its own. I'm just making that up, however -- I don't know whether it actually does. -- Tim Roberts, ti...@pr... Providenza & Boekelheide, Inc. |