OpenWrt Forum Archive

Topic: AR933x (i.e. TL-WR703N) as USB device (connect to PC) mod

The content of this topic has been archived on 8 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

The USB controller in the AR933x SoC supports device mode which means that you can connect the board to a PC and have it behave like a mass storage or Ethernet device. For example it can be used as wireless USB dongle or create a serial connection without the need to connect to the UART breakout pins.
To switch the controller in device mode you need to do a hardware modification (unsoldering a resistor) and apply a software patch. The process is documented at http://neykov.name/posts/ar933x-usb-device-driver/ .
If you try the changes please report back your success and failure so I know if there are problems before submitting the patch for inclusion in the kernel. You can try the software patch even without the hardware changes. This way you will use the driver in host mode - I haven't tested this mode since I have already modified my board so feedback would be much appreciated.

The reason I undertook this modification is to connect the router to a picture frame and use it to simulate a usb flash drive. I still haven't managed to complete this project, but the router successfully connects to a PC running Windows.

(Last edited by svetoslav on 20 Feb 2013, 07:39)

So if I'm understanding this, in order to toggle modes, you would need to reboot the router? Not sure how useful it would be for the device to emulate a mass storage device unless there's a way to add more storage independently of the usb. I'm interested to know whether MMC is possible on this device.

MMC is possible.

Jarocks wrote:

So if I'm understanding this, in order to toggle modes, you would need to reboot the router?

Correct. The platform initializes the controller on startup, based on the GPIO13 pin state. You would need to change the pin state as well (either through a manual switch or an additional circuitry). It is not possible to change it purely in software.

Jarocks wrote:

Not sure how useful it would be for the device to emulate a mass storage device unless there's a way to add more storage independently of the usb.

Mass storage is just one of the possibilities. The whole setup wouldn't be of much use if you just attach a memory card and use the board as a card reader.
I find it would be more useful by setting up an image somewhere on the network. For example you can rip all your CDs to a file server and mount them using the mass storage module. You could even boot into them.
Or you could rebuild an image once a day based on some photo feeds from the net and remount it (again the image doesn't need to be stored locally).
In general it is not recommended to change the backing image while the device is mounted since the other end assumes it is the only one writing to the device. This somehow limits the possibilities but doesn't make it not useful in any case.

The use case which I would like to accomplish is to be able to create an image in memory (a couple of megabytes) and change photos in it while the device is attached. As I wrote this is not readily possible but by doing tricks like QEMU vvfat driver it is doable. It would be even easier with a picture frame since its caches would be way smaller (if any).

Jarocks wrote:

I'm interested to know whether MMC is possible on this device.

It is possible to connect an SD card to the board by using software SPI through unused GPIOs.

This is a great little hack. I just need to find a use for it! I will have a think and get back to you.
Well done on the work though svetoslav!

How about this project now?
I tried and fail.

The discussion might have continued from here.