AnsweredAssumed Answered

SOLVED. USBH_BulkReceiveData problem

Question asked by zuikov.dmitry on Jan 31, 2012
Latest reply on Feb 4, 2012 by zuikov.dmitry

The problem is found, but there there is an eternal interrupt loop when NAK from device, so there is an another patch is required for the host lib, 'cause there is no way
to know when the device finished data transfer.

Other stacks have a timeout feature for read/write, so the operation is aborted when the time is out.

Does anybody know, is it possible to contact the USB Host Lib developers somehow? Do they answer in this forum?





I'm trying to work with USB 3G modem using USB Host Library.

There is a strange problem with USBH_BulkReceiveData function ---
sometimes (probably then there is no data transfer from the USB device)
the call of this function cause USB  to lose  synchronization an
USB Host library to hung  the firmware.

Is there any safe way to call  USBH_BulkReceiveData function? Or may be the way to determine when it's not safe to call it.

I tried to call  HCD_GetHCState function to get the transmission state, but it stuck to HC_XFRC forever after first call of  USBH_BulkReceiveData.

The USB session looks like

100981,14330299231375,USB,( OK ),OUT,e1 81 58
100982,14330299234708,USB,( OK ),DATA0,c3 41 54 49 0d 5c 62 
100983,14330299240708,USB,( OK ),ACK,d2            
100984,14330299242208,USB,( ),COLLAPSED [10 SOF]
100985,14330309231041,USB,( OK ),OUT,e1 81 58
100986,14330309234375,USB,( OK ),DATA1,4b 00 00
100987,14330309237666,USB,( OK ),ACK,d2
100988,14330309239166,USB,( ),COLLAPSED [2000 SOF] 
100989,14332309497187,USB,( OK ),IN,69 01 c1
100990,14332309500500,USB,( OK ),DATA0,c3 41 54 49 0d 5c 62
100991,14332309506458,USB,( OK ),ACK,d2

// READ FIRST CHUNK

100994,14335809962416,USB,( OK ),IN,69 01 c1
100995,14335809965708,USB,( OK ),DATA1,4b 0d 0a 4d 61 6e 75 66 61 63 74 75 72 65 
72 3a 20 68 75 61 77 65 69 0d 0a 4d 6f 64 65 6c 3a 20 45 33 36 37 0d 0a 52 65 76 
69 73 69 6f 6e 3a 20 31 31 2e 38 30 37 2e 30 35 2e 33 30 2e 32 30 39 0d 8d a7


100996,14335810011666,USB,( OK ),ACK,d2 

 // READ NEXT CHUNK

100999,14339310427833,USB,( OK ),IN,69 01 c1
101000,14339310431125,USB,( OK ),DATA0,c3 0a 49 4d 45 49 3a 20 33 35 33 36 31 33 
30 34 35 37 31 36 33 37 33 0d 0a 2b 47 43 41 50 3a 20 2b 43 47 53 4d 2c 2b 46 43 
4c 41 53 53 2c 2b 44 53 0d 0a 0d 0a 4f 4b 0d 0a 77 17
101001,14339310471750,USB,( OK ),ACK,d2 

// BUS ERROR AND FIRMWARE CRASH

01002,14339310473250,USB,( ),COLLAPSED [2000 SOF]
101003,14341310983479,USB,( ),COLLAPSED [1730 SOF] [32779 IN/NAK]
101004,14341310983479,USB,( ),COLLAPSED [1730 SOF] [32779 IN/NAK] <1 SYNC ERRORS>
101005,14343041088770,USB,( OK ),IN,69 01 c1
101006,14343041092041,USB,( BAD_SYNC; ),
101007,14343041092041,USB,( ),<1 SYNC ERRORS>
101008,14343041092791,USB,( BAD_SYNC; ),
101009,14343041094020,USB,( OK ),NAK,5a 
101010,14343041095520,USB,( ),COLLAPSED [1 SOF] [184 IN/NAK]
101011,14343041095520,USB,( ),COLLAPSED [1 SOF] [184 IN/NAK] <1 SYNC ERRORS>

Does anybody have any ideas how to read from BULK pipe safely?



Outcomes