From 52Pi Wiki
(Redirected from SKU: EP-0117)
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

DockerPi RISCV ProtoType Board


This is a control board with onboard RISC-V microprocessor (GD32VF103), which belongs to the DockerPi series expansion board.
It communicates with the Raspberry Pi (or similar SBC) through I2C.
The factory program allows the user to control the changes of the two LEDs.
The software is fully open source, allowing users to program in JTAG mode.
There are 2 user indication LEDs, power LEDs, and all IOs.
It is suitable for coprocessors, analog conversions, low-power computing and other occasions.
You can customize a dockper pi-like device by using the RISCV prototype board, with a custom I2C address, and make it a coprocessor for your Raspberry Pi.

Please pay attention to the working characteristics of the microprocessor's GPIO during secondary development. Some pins cannot be compatible with 5V level, and some pins do not support high current drive.
The RISC-V architecture is very different from ARM.
You must read related manuals carefully before performing secondary development on it.


  • DockerPi series expansion board
  • Communicate with Raspberry Pi (or similar SBC) through I2C interface
  • Secondary development through JTAG interface, open source.
  • The factory preset program has the following characteristics
    • I2C control LED through program
    • I2C control LED by command
  • Support synergy with other DockerPi series
  • Low power consumption, high performance, and high energy efficiency


  • On-board reset button / TAMP button
  • 32.768kHz crystal on board
  • 8MHz crystal on board
  • RISC-V architecture
  • Multiple extension pins on board
  • Jlink/JTAG program interface
  • Device default address: 0x41


Package Includes

Getting Start

Development and debugging methods

  • 1. How to connect the JTAG debugger on the hardware.
Debugger recommendation: JLink V9
Debugger protocol: JTAG
  • 2. Install Platform IO using Visual Studio Code.

Download Visual Studio Code: [ https://code.visualstudio.com/ ] and install it.

  • 3. Install the GD32V library using Platform IO.

platformio platform install gd32v

  • 4. Create a new example in PIO Home
  • 5. Modify the debug and download protocol of platform.ini file as following parameters.
 upload_protocol = jlink
 debug_tool = jlink
 board = sipeed-longan-nano-lite
  • 6. Download Zadig and replace the JLink driver.
  • 7. Replace the main.c file with following code.
#include "gd32vf103.h"
#include "systick.h"
#include <stdio.h>
#include <stdint.h>
/* This address will generate I2C address: 0x41, you can detect this address by using "i2cdetect -y 1" on Raspberry Pi  
It will convert 8 bit address to 7bit address, for example, 0x82 binary is 1000 0010 ,shift right 1 bit, it became to 0100 0001, convert it to hex is 0x41
#define I2C0_SLAVE_ADDRESS7 0x82
uint8_t ubRegIndex = 0;
uint8_t aReceiveBuffer[255];
/* GD32VF103 I2C event handler */
void I2C0_EV_IRQHandler(void)
    /* Received request */
    if (i2c_interrupt_flag_get(I2C0, I2C_INT_FLAG_ADDSEND))
        i2c_interrupt_flag_clear(I2C0, I2C_INT_FLAG_ADDSEND);
        /* here are 2 possibilities for receiving a host write, write address / write data. */
    else if (i2c_interrupt_flag_get(I2C0, I2C_INT_FLAG_RBNE))
        if (ubRegIndex == 0)
            ubRegIndex = i2c_data_receive(I2C0);
            aReceiveBuffer[ubRegIndex++] = i2c_data_receive(I2C0);
        /* After receiving the host read signal, you should send the read content */
    else if (i2c_interrupt_flag_get(I2C0, I2C_INT_FLAG_TBE))
        i2c_data_transmit(I2C0, aReceiveBuffer[ubRegIndex++]);
        /* If the host is stopped, it should stop. */
    else if (i2c_interrupt_flag_get(I2C0, I2C_INT_FLAG_STPDET))
        ubRegIndex = 0;
        /* If you receive a NACK, it also means that the host does not want to send any more data.. */
    else if (i2c_interrupt_flag_get(I2C0, I2C_INT_FLAG_AERR))
        ubRegIndex = 0;
/* IRQ handler, if you want to add some interrupt request put here */
void I2C0_ER_IRQHandler(void)
int main(void)
    /* Clock initialization */
    /* Init 1 x button */
    /* Init 2 x LED */
    /* I2C GPIO initialization : PB6 => I2C0_SCL,PB7 => I2C0_SDA */
    /* Reset I2C peripheral */
    i2c_software_reset_config(I2C0, I2C_SRESET_SET);
    i2c_software_reset_config(I2C0, I2C_SRESET_RESET);
    /* I2C clock configuration, as a slave, this is not important, you do not need to modify this line. */
    i2c_clock_config(I2C0, 100000, I2C_DTCY_2);
    /* I2C address configuration */
    i2c_mode_addr_config(I2C0, I2C_I2CMODE_ENABLE, I2C_ADDFORMAT_7BITS, I2C0_SLAVE_ADDRESS7);
    /* Enable I2C funtion */
    /* Allow ACK */
    i2c_ack_config(I2C0, I2C_ACK_ENABLE);
    /* Turn on interrupt transactions */
    i2c_interrupt_enable(I2C0, I2C_INT_ERR);
    i2c_interrupt_enable(I2C0, I2C_INT_EV);
    i2c_interrupt_enable(I2C0, I2C_INT_BUF);
    eclic_irq_enable(I2C0_EV_IRQn, 1, 0);
/* It is a loop to blink. (2 LED shifting) */
    while (1)
        if(SET ==  gpio_input_bit_get(GPIOC, GPIO_PIN_13)){    
            if (aReceiveBuffer[3] % 2){
                gpio_bit_set(GPIOB, GPIO_PIN_0);
                gpio_bit_reset(GPIOB, GPIO_PIN_0);
            gpio_bit_set(GPIOA, GPIO_PIN_1);               /* Turn on  LED */
            gpio_bit_reset(GPIOA, GPIO_PIN_2);             /* Turn off  LED */
            delay_1ms(aReceiveBuffer[1] * 50 + 100);       /*  delay for a while */
            gpio_bit_set(GPIOA, GPIO_PIN_2);               /* Turn on  LED */
            gpio_bit_reset(GPIOA, GPIO_PIN_1);             /* Turn off  LED */
            delay_1ms(aReceiveBuffer[1] * 50 + 100);       /*  delay for a while */
  • 8. Compile and download to DockerPi RISCV prototype board by using J-link programmer.
  • 9. Enter debugging mode and end debugging mode.
  • 10.Test on Raspberry Pi.
    • Connect RISCV prototype board to Raspberry Pi via GPIO Pins.
    • Power on Raspberry Pi which already flashed latest Raspbian OS on TF card and open a terminal and typing this command:
i2cdetect -y 1 

you should see following picture:



  • RISCV, DockerPi series, GeeekPi, RISCV prototype board, PIO, GD32VF103, Raspberry Pi 4B, Raspberry Pi cooperate MCU