/var/www/restricted/ssh/stm32/www/stm32circle/ STM CircleOS forum / USB Bulk OUT question.

Username:     
Password:     
             

Forum

# 1   2011-05-11 12:39:59 USB Bulk OUT question.

WillWu
New member
Registered: 2011-05-11
Posts: 7

USB Bulk OUT question.

I try to develop USB device for iPhone(USB Host).

I know there need to use 4 endpoint (EP0 for control, EP1 for interrupt IN, EP2 for Bulk IN and EP3 for Bulk OUT).
I can use EP0, EP1, EP2 now, but EP3 have some problem to get data.

I saw a Bulk OUT packet from iPhone on the usb analyzer but STM(Device) return STALL ack always and never enter USB isr.

Is anyone know how to check this question?
or is anyone has developed on iPhone device using STM?

Offline

 

# 2   2011-05-11 12:49:40 USB Bulk OUT question.

WillWu
New member
Registered: 2011-05-11
Posts: 7

Re: USB Bulk OUT question.

My config descriptor and other settings:

const u8 DeviceConfigDescriptor[39] =
{
    0x09, 0x02, 0x27, 0x00,
    0x01,         /*bNumInterfaces: 1 interface*/
    0x01,         /*bConfigurationValue: Configuration value*/
    0x00,         /*iConfiguration: Index of string descriptor describing the configuration*/
    0xC0,         /*bmAttributes: bus powered */
    0x32,         /*MaxPower 100 mA: this current is used for detecting Vbus*/
    /************** Descriptor of interface ****************/
    0x09,
    0x04,
    0x00,         /*bInterfaceNumber: Number of Interface*/
    0x00,         /*bAlternateSetting: Alternate setting*/
    0x03,         /*bNumEndpoints*/
    0xFF,         /*bInterfaceClass: Vendor Specific*/
    0xF0,         /*bInterfaceSubClass ??? */
    0x00,         /*nInterfaceProtocol : */
    0,            /*iInterface: Index of string descriptor*/
    /******************** Standard Endpoint Descriptor ********************/
    0x07,          /*bLength: Endpoint Descriptor size*/
    0x05,         /*bDescriptorType:*/
    0x81,          /*bEndpointAddress: Endpoint Address (IN)*/
    0x03,          /*bmAttributes: Interrupt endpoint*/
    0x40,          /*wMaxPacketSize: 64 Byte max */
    0x00,
    0x04,          /*bInterval: Polling Interval (4 ms)*/

    0x07,          /*bLength: Endpoint Descriptor size*/
    0x05,         /*bDescriptorType:*/
    0x82,          /*bEndpointAddress: Endpoint Address (IN)*/
    0x02,          /*bmAttributes: Bulk endpoint*/
    0x40,          /*wMaxPacketSize: 64 Byte max */
    0x00,
    0x00,          /*bInterval: Polling Interval (0 ms)*/

    0x07,          /*bLength: Endpoint Descriptor size*/
    0x05         , /*bDescriptorType:*/
    0x03,          /*bEndpointAddress: Endpoint Address (OUT)*/
    0x02,          /*bmAttributes: Bulk endpoint*/
    0x40,          /*wMaxPacketSize: 64 Byte max */
    0x00,
    0x00,          /*bInterval: Polling Interval (0 ms)*/
};

