GPIO


GPIO lines can be used to connect devices to the WGT634U, using SPI or I2C protocols, or just to light an LED or listen to a button. People have added SD card readers to WRT54Gs this way.

http://kiel.kool.dk , http://forum.openwrt.org/viewtopic.php?pid=33727 .

 

I poked at the hardware with CFE:

CFE> d b8000060 10
B8000060: 000000FD 000000FD 000000C3 00000000  ................
CFE> e b8000064
Type '.' to exit, '-' to back up, '=' to dump memory.
B8000064: [000000FD]: ff
B8000068: [000000C3]: ff
B800006C: [00000000]: .
CFE> d b8000060 10
B8000060: 000000FF 000000FF 000000FF 00000000  ................
CFE> e b8000064
B8000064: [000000FF]: 00
B8000068: [000000FF]: .
CFE> d b8000060 10
B8000060: 00000000 00000000 000000FF 00000000  ................
CFE>

The four sequential words are

0xb8000060 input
0xb8000064 output
0xb8000068 output enable
0xb800006c control (seems that zero activates the I/O line)

 

In the sequence above I set the 8 GPIO bits to output mode and commanded them to 1's (+3.3V logic level). Then I set them all to 0's. (I think that the BCM5365 has 16 GPIO lines, but I only looked for 8.)

 

With a meter I identified 7 of the eight bits:

0x80 TP1
0x40 TP2
0x20 TP3
0x10 TP4
0x08 U6.13 to yellow Power LED
0x04 reset pushbutton on back panel
0x02 TP5
0x01 unknown

The testpoints TP1 - TP5 are little gold pads near the Broadcom chip.

 


 

Using the GPIO Pins as output:

To use the GPIO Pins as output you can use the diag module. To add the TP-GPIO lines to show up under "/proc/diag/led" you just need to edit the file "trunk/package/broadcom-diag/src/diag.c" and add the TP as mentioned above:

		{ .name = "connected",	.gpio = 1 << 0, .polarity = NORMAL },
		},
	},
	/* Netgear */
	[WGT634U] = {
		.name		= "Netgear WGT634U",
		.buttons	= {
			{ .name = "reset",	.gpio = 1 << 2 },
		},
		.leds		= {
			{ .name = "power",	.gpio = 1 << 3, .polarity = REVERSE },
			{ .name = "tp1",	.gpio = 1 << 7, .polarity = NORMAL },
			{ .name = "tp2",	.gpio = 1 << 6, .polarity = NORMAL },
			{ .name = "tp3",	.gpio = 1 << 5, .polarity = NORMAL },
			{ .name = "tp4",	.gpio = 1 << 4, .polarity = NORMAL },
			{ .name = "tp5",	.gpio = 1 << 1, .polarity = NORMAL },
		},
	},
	/* Trendware */
	[TEW411BRPP] = {
		.name           = "Trendware TEW411BRP+",
		.buttons        = {
			{ /* No usable buttons */ },

 

Location of Test Points TP1 to TP5: