I2C Block Read Problem?

630 views
Skip to first unread message

George Ioakimedes

unread,
Aug 18, 2014, 12:20:05 PM8/18/14
to linux...@googlegroups.com
I'm working on my new Baseboard design which has a Microchip 4-port USB Hub chip on it. This chip uses only a SMBus Write and Read command. I upgraded the kernel to 3.4.90 since 3.4.75 was still using 200kHz as the I2C default speed.

I'm using Python to issue commands and looking at a write_i2c_block_data command on the scope I have confirmed that the command structure is sent properly. I need to also decode on the scope the read but it appears that the read is missing the 1st byte. 

If I issue a

sudo i2cdump -y 1 0x2c s
Error: Adapter does not have SMBus block read capability

but if I issue a 
cubie@Cubian:~$ sudo i2cdump -y 1 0x2c i
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f    0123456789abcdef
00: 20 24 04 14 25 b3 0b 9b 00 01 00 00 00 01 32 01     $??%???.?...?2?
10: 32 32 04 09 13 15 0a 49 00 4f 00 00 00 54 00 45    22?????I.O...T.E
20: 20 43 00 48 00 4e 00 4f 00 4c 00 4f 00 47 00 49     C.H.N.O.L.O.G.I
30: 00 45 00 53 00 00 00 4c 00 4c 00 43 00 00 00 00    .E.S...L.L.C....
40: 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00     ...............
50: 00 00 00 00 00 42 00 69 00 67 00 00 00 42 00 72    .....B.i.g...B.r
60: 20 6f 00 74 00 68 00 65 00 72 00 00 00 42 00 61     o.t.h.e.r...B.a
70: 00 73 00 65 00 62 00 6f 00 61 00 72 00 64 00 00    .s.e.b.o.a.r.d..
80: 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00     ...............
90: 00 00 00 32 00 30 00 31 00 34 00 30 00 38 00 30    ...2.0.1.4.0.8.0
a0: 20 30 00 30 00 31 00 00 00 00 00 00 00 00 00 00     0.0.1..........
b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
c0: 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00     ...............
d0: 00 e1 00 00 00 00 00 00 00 00 00 00 00 00 00 00    .?..............
e0: 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00     ...............
f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................

Notice how every other "0" byte is a 0x20?

If I run this code:

import smbus
bus = smbus.SMBus(1)
reg00 = [0x20, 0x24, 0x04, 0x14, 0x25, 0xB3, 0x0B, 0x9B, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x32, 0x01, 0x32]
bus.write_i2c_block_data(0x2c, 0x00, reg00)

You get the above dump. From my understanding the 1st byte is supposed to be the number of bytes being sent. That code does appear correctly on the scope when I'm writing data

I've made some progress and it appears that the hub does get enumerated:

cubie@Cubian:~$ lsusb
Bus 001 Device 003: ID 0424:2514 Standard Microsystems Corp. USB 2.0 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

But if I try to get some additional information about the hub, lsusb complains that it couldn't open the hub so I'm not sure if it really enumerated properly

cubie@Cubian:~$ lsusb -v -s 001:003

Bus 001 Device 003: ID 0424:2514 Standard Microsystems Corp. USB 2.0 Hub
Couldn't open device, some information will be missing
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            9 Hub
  bDeviceSubClass         0 Unused
  bDeviceProtocol         2 TT per port
  bMaxPacketSize0        64
  idVendor           0x0424 Standard Microsystems Corp.
  idProduct          0x2514 USB 2.0 Hub
  bcdDevice            b.b3
  iManufacturer           1
  iProduct                2
  iSerial                 3
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           41
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0xe0
      Self Powered
      Remote Wakeup
    MaxPower                2mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         9 Hub
      bInterfaceSubClass      0 Unused
      bInterfaceProtocol      1 Single TT
      iInterface              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0001  1x 1 bytes
        bInterval              12
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       1
      bNumEndpoints           1
      bInterfaceClass         9 Hub
      bInterfaceSubClass      0 Unused
      bInterfaceProtocol      2 TT per port
      iInterface              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0001  1x 1 bytes
        bInterval              12

If I plug a keyboard into the hub it does not show up so I know that something is still not right. Since the idVendor and idProduct come through correctly I am going to assume that at least part of the registers did get written correctly even though reading them says they did not.

If anyone has any helpful advice or knowledge of this I would greatly appreciate some feedback!

Thanks,
George

jons...@gmail.com

unread,
Aug 18, 2014, 1:33:08 PM8/18/14
to linux-sunxi
Do you know about the GL850G? It is about $0.30. The chip is
automatic, no need for SMBUS.