#define EP_NUM   4
#define ENDP0_RXADDR        (0x0018)
#define ENDP0_TXADDR        (0x0058)
/* EP1  */
/* Tx buffer base address */
#define ENDP1_TXADDR        (0x0098)
/* EP2  */
/* Tx buffer base address */
#define ENDP2_TXADDR        (0x00D8)
/* EP3  */
/* Rx buffer base address */
#define ENDP3_RXADDR        (0x0118)

    /* Initialize Endpoint 0 */
    SetEPType(ENDP0, EP_CONTROL);
    SetEPTxStatus(ENDP0, EP_TX_STALL);
    SetEPRxAddr(ENDP0, ENDP0_RXADDR);
    SetEPTxAddr(ENDP0, ENDP0_TXADDR);
    Clear_Status_Out(ENDP0);
    SetEPRxCount(ENDP0, 64);
    SetEPRxStatus(ENDP0, EP_RX_VALID);

    /* Initialize Endpoint 1 */
    SetEPType(ENDP1, EP_INTERRUPT);
    SetEPTxAddr(ENDP1, ENDP1_TXADDR);
    SetEPTxCount(ENDP1, 64);
    SetEPRxStatus(ENDP1, EP_RX_DIS);
    SetEPTxStatus(ENDP1, EP_TX_NAK);

    /* Initialize Endpoint 2 */
    SetEPType(ENDP2, EP_BULK);
    SetEPTxAddr(ENDP2, ENDP2_TXADDR);
    SetEPTxCount(ENDP2, 64);
    SetEPRxStatus(ENDP2, EP_RX_DIS);
    SetEPTxStatus(ENDP2, EP_TX_NAK);

    /* Initialize Endpoint 3 */
    SetEPType(ENDP3, EP_BULK);
    SetEPRxAddr(ENDP3, ENDP3_RXADDR);
    SetEPRxCount(ENDP3, 64);
    SetEPRxStatus(ENDP3, EP_RX_VALID);
    SetEPTxStatus(ENDP3, EP_TX_DIS);

Offline

 

# 3   2011-05-12 14:49:29 USB Bulk OUT question.

WillWu
New member
Registered: 2011-05-11
Posts: 7

Re: USB Bulk OUT question.

I change Bulk Out pipe form endpoint 3 to endpoint 4 and the problem is solved.
So that, I using EP0 for control, EP1 for interrupt IN, EP2 for Bulk IN and EP4 for Bulk OUT now.

it is STM lib bug probably.

Offline

 

# 4   2011-05-13 06:44:23 USB Bulk OUT question.

yrt
Administrator
From: Grenoble-France
Registered: 2008-06-11
Posts: 520
Website

Re: USB Bulk OUT question.

Nevertheless your configuration was seeming to be correct. In some projects, I used EP2 for bulk In and OUT, EP3 for bulk IN with any problem, but never tried EP3 in OUT mode.
I am surprised because the endpoint management by the ST lib seems to be generic and independent of the endpoint number.

WillWu :

anyone has developed on iPhone device using STM

I'm developing an iPhone device on STM32 but with USART com, and maybe on USB later, so I am very interested by the progress of your project.

Offline

 

# 5   2011-05-13 07:31:35 USB Bulk OUT question.

WillWu
New member
Registered: 2011-05-11
Posts: 7

Re: USB Bulk OUT question.

yrt :

Nevertheless your configuration was seeming to be correct. In some projects, I used EP2 for bulk In and OUT, EP3 for bulk IN with any problem, but never tried EP3 in OUT mode.
I am surprised because the endpoint management by the ST lib seems to be generic and independent of the endpoint number.

WillWu :

anyone has developed on iPhone device using STM

I'm developing an iPhone device on STM32 but with USART com, and maybe on USB later, so I am very interested by the progress of your project.

I have done iAP via UR last year.
For develop iPod iAP via USB, the big bottleneck was USB endpoint not working on STM32.
I am doing USB IDPS and authentication now.
iPod iAP via UR or USB is the same way. If you have any problem may we disscuss it.

Offline

 

# 6   2012-09-27 13:02:23 USB Bulk OUT question.

CC
Guest

Re: USB Bulk OUT question.

I'm glad to read that someone has managed to successfully implement the USB communication with an Apple device using STM32.
Maybe someone can give me some hints. I'm developing an accessory firmware; using STM32F107 on an eval board. Communication via UART works pretty well but is too slow. So the plan is to use USB. I've taken the VCOM example from ST and modified it. My config descriptor looks very similar to yours. I am using EP1 as interrupt IN endpoint, EP2 as bulk in endpoint and EP3 as bulk out endpoint. USB is initialized on start up. But unfortunately I get nothing but an USB RESET interrupt when I connect the devices. The Apple device doesn't even seem to try to enumerate the device or read the configuration descriptor.
What am I doing wrong? Any help would be appreciated because I've been working on this for days without success.

Regards

Last edited by CC (2012-09-27 13:17:59)

 

Board footer