These LED are connected as follows:
Red "status" LED on PA15 Green "power" LED on PL10The red LED should be easy given that it is connected to the first GPIO and should not have any quirks.
The usual problem I have with Allwinner peripherals not working is that each peripheral has its own clock and reset control and the board comes up with the clock off and the device held in reset.
A quick peek yields no solution. There seems to be no reset bit allocated for the GPIO. There is one "PIO" clock control bit. This effort starts to turn into several small projects:
As well as the PIO, we want documentation for the pin mux.
This is handled by the first 4 registers in the GPIO itself.
Each register has 8 fields, 4 bits in size, so the 4 registers
can configure 32 pins. All this is described under "Port Controller".
Only 3 bits of the 4 are actually used.
A value of 0 selects GPIO input
A value of 1 selects GPIO output
The other 6 values can select alternate functions
I was eager to check that the port function mux was set up so the pin in question would actually drive the output. And it was and is.
I write some code to write to all 32 bits in the GPIO-A data register (after configuring them all to outputs. A broad brush approach. I hit paydirt more quickly than I dreamed as the red LED comes on! I am sending a 100 Hz square wave on all pins, so no doubt it is not full brightness, but this is exciting.
Now it is a trial and error process of finding out which bit is controlling the LED. It turns out to be this bit:
0x00100000By my reckoning, this is bit 20. And indeed, when I specify A20 for the status LED, my regular code blinks it nicely.
And the schematic shows PA20 as clear as can be as being the STATUS LED, so where did I get the idea it was A15? Was I so foolish as to assume it would just be the same as the H3 boards? Maybe so.
Something to keep in mind for the future.
Tom's electronics pages / tom@mmto.org