Jim's Depository

this code is not written
 

I purchased a pcduino v3 for a project. I specifically selected it for its Allwinner A20 processor with its dual Cortex A7 cores and SATA interface.

The vendor image I downloaded had a linux 3.4.79+ kernel which failed to work reliably with the SATA port and would freeze the computer with no debug output randomly, say every 10 minutes or so under heavy load. As is typical with ARM SoC units, the kernel source is a bit of a mess. In this case you have to get the kernel from Allwinner’s back ported android kernel, sunxi. There is some sunxi 7 support in mainline linux 3.17. Do not be deceived, it is not enough to work. I built 3.4.103++ from sunxi, which is a bit of a trial to get configured, there are a fair number of dependencies that you will only find when the compile breaks.

The 3.4.103++ kernel is working reliably for me with SATA, though my X display has broken. I’ll look into that later.

If there is a bootable SD card in the computer, it will boot from there. If not, it will fall back to its onboard NAND. I’ve elected to not touch the NAND and use it as my recovery method. Creating a bootable SD card requires a non-obvious trick. There is boot loader code which must be at block 8 and block 20 of the card. This means you cannot use a GUID partitioned card. The GUID partition table is in blocks 2 through 33.

You will need to build the these boot loaders, a stern googling for u-boot-sunxi-with-spl.bin will find all you need to know about it.

In partition 1 you will need to copy in the uEnv.txt, script.bin, and a uImage file. The uEnv.txt tells u-boot where to find your kernel and how to load it. The uImage is your kernel.

Some other things I learned along the way:

  1. Linux no longer supports root=LABEL=MYDISK on the kernel command line. It looks like it supports partition UUIDs, but without a GUID labeled disk that isn’t going anywhere. There is a NT label fallback, but I couldn’t get it to work. I’ve had to resort to direct device names and the nondeterminism that brings in the face of a drive failure.

  2. There is no meaningful documentation for the A20 chip except for a bunch of register names.

  3. If there is a CPU temperature monitor in the A20, no one knows how to use it. There is one in the AXP209 PMU which may get exposed in /sys/ if you are clever or fortunate. (I added a heatsink and fan while fighting the system hang. It didn’t help, so CPU temperature is probably not an issue. Still, I’m leaving the heatsink on.)

  4. The power connection to the board is unfortunate. They use a micro USB for power and ask for a 2 amp power source. The warning sign here is that micro USB connectors are only spec’d for 1.8 amps. Depending which of my 6 foot USB cables I use, I either get about 4.8V at 500mA, or 4.6V at 500mA. That is an uncomfortable voltage loss. I’d really have appreciated a couple of through holes where I could solder on a real header of some sort, especially since they suggest this board is suitable for 24x7 continuous use in devices. The schematic is large and disjoint, but I don’t think there is a good spot to pick this up.

  5. You can monitor your incoming voltage and current use with:

    cat /sys/devices/platform/sunxi-i2c.0/i2c-0/0-0034/axp20-supplyer.28/power_supply/ac/voltage_now
    cat /sys/devices/platform/sunxi-i2c.0/i2c-0/0-0034/axp20-supplyer.28/power_supply/ac/current_now
    
  6. For an idea of computer speed, a kernel compile using both cores takes about 50 minutes of wall clock time. My Core i7, (4 cores + hyper threading) does it in under 2 minutes. If you plan to do kernel work, cross compile.

  7. You don’t need that initramfs that is in the default kernel config. If you are trying to install Debian it will even mess you up. Leave it out when you build the kernel.

  8. You can get STL files for a pcduino v3 case. It is a little tight around the micro USB power connector and accessing the microSD card is about hopeless.

  9. There are mounting holes, but be careful, there isn’t much clearance around them. It would be easy to make contact between a screw head and a component. I made tiny o-rings by slicing some insulation from #8 AWG wire to stand the screw head high enough to not touch components. Nylon screws with tiny heads would be a great idea.