This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

problem with usb device custom class middelware

hi to all,
i am emulating a usb floppy, and i decide to use keil usb middleware with custom class(usb floppies most implement ufi class and it dose not implemented by keil) to done this project, but i have a problem with that.
in some place host driver decide to reset bulk in and out pipes, and as result it will reset host data toggle to DATA0 without sending any CLEAR_FEATURE to reset device data toggle.
below table is part of usb communication dump of my device:

device-endpoint   phase   data                                           desc
12.0               ctl    21 00 00 00  00 00 0c 00                       control-setup
12.0               out    23 00 00 00  00 00 00 00  fc 00 00 00          control-data
12.2               in     00 00 00 08  00 00 0b 40  03 00 02 00          bulk-in
12.1               in     00 00                                          interrupt-in
12.0               ctl    21 00 00 00  00 00 0c 00                       control-setup
12.0               out    00 00 00 00  00 00 00 00  00 00 00 00          control-data
12.1               in     3a 00                                          interrupt-in
12.2               reset                                                 reset bulk pipe
12.2               reset                                                 reset bulk pipe
12.0               ctl    21 00 00 00  00 00 0c 00                       control-setup
12.0               out    03 00 00 00  12 00 00 00  00 00 00 00          control-data
12                 SSTS                                                  timeout
12                 SSTS                                                  request flushed
12                 reset                                                 bus reset
12                 ok


as you can see every thing is ok until host decide to reset bulk pipes and as result it reset host toggle but device toggle is DATA1 and as result next data transfer in bulk in endpoint will timeout and then host reset usb pipe and this is my problem.
i know that this is mistake by host, but i know where host reset pipe and now i am searching for a way to reset data toggle of my device bulk endpoints.
i did not find any function or utility in keil usb middelware api to reset data toggle.
now any one know any way to done that???

Parents
  • Hi Alireza,

    regarding response on interrupt endpoint you are using bInterfaceSubClass = 04h device which I was not aware of.

    Anyways, correct way of handling your current problem is to catch CLEAR_FEATURE request, and call USBD_EndpointStall with parameter stall = 0 to clear halt condition on your bulk endpoint.
    BTW, that procedure would have already worked on your initial problem also if you did stall the bulk endpoint on TestUnitReady request then host sent CLEAR_FEATURE in which case you would un-stall the bulk endpoint and that should also reset the data toggle bit.

Reply
  • Hi Alireza,

    regarding response on interrupt endpoint you are using bInterfaceSubClass = 04h device which I was not aware of.

    Anyways, correct way of handling your current problem is to catch CLEAR_FEATURE request, and call USBD_EndpointStall with parameter stall = 0 to clear halt condition on your bulk endpoint.
    BTW, that procedure would have already worked on your initial problem also if you did stall the bulk endpoint on TestUnitReady request then host sent CLEAR_FEATURE in which case you would un-stall the bulk endpoint and that should also reset the data toggle bit.

Children