atom feed22 messages in org.freebsd.freebsd-usblibusb usb_interrupt_read hangs under...
FromSent OnAttachments
Xiaofan ChenApr 3, 2007 11:54 am 
Hans Petter SelaskyApr 3, 2007 12:26 pm 
Xiaofan ChenApr 3, 2007 1:34 pm 
Hans Petter SelaskyApr 3, 2007 2:42 pm 
Xiaofan ChenApr 3, 2007 11:55 pm 
Hans Petter SelaskyApr 4, 2007 7:37 am 
Xiaofan ChenApr 4, 2007 11:34 am 
Xiaofan ChenJul 4, 2007 5:32 pm 
Hans Petter SelaskyJul 5, 2007 3:24 pm 
Xiaofan ChenJul 8, 2007 12:25 am 
M. Warner LoshJul 8, 2007 5:11 am 
Xiaofan ChenJul 8, 2007 1:16 pm 
Xiaofan ChenJul 8, 2007 4:31 pm 
M. Warner LoshJul 8, 2007 8:00 pm 
Hans Petter SelaskyJul 9, 2007 4:35 pm 
Xiaofan ChenJul 10, 2007 1:27 am 
Xiaofan ChenJul 13, 2007 10:32 pm 
Hans Petter SelaskyJul 15, 2007 9:18 am 
Xiaofan ChenJul 16, 2007 3:44 pm 
Hans Petter SelaskyJul 17, 2007 5:55 am 
Xiaofan ChenAug 11, 2007 4:45 am 
Xiaofan ChenSep 22, 2007 3:47 am 
Subject:libusb usb_interrupt_read hangs under FreeBSD
From:Xiaofan Chen (xiao@gmail.com)
Date:Jul 4, 2007 5:32:51 pm
List:org.freebsd.freebsd-usb

On 4/4/07, Hans Petter Selasky <hsel@c2i.net> wrote:

On Wednesday 04 April 2007 01:55, Xiaofan Chen wrote:

On 4/3/07, Hans Petter Selasky <hsel@c2i.net> wrote:

Hi,

I think that your device is broken, and goes bad when it receives a clear-stall request for the interrupt pipe. That is not very uncommon.

Could you be more clearer? I'd like to communicate this problem to the firmware developer of PICKit 2 inside Microchip. Thanks.

The chip does not handle a clear-stall request on the control pipe to clear-stall on the interrupt pipe. The result is that the interrupt pipe stops, or at least all buffers are cleared.

I could be more detailed, but I think the developers will understand what I mean.

Sorry to dig out this again. I read a bit more on the firmware source code and I found the following. Seems a bit dubious. The USB controller used is Microchip 18F2550.

Any comments? Thanks in advance.

/****************************************************************************** * Function: void USBStallHandler(void) * * PreCondition: A STALL packet is sent to the host by the SIE. * * Input: None * * Output: None * * Side Effects: None * * Overview: The STALLIF is set anytime the SIE sends out a STALL * packet regardless of which endpoint causes it. * A Setup transaction overrides the STALL function. A stalled * endpoint stops stalling once it receives a setup packet. * In this case, the SIE will accepts the Setup packet and * set the TRNIF flag to notify the firmware. STALL function * for that particular endpoint pipe will be automatically * disabled (direction specific). * * There are a few reasons for an endpoint to be stalled. * 1. When a non-supported USB request is received. * Example: GET_DESCRIPTOR(DEVICE_QUALIFIER) * 2. When an endpoint is currently halted. * 3. When the device class specifies that an endpoint must * stall in response to a specific event. * Example: Mass Storage Device Class * If the CBW is not valid, the device shall * STALL the Bulk-In pipe. * See USB Mass Storage Class Bulk-only Transport * Specification for more details. * * Note: UEPn.EPSTALL can be scanned to see which endpoint causes * the stall event. * If *****************************************************************************/ void USBStallHandler(void) { /* * Does not really have to do anything here, * even for the control endpoint. * All BDs of Endpoint 0 are owned by SIE right now, * but once a Setup Transaction is received, the ownership * for EP0_OUT will be returned to CPU. * When the Setup Transaction is serviced, the ownership * for EP0_IN will then be forced back to CPU by firmware. * * NOTE: Above description is not quite true at this point. * It seems the SIE never returns the UOWN bit to CPU, * and a TRNIF is never generated upon successful * reception of a SETUP transaction. * Firmware work-around is implemented below. */ if(UEP0bits.EPSTALL == 1) { USBPrepareForNextSetupTrf(); // Firmware Work-Around UEP0bits.EPSTALL = 0; } UIRbits.STALLIF = 0; }//end USBStallHandler

/****************************************************************************** * Function: void USBPrepareForNextSetupTrf(void) * * PreCondition: None * * Input: None * * Output: None * * Side Effects: None * * Overview: The routine forces EP0 OUT to be ready for a new Setup * transaction, and forces EP0 IN to be owned by CPU. * * Note: None *****************************************************************************/ void USBPrepareForNextSetupTrf(void) { ctrl_trf_state = WAIT_SETUP; // See usbctrltrf.h ep0Bo.Cnt = EP0_BUFF_SIZE; // Defined in usbcfg.h ep0Bo.ADR = (byte*)&SetupPkt; ep0Bo.Stat._byte = _USIE|_DAT0|_DTSEN; // EP0 buff dsc init, see usbmmap.h ep0Bi.Stat._byte = _UCPU; // EP0 IN buffer initialization }//end USBPrepareForNextSetupTrf

/** EOF usbctrltrf.c *********************************************************/