http://www.kean.com.au/oshw/WR703N/GL850G%20USB%20Hub%201.07.pdf

http://www.aliexpress.com/item/new-hope-GL850G-GL850-SSOP28-100pcs-lots/1860488763.html
> --
> You received this message because you are subscribed to the Google Groups
> "linux-sunxi" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to linux-sunxi...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--
Jon Smirl
jons...@gmail.com

George Ioakimedes

unread,
Aug 18, 2014, 4:29:35 PM8/18/14
to linux...@googlegroups.com
No, I didn't look at that part but the board is already designed with the USB2514B and I'm working on the prototypes. If the GL850G is really that cost I might have to look into it later though.

jons...@gmail.com

unread,
Aug 18, 2014, 4:44:00 PM8/18/14
to linux-sunxi
On Mon, Aug 18, 2014 at 4:29 PM, George Ioakimedes <georg...@gmail.com> wrote:
> No, I didn't look at that part but the board is already designed with the
> USB2514B and I'm working on the prototypes. If the GL850G is really that
> cost I might have to look into it later though.

I have an A20 board on my desk that uses it. It has three USB jacks,
wifi, POTS telephone, SD, HDMI, camera, Ethernet, IR, etc. Does that
board work for you? I can put you in touch with the vendor.

George Ioakimedes

unread,
Aug 18, 2014, 5:46:08 PM8/18/14
to linux...@googlegroups.com
For now I need to get my board design up and running but getting help from Microchip is not working out so far

jons...@gmail.com

unread,
Aug 18, 2014, 7:11:01 PM8/18/14
to linux-sunxi
I see you are making an expansion board the the Cubieboard. Does it
have a UART to USB chip on it? PL2303 is $0.30
http://www.aliexpress.com/item/Free-Shipping-PL-2303HX-PL2303HX-usb-to-serial-control-chip/1911511366.html

What other chips are you using?

jons...@gmail.com

unread,
Aug 18, 2014, 7:12:18 PM8/18/14
to linux-sunxi
Cheap camera modules here:
http://cmoscamera.1688.com/
--
Jon Smirl
jons...@gmail.com

jons...@gmail.com

unread,
Aug 18, 2014, 7:22:53 PM8/18/14
to linux-sunxi
OV5640 module for under $10 in small quantity.
http://detail.1688.com/offer/1128568755.html
They don't speak English, you will need help buying from them.

This looks like the same one, easier to buy on Aliexpress but $21.
http://www.aliexpress.com/item/Strong-Sale-5-0megapixel-golden-finger-MP4-camera-module-mini-dvr-module-vw-reverse-camera/747713861.html
--
Jon Smirl
jons...@gmail.com

George Ioakimedes

unread,
Aug 18, 2014, 7:46:06 PM8/18/14
to linux...@googlegroups.com
Yes, it has the FTDI FT230XQ-T part on it

George Ioakimedes

unread,
Aug 18, 2014, 7:48:04 PM8/18/14
to linux...@googlegroups.com
I do have an OV5640 module and went with a standard header so people could play more easily. 

jons...@gmail.com

unread,
Aug 18, 2014, 8:54:11 PM8/18/14
to linux-sunxi
My experience on Aliexpress is that 19 out of 20 vendors are honest.
One of out 20 the product will not be what you ordered. There is a
free, automatic escrow service as part of every Aliexpress order. You
should immediately inspect the chips that are sent to you. If they
don't work use the escrow service to get a refund.

But... you will have to mail the parts back to China to get a refund.
So for me, if the order is under $50 I just throw it in the trash.
Report the problem vendor to Aliexpress, and move onto another one.

If you do open an escrow dispute you will almost always win and get a
refund. It is not a level playing field, the customer wins even if
they are wrong. Aliexpress understands that customers are more
important to them.

One thing I don't know - is the vendor dishonest, or has someone else
in the supply chain duped the vendor? There is no way to know. I
suspect the vendors are being duped up the supply chain. If a vendor
gets four or five negative reports Aliexpress will ban them.

Don't, don't, don't buy a $1,000 worth of chips and not inspect them
before the escrow period expires. Most of the Aliexpress horror
stories result from failing to do this inspection and then you are
stuck with the bad product. I have no pity for these people - you had
a free escrow and failed to use it on the terms given. I wouldn't use
Aliexpress to order large amounts of chips, instead I would deal
directly with a chip supplier who will be cheaper.

--
Jon Smirl
jons...@gmail.com
Reply all
Reply to author
Forward
0 new messages