bobhenkel / milkv-duo-experiments

My experiments with the Milk-V Duo RISC-V board

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Milk-V Duo experiments

Milk-V Duo

This is a collection of my experiments with the Milk-V Duo board. It is based on RISC-V CPU and it runs Linux inside. So it’s not similar to Arduino or Raspberry Pi Pico where the board runs only your program that you flashed ont it. With Milk-V Duo you have an actual Linux with several dozen of processes running, and all the usual commands, including vi.

Out of the box it supports RNDIS networking (Ethernet over USB) so when I connected it to a USB cable connected to my Fedora Linux laptop I could ssh into it. I’m going to add an RJ-45 connector to it or a breakout board to use normal Ethernet.

I’m planning to use Go on this board so I made a couple of changes in the kernel configuration and rebuilt the image (see in the build-container directory).

hello is just a Hello, World program in Go compiled for this board (of course!).

http is a simple HTTP server running on this board (a dozen lines in Go).

montecarlo is a program calculating Pi using the Monte-Carlo method. I copied it from here: https://ggcarvalho.dev/posts/montecarlo/ and it seems to be a simple way to quickly measure CPU performance.

Also I collected some information about GPIO numbers (because I spent some time figuring it out myself so maybe it will save time for somebody else). Find the GPIO pins and numbers document in the docs directory.

Using gpiod

I started using the gpiod Go library written by @warthog618: https://github.com/warthog618/gpiod. Duo has a different pin naming scheme so I had to create my own mapping function.

In this board there are 5 GPIO chips (gpiochip0 to gpiochip4). The pins are named like GPIOA14, GPIOC9, or PWR_GPIO21 and they are served by different chips. In this case the names above would be translated to gpiochip0 + offset 14, gpiochip2 + offset 9, and gpiochip4 + offset 21 respectively.

The mapping function is located here: https://github.com/pavelanni/gpiod-milkvduo. You’ll find more details and a simple example there.

Board info

Here is the official Milk-V Duo documentation: https://milkv.io/docs/duo/overview

More information and guides are available here: https://spotpear.com/index/product/detail/id/1296.html (check the RESOURCES tab for the guides)

This repo contains datasheets and other info for the CPU/TPU used in Duo: https://github.com/sophgocommunity/Duo_Doc/tree/main

Pinout

pinout

About

My experiments with the Milk-V Duo RISC-V board

License:MIT License


Languages

Language:Go 73.6%Language:Dockerfile 26.4%