OpenWrt Forum Archive

Topic: (TL-WR703n / GPIO / Misc) AR9331 pinouts?

The content of this topic has been archived between 7 Oct 2014 and 7 May 2018. Unfortunately there are posts – most likely complete pages – missing.

Hi,

Curious if anyone has AR9331 pinouts and/or a list of available on-chip peripherals.  I'm hoping to be able to add some sensors, and possibly make use of some of the un-connected peripherals in the '9331 (I'm hoping there might even be a second SPI port that could be enabled, though I'm guessing that's not the case).

from a bit of probing & playing with the GPIO sysfs interface, it looks like there are at least 2 useable GPIOs next to the serial RX/TX pins, and 7 next to the ethernet pins -- I'm guessing 4 of those could be configured as the second ethernet port some of the similar devices have, though haven't tried loading one of their kernels.

Also, curious if the AR9331 requires some GPIOs to be set to specific states for boot configuration (a number of the GPIOs are connected to VCC/GND via ~10k resistors -- I'm guessing that's so a single kernel can be used for multiple routers, and it's basically "hard coding" the states of switches that are available on other models, though would like to be sure).


As a sidenote, if anyone has a toasted WR703n that they wouldn't mind either sending to me, or desoldering the CPU and sending some nice pictures of the board underneath, that'd also be appreciated.


the larger hope here is to be able to throw on an SD card via SPI, and to be able to interface with assorted sensors without tapping into the USB bus...


Thanks!

You won't be able to get datasheet for the chip.

Your best bet is to search &| guess for pinout on a broken hardware. That's what I did on a broadcom router smile

You must be right, red_mamba. However, it would be great if the community could centralize such pieces of information. It seems that quite a few people buy the TL-WR703N (or the TL-MR3020) with the purpose of tinkering with it, so any information about the AR9331 pinout would be very helpful.

For example, I would love to add a second RJ45 port to my WR703N. Some other pocket routers like the Planex MZK-RP150N or the Zuni ZR301 have two ports. This is very handy in the common situation where you have a computer connected to the internet through an ethernet cable. You can disconnect the cable from the computer, connect the cable to the pocket router, and connect the pocket router to the computer. This gets you a wireless internet access (e.g. for your smartphone) without losing it on the computer. You cannot do that with the WR703N.

Since the AR9331 is supposed to integrate an ethernet switch, adding a second port should not be that difficult...

I'll try to convert my assorted notes to something others can use... right now i've got the 703 on hold as i work on a couple of other projects...

I have been messed the whole day with the multimeter and soldering iron and found something interesting!
There is at least 3 spare gpios on the board we can access:
1) Near the quarz crystal find resistance R4 (10.1 KOhm). It's gpio0. Unsolder the resistan?e and you ca easily acces the pin
2) Find resistance R15 near the tin dot right from the USB socket. It's gpio7 connected to ground.
3) The same for R17, it's gpio29.

The pins mentioned are unused by the system (as I suppose), there is no effect on functionality when you access them. Another gpios can be found on the other side of the board (for ex. gpio1 is connected to R2), they are controllable from userspace but unsoldering them causes boot failure (maybe there is a way to modify u-boot?). I'm pretty sure you can find more with a bit of luck.

Now I'm planning to test i2c bitbang driver (kmod-i2c-gpio-custom) with some bunch of sensors

Thank you for sharing, these are great findings. smile

If someone else wants to try, here is my notes:
1) GPIOs 1 and 2 are connected to the group of resistances at the bottom of the board (R2 R14). Not sure if they are usable, they can be nesassary for the DRAM initialization
2) The contact group near R57 R60 and R62 is SPI. 10.1KOhm pull-ups are used for SPI lines, so need to check if i2c will work with the same pull-up.
3) GPIO6 is connected to the voltage regulator U6 (R110, R107). Not sure about it's functions, but changing it's state doesn't affect USB functionality. Maybe it's an overcurrent interrupt?

(Last edited by imperfect on 7 May 2012, 12:26)

Yeahhh! Software i2c works flawlessly on pins 7,29! I used 10K pullups and 3.3V lines from the router (convenient place to take 3.3V is a soldering pad near C113 capacitor). PCF8574 io expander and ADXL345 accelerometer live fine from that source. So, now we have a way to make some embedded devices/robotics with full blown linux and WIFI/USB for 22$ smile (not waiting for a raspberry pi smile.

Does anyone know how to test the speed of the software i2c bus? Is it 100 or 400 Khz?

(Last edited by imperfect on 9 May 2012, 12:14)

echo pcf8574 0x38 > /sys/bus/i2c/devices/i2c-0/new_device

I think accelerometer drivers are still in staging.

I wanted to build my own router with BCM5453. But quite a few people told me that Atheros is a better idea because it has much better driver support.

So I might start reverse engineering AR9331 pins.
Can anyone suggest a AR9331 based router with lots of flash, ram and USB port?
So I can reverse engineer all at once.

If any one has a bricked or broken router that can be donated for science let me know.

imperfect wrote:

Yeahhh! Software i2c works flawlessly on pins 7,29! I used 10K pullups and 3.3V lines from the router (convenient place to take 3.3V is a soldering pad near C113 capacitor). PCF8574 io expander and ADXL345 accelerometer live fine from that source. So, now we have a way to make some embedded devices/robotics with full blown linux and WIFI/USB for 22$ smile (not waiting for a raspberry pi smile.

Does anyone know how to test the speed of the software i2c bus? Is it 100 or 400 Khz?

I'd like to use i2c on a couple of IO expanders.  Do you have any picture of your soldered wires?

As I received a lot of questions via PM, here are some pictures..
http://imgur.com/a/V3WXb#1

you need to remove resistances as I wrote (they are pulling gpios to ground) and add 10K resistances to +3.3 (it's a standard for I2C bus, else it won't work).
a place to take +3.3 are spare pads near C113. Actually, it's a line from the voltage regulator and you can draw ~200 mA from there, but don't connect it to anything more hungry.
remember that tracks on the circuit board are very subtle and can be lifted easily. You need to reliable fix all the wires.

(Last edited by imperfect on 26 May 2012, 23:54)

imperfect wrote:

As I received a lot of questions via PM, here are some pictures..
http://imgur.com/a/V3WXb#1

you need to remove resistances as I wrote (they are pulling gpios to ground) and add 10K resistances to +3.3 (it's a standard for I2C bus, else it won't work).
a place to take +3.3 are spare pads near C113. Actually, it's a line from the voltage regulator and you can draw ~200 mA from there, but don't connect it to anything more hungry.
remember that tracks on the circuit board are very subtle and can be lifted easily. You need to reliable fix all the wires.

Imperfect , I look your pictures.Problably you are using 2 GPIO pins connected to  R15 and R17 ok ?
But I can't find the GPIO number for this pins.Can you share information about this pins ?
Thanks a lot

it's gpio7 ang gpio29, read my first post

Hello there, congrats on the GPIO work.
Anyone knows if there are pins to connect a second USB port ?

Anyone knows if there are pins to connect a second USB port ?

No, only single USB port. You need to use usb hub

For those who really wants to use their wr703n in some homemade electronic projects.
I've managed to control another 2 gpios, located just near gpio0. It's 2 pads with resistors R11 and R12 on them (gpio14 and gpio15 according to kernel).
However, it required me to modify kernel sources and set some values on the GPIO_FUNCTION register of the AR9331. And it was not possible without a datasheet, of course smile
If there is some interest in it, I can try to prepare patches (never did it before).
As for other functionality, AR9331 has I2S support, GPIO edge/level interrupt support, 4 general purpose timers, subscriber line interface card (SLIC) support
Most of it is not implemented in the current kernel

(Last edited by imperfect on 13 Jun 2012, 11:12)

imperfect wrote:

Anyone knows if there are pins to connect a second USB port ?

No, only single USB port. You need to use usb hub

For those who really wants to use their wr703n in some homemade electronic projects.
I've managed to control another 2 gpios, located just near gpio0. It's 2 pads with resistors R11 and R12 on them (gpio14 and gpio15 according to kernel).
However, it required me to modify kernel sources and set some values on the GPIO_FUNCTION register of the AR9331. And it was not possible without a datasheet, of course smile
If there is some interest in it, I can try to prepare patches (never did it before).
As for other functionality, AR9331 has I2S support, GPIO edge/level interrupt support, 4 general purpose timers, subscriber line interface card (SLIC) support
Most of it is not implemented in the current kernel

Please do it and appreciate for your great work!

PS:Can I use GPIOs to connect a micro-SD to expand the flash and swap partition?

I`ve killed the wr703N router by wrong flash image (with mtd write). How can i restore the functionality of my router?
Tried to connect with ca42 cable to the serial bus, but its output is empty. Should i reflash it over i2c or gpio? Advices are welcome.

(Last edited by Schtz on 26 Jun 2012, 19:10)

Schtz wrote:

Tried to connect with ca42 cable to the serial bus, but its output is empty.

If you really used mtd, you should be able to recover with serial in u-boot. Maybe you will be more successful with a dku5 cable. Search for both cable types here in the forum, some people reported their experiences.

MBS wrote:

If you really used mtd, you should be able to recover with serial in u-boot. Maybe you will be more successful with a dku5 cable. Search for both cable types here in the forum, some people reported their experiences.

Thx for advice, doesn`t mtd break u-boot?
Where can i read the information about this chip`s architecture or internal organization?

normally, the u-boot partition is write-protected - and mtd should respect that. but that's just what i read here and there, i haven't had the balls to proof it ;-)

imperfect wrote:

I have been messed the whole day with the multimeter and soldering iron and found something interesting!
There is at least 3 spare gpios on the board we can access:
1) Near the quarz crystal find resistance R4 (10.1 KOhm). It's gpio0. Unsolder the resistan?e and you ca easily acces the pin
2) Find resistance R15 near the tin dot right from the USB socket. It's gpio7 connected to ground.
3) The same for R17, it's gpio29.

The pins mentioned are unused by the system (as I suppose), there is no effect on functionality when you access them. Another gpios can be found on the other side of the board (for ex. gpio1 is connected to R2), they are controllable from userspace but unsoldering them causes boot failure (maybe there is a way to modify u-boot?). I'm pretty sure you can find more with a bit of luck.

Now I'm planning to test i2c bitbang driver (kmod-i2c-gpio-custom) with some bunch of sensors

This is great. Are you saying gpio7/R15 and gpio29/R17 have no effect on boot? Is the other end of these resistors grounded/0Ohm?

Also.. is there any easy way to access these (like LED IO) without recompiling?

I tried them out. I had sucess with gpio29/R17 - no need to remove the resistor. Gpio7 did not work for me.
Was able to simply echo 1 or 0 into the /sys/..../gpio27/value file
High was 3.3V, Low is 0.6V... though there may be a problem with the ground I am using