I needed a way of easily testing builds on the RockPRO64 without writing SD cards, pushing buttons and so on. So, let’s automate as much as possible, even resetting and powering off/on the board under test.
Serial console
The serial console of the RockPRO64 is useful for debugging, as all of the messages from the earliest firmware and bootloader are printed to it by default. Beyond seeing the messages, when we get to the stage of U-Boot starting, we can even send characters over the serial console to interrupt the boot process and then control U-Boot.
The serial console is a simple UART with transmit, receive and ground pins exposed on the 40-pin I/O header on the RockPRO64. This can be connected in crossover fashion to the UART on the Raspberry Pi - the location of the pins is identical, we would normally just need to connect the transmit pin on one board to the receive pin on the other, and vice versa. However there’s a slight complication in that this section of the RK3399 system-on-chip on the RockPRO64 is configured to work with 3.0V signal levels, while the Pi uses 3.3V. To be safe, we should avoid putting 3.3V into the RockPRO64, and we can use a simple voltage divider to reduce the voltage from 3.3V to 3.0V. The ground pins from each board are connected together.