Every now and then a couple of friends come together to create something new and exciting. Even more so, when one is part of something like the SEM electronics club! This time, two members designed and built their own SBC from scratch, and I agreed to add Linux support to it.
The board is built around on the Allwinner F1C200s, a “turn-key” SoC, so to say. It has TODO Arm cores and X GB of in-built DDR DRAM memory.
The name of the project is “minilaptop”, because, unlike most SBCs, it was designed for portable operations as well; to this end, it has a IP5306-I2C Battery Charger/Discharger (more on this later). It also has an ESP8266-based ESP-12F for WiFi connectivity (more foreshadowing…). The SoC has analog sound output, that drives a TODO stereo headphone amp, to drive external speakers. The USB lines were also routed out to a USB-A connector, although the SoC is capable of operating as both a host or a device (used for instance, when using the ROM loader to write the boot Flash). The Type-C connector sadly is power only. But as for other laptop I/O, specifically display and human input, the board is quite lacking. It has a TODO FPC connector for a character LCD driven by SPI, and it has a double-row 2.54mm header for the GPIOs and lower speed interfaces (I2C, UART etc. TODO). Thus I only used the UART console, available on another pin header, to interact with the Linux on the board.
In traditional SBC fashion, the board has a μSD card slot for storing the OS. And as far as I know, the SoC is capable of booting from SD directly. However, to protect the bootloader (U-Boot in this case) from accidental overwrites, it was decided that it should live in an SPI Flash instead, and boot from there.
Now, adding a discrete SPI NOR Flash for this would add to the component cost, assembly time (remember, these boards were initially hand-soldered) and take up an extra chip-select line, only for it to be not used for the majority of time! On the other hand, the ESP-12F is pin-strapped to not boot from its built-in Flash, but instead wait for a firmware download via SDIO (ESP8089 mode, see WiFi section)! This theoretically frees up the NOR Flash for us to store the main CPU’s U-Boot in. The pins used for SPI are the same as those for SDIO on both the ESP8266 and the F1C200s, so this turned out to be as simple as telling the ESP not to boot from its Flash via pin-strapping, tell the F1C200s to use those pins as SPI to boot from that Flash, and then under Linux, switch those pins to be SDIO.
Now, throughout my college years and now at work, I have encountered many cursed “solutions”, and thus developed an instinct to evaluate whether a crazy idea may work or not. In fact, I have a very good friend, who I call “90% genius, 10% madman, but only I seem to know which 10% is which”. In this case though, this got the green light from me, and, as expected, it wasn’t too bad to achieve. However, my colleagues at work, who are being traumatized by the likes of the MAX24287 SerDes (ugh, still gives me the creeps too), were instantly frightened upon hearing this. But hey, not all crazy ideas are bad (although the odds are somewhat high), just like not all bad ideas are necessarily crazy (there are plenty that sounded good on paper).