Thursday, July 30, 2009

Ethernet over USB problem fixed (workaround, actually)

I've been digging into the USB ethernet problem. As I announced, I proceeded by elimination: backported all fixes (which turned out to be minor) to the ethernet gadget from recent kernels in order to see if the problem was there, and it wasn't (as expected anyway, just had to narrow the search). In the process I backported also fixes to the serial gadget, just for fun :-).

So the problem is in the Ingenic USB device code (driver/usb/gadget/jz4740_udc.c). After some serious testing I've found out that it is a DMA related problem. As I've said countless times I'm learning on the go and only know the basics of DMA, so I'll need some serious time to trace down and squash this bug.

Meanwhile, the driver has an option to disable DMA and use PIO (programmed I/O). It's slower (16Mbps versus 40Mbps in my setup) but seems to work consistently.

I've uploaded a new release with just this change, so ethernet is actually usable to transfer files and debug applications. Get it here. The rootfs has not changed, so you just need to copy the appropriate zImage for your LCD type.

Now, on a totally different matter, Bastian has pointed out one possible cause of dingux system installation not working for some people: you need a card with partitions. Some cards come with a filesystem starting right on the first block without a partition table. Your OS of choice deals with it but u-boot (that you flashed in your A320 when you installed dual-boot and who is in charge of loading zImage from the miniSD) seems to get confused if he can't find a partition table.

So, make sure you card is formatted FAT32 and has a partition table.

12 comments:

  1. yeah, that partition tabel thingy did the trick on my 16 gb sd card...great

    ReplyDelete
  2. there seems to be a patch for u-boot for this. It didn't get in, because of coding style violations :) but I think that should not be a problem for us, right?

    http://www.mail-archive.com/u-boot-users@lists.sourceforge.net/msg07248.html

    ReplyDelete
  3. @Bastian

    Thanks again. I'll apply the patch and test ASAP.

    ReplyDelete
  4. THX @ Bastian & Booboo.
    Finaly the FAT32 only rootfs is working.
    To create a Partition Table has done it.
    Vielen Dank euch!! :-))

    ReplyDelete
  5. Booboo, Bastian, Suicide~!!

    Plz help me. How can I create partition table?

    I'm using window xp sp3 and micro sd 8gb with adopter.

    ReplyDelete
  6. Hey Booboo,

    great work.

    I would like to ask you, if it's possible to add somewhat like an usb-keyboard ability to the Dingoo, that i can use an usb Keyboard on it (for Console) without the need of an PC.

    something like this:
    http://www.mp3car.com/vbulletin/attachments/classified-archive/14353d1116538271-fs-super-mini-usb-keyboard-minikey9jh.jpg

    thanks

    ReplyDelete
  7. I have the same question as Calito...

    This might also be why Dingux always got stuck on the loadup screen for me.

    ReplyDelete
  8. @Calito: I really don't know how to do it on Windows XP. For Linux the steps are:

    1. find out the device of the sd card (in my case it was /dev/sdb)
    2. double check that you have the correct one (this is important!)
    3. check if the card already has partitions (for example the device /dev/sdb1 exists). In this case you are done, and the reason why dingux fails must be something else.
    4. execute the following command: "dd bs=512 count=1 if=/dev/zero of=/dev/sdb" (on *ubuntu put a "sudo" in front, on other Linux distri's you might need to execute "su" first)
    5. execute the command "fdisk /dev/sdb" (again, on *ubuntu with sudo in front)
    6. create a partition with the "c" command, press return until the questioning stops
    7. change the partition type with the "t" command to "c" (fat32)
    8. write the partition table and quit with the "w" command
    9. execute "mkfs.vfat /dev/sdb1" (again sudo in front for *ubuntu)

    If that is too much work for you, then be patient. Booboo might come up with a new version that supports no partition table in a week or maybe even less.

    ReplyDelete
  9. Windows wont let you partition removable devices directly. You will have to either use Ubuntu or a partition program like acronis disk director to do this. I don't think there are any free partitioning programs that can work with removable devices but I may be wrong. But depending on your definition of "free" you could torrent it.

    ReplyDelete
  10. HP USB Disk Storage Format Tool v. 2.1.8 worked for me.....google it...

    ReplyDelete
  11. Check this MS KB article,

    http://support.microsoft.com/kb/309000

    look for the section named 'How to create a new partition'

    ReplyDelete
  12. Let me ask something: is possible to use an USB wireless adapter ?

    And, are we able to use common linux apps with this hardware ? Like transmission (bit torrent) ?

    Thanks.

    ReplyDelete