EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

AT91SAM7S64 OLIMEX P64 USB usb_control_msg write fails libusb-win32

Started by tcsiibi June 14, 2010
Dear all,

I'm having problems with sending data FROM Host TO Device (OUT).

I extended the code can be found in the FreeRTOS distribution.
I can read data with control transfer, I can do write control transfer without DATA STAGE.

My sequence:

PC: result = usb_control_msg(dev, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_OUT, 0x01, 0xAA55, 0xBB44, (char *)&ulUSBConfig, 0x08, 5000);

SAM7:

1)
ISR -> RXSETUP (device sends ACK after clearing flag)

2)
USBSample -> Gets the messages, does nothing as not necessary.

3)
ISR -> RXDATA (data payload received as awaited)

4)
USBSample -> prvProcessEndPoint0Interrupt() processes the message, sends then prvUSBTransmitNull() as ACK

5)
USBSample -> prvProcessEndPoint0Interrupt() does AT91C_UDP_TXCOMP

Actually I have the data in the SAM7 sent by the PC.
Still I have TIMEOUT (-116) with libusb-win32.

Any idea?

Thanks for the help.

Hi

I am not sure whether this is a problem with the OUT transfer handling or the control handshaking.

Take a look at http://www.utasker.com/docs/uTasker/USB_User_Guide.PDF in case it could give ideas - in particular Appendix A which contains HW relevant details for the SAM7 and a detailed look at the handling of dual-buffered OUT frames.

Regards

Mark

--- In A..., "tcsiibi" wrote:
>
> Dear all,
>
> I'm having problems with sending data FROM Host TO Device (OUT).
>
> I extended the code can be found in the FreeRTOS distribution.
> I can read data with control transfer, I can do write control transfer without DATA STAGE.
>
> My sequence:
>
> PC: result = usb_control_msg(dev, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_OUT, 0x01, 0xAA55, 0xBB44, (char *)&ulUSBConfig, 0x08, 5000);
>
> SAM7:
>
> 1)
> ISR -> RXSETUP (device sends ACK after clearing flag)
>
> 2)
> USBSample -> Gets the messages, does nothing as not necessary.
>
> 3)
> ISR -> RXDATA (data payload received as awaited)
>
> 4)
> USBSample -> prvProcessEndPoint0Interrupt() processes the message, sends then prvUSBTransmitNull() as ACK
>
> 5)
> USBSample -> prvProcessEndPoint0Interrupt() does AT91C_UDP_TXCOMP
>
> Actually I have the data in the SAM7 sent by the PC.
> Still I have TIMEOUT (-116) with libusb-win32.
>
> Any idea?
>
> Thanks for the help.
>


The 2024 Embedded Online Conference