Re: Accessing I2C-Bus via ELV USB-I2C

From: Hans Petter Selasky <hps_at_selasky.org>
Date: Tue, 04 Oct 2022 11:43:57 UTC
On 10/4/22 12:03, Axel Rau wrote:
> 
> 
> Am 04.10.2022 um 10:39 schrieb Hans Petter Selasky <hps@selasky.org>:
>>
>> That looks normal.
>>
>> The DONE transaction transferred the SETUP packet, but still lists frame [0], but is not dumping the data, because it has already been sent. frame [0] is always the SETUP packet for control endpoints.
>>
> 
> So where should I dig further to find out why the read at 09:28:44.885162 shows only
> 'e:'  from the string, shown completely at 09:28:47.463632 (2nd block) ?
> 
> 09:28:44.878743 usbus1.3 SUBM-BULK-EP=00000001,SPD=FULL,NFR=1,SLEN=4,IVAL=0
>   frame[0] WRITE 1 bytes
>   0000  3F -- -- -- -- -- -- --  -- -- -- -- -- -- -- --  |?               |
>   flags 0x8 <PIPE_BOF|0>
>   status 0xca023 <OPEN|TRANSFERRING|STARTED|BDMA_ENABLE|BDMA_SETUP|CAN_CANCEL_IMMED|DOING_CALLBACK|0>
> 09:28:44.878816 usbus1.3 DONE-BULK-EP=00000001,SPD=FULL,NFR=1,SLEN=0,IVAL=0,ERR=0
>   frame[0] WRITE 1 bytes
>   flags 0x8 <PIPE_BOF|0>
>   status 0xca021 <OPEN|STARTED|BDMA_ENABLE|BDMA_SETUP|CAN_CANCEL_IMMED|DOING_CALLBACK|0>
> 09:28:44.885162 usbus1.3 DONE-BULK-EP=00000081,SPD=FULL,NFR=1,SLEN=4,IVAL=0,ERR=0
>   frame[0] READ 2 bytes
>   0000  65 3A -- -- -- -- -- --  -- -- -- -- -- -- -- --  |e:              |
>   flags 0xa <SHORT_XFER_OK|PIPE_BOF|0>
>   status 0xcb021 <OPEN|STARTED|SHORT_XFER_OK|BDMA_ENABLE|BDMA_SETUP|CAN_CANCEL_IMMED|DOING_CALLBACK|0>
> 09:28:44.885176 usbus1.3 SUBM-BULK-EP=00000081,SPD=FULL,NFR=1,SLEN=0,IVAL=0
>   frame[0] READ 1024 bytes
>   flags 0xa <SHORT_XFER_OK|PIPE_BOF|0>
>   status 0xeb023 <OPEN|TRANSFERRING|STARTED|SHORT_XFER_OK|BDMA_ENABLE|BDMA_SETUP|CURR_DMA_SET|CAN_CANCEL_IMMED|DOING_CALLBACK|0>
> 09:28:44.888153 usbus1.3 DONE-BULK-EP=00000081,SPD=FULL,NFR=1,SLEN=24,IVAL=0,ERR=0
>   frame[0] READ 24 bytes
>   0000  31 31 35 32 30 30 20 62  69 74 2F 73 0D 0A 49 32  |115200 bit/s..I2|
>   0010  43 2D 43 6C 6F 63 6B 3A  -- -- -- -- -- -- -- --  |C-Clock:        |
>   flags 0xa <SHORT_XFER_OK|PIPE_BOF|0>
>   
> Here I get the right response:
> 
> 09:28:47.457426 usbus1.3 SUBM-BULK-EP=00000001,SPD=FULL,NFR=1,SLEN=4,IVAL=0
>   frame[0] WRITE 1 bytes
>   0000  3F -- -- -- -- -- -- --  -- -- -- -- -- -- -- --  |?               |
>   flags 0x8 <PIPE_BOF|0>
>   status 0xca023 <OPEN|TRANSFERRING|STARTED|BDMA_ENABLE|BDMA_SETUP|CAN_CANCEL_IMMED|DOING_CALLBACK|0>
> 09:28:47.457462 usbus1.3 DONE-BULK-EP=00000001,SPD=FULL,NFR=1,SLEN=0,IVAL=0,ERR=0
>   frame[0] WRITE 1 bytes
>   flags 0x8 <PIPE_BOF|0>
>   status 0xca021 <OPEN|STARTED|BDMA_ENABLE|BDMA_SETUP|CAN_CANCEL_IMMED|DOING_CALLBACK|0>
> 09:28:47.463632 usbus1.3 DONE-BULK-EP=00000081,SPD=FULL,NFR=1,SLEN=68,IVAL=0,ERR=0
>   frame[0] READ 66 bytes
>   0000  0D 0A 45 4C 56 20 55 53  42 2D 49 32 43 2D 49 6E  |..ELV USB-I2C-In|
>   0010  74 65 72 66 61 63 65 20  76 31 2E 38 20 28 43 61  |terface v1.8 (Ca|
>   0020  6C 3A 35 43 29 0D 0A 4C  61 73 74 20 41 64 72 65  |l:5C)..Last Adre|
>   0030  73 73 3A 30 78 30 30 0D  0A 42 61 75 64 72 61 74  |ss:0x00..Baudrat|
>   0040  65 3A -- -- -- -- -- --  -- -- -- -- -- -- -- --  |e:              |
>   flags 0xa <SHORT_XFER_OK|PIPE_BOF|0>
>   status 0xeb021 <OPEN|STARTED|SHORT_XFER_OK|BDMA_ENABLE|BDMA_SETUP|CURR_DMA_SET|CAN_CANCEL_IMMED|DOING_CALLBACK|0>
> 09:28:47.463644 usbus1.3 SUBM-BULK-EP=00000081,SPD=FULL,NFR=1,SLEN=0,IVAL=0
>   frame[0] READ 1024 bytes
>   flags 0xa <SHORT_XFER_OK|PIPE_BOF|0>
>   status 0xcb023 <OPEN|TRANSFERRING|STARTED|SHORT_XFER_OK|BDMA_ENABLE|BDMA_SETUP|CAN_CANCEL_IMMED|DOING_CALLBACK|0>
> 
> Axel
> ---
> PGP-Key: CDE74120  ☀  computing @ chaos claudius
>>
> 
> 
> ---
> PGP-Key: CDE74120  ☀  computing @ chaos claudius
> 


Did you clear the endpoint halt condition (for RX BULK endpoint and TX 
BULK endpoint), to reset the so-called USB data-toggle, before starting 
to communicate with the device? Else you risk loosing a USB packet?

--HPS