{
    "ok": true,
    "data": {
        "title": "EP-0117aA",
        "rev_id": 10676,
        "updated_at": "2021-08-27T10:26:45+00:00",
        "chunk_count": 12,
        "chunks": [
            {
                "title": "EP-0117aA",
                "rev_id": 10676,
                "heading_path": "",
                "chunk_index": 0,
                "content": "# EP-0117aA",
                "char_count": 11,
                "token_estimate": 3
            },
            {
                "title": "EP-0117aA",
                "rev_id": 10676,
                "heading_path": "Description",
                "chunk_index": 1,
                "content": "This is a control board with onboard RISC-V microprocessor (GD32VF103), which belongs to the DockerPi series expansion board.\nIt communicates with the Raspberry Pi (or similar SBC) through I2C.\nThe factory program allows the user to control the changes of the two LEDs.\nThe software is fully open source, allowing users to program in JTAG mode.\nThere are 2 user indication LEDs, power LEDs, and all IOs.\nIt is suitable for coprocessors, analog conversions, low-power computing and other occasions.\nYou 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.\n<b>Warning: <\/b>\n\n    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.\n    The RISC-V architecture is very different from ARM.\n    You must read related manuals carefully before performing secondary development on it.",
                "char_count": 1027,
                "token_estimate": 257
            },
            {
                "title": "EP-0117aA",
                "rev_id": 10676,
                "heading_path": "Features",
                "chunk_index": 2,
                "content": "-   DockerPi series expansion board\n-   Communicate with Raspberry Pi (or similar SBC) through I2C interface\n-   Secondary development through JTAG interface, open source.\n-   The factory preset program has the following characteristics\n    -   I2C control LED through program\n    -   I2C control LED by command\n-   Support synergy with other DockerPi series\n-   Low power consumption, high performance, and high energy efficiency",
                "char_count": 430,
                "token_estimate": 108
            },
            {
                "title": "EP-0117aA",
                "rev_id": 10676,
                "heading_path": "Specifications",
                "chunk_index": 3,
                "content": "-   On-board reset button \/ TAMP button\n-   32.768kHz crystal on board\n-   8MHz crystal on board\n-   RISC-V architecture\n-   Multiple extension pins on board\n-   Jlink\/JTAG program interface\n-   Device default address:<b> 0x41<\/b>",
                "char_count": 230,
                "token_estimate": 58
            },
            {
                "title": "EP-0117aA",
                "rev_id": 10676,
                "heading_path": "Getting Start > Development and debugging methods",
                "chunk_index": 4,
                "content": "-   1\\. How to connect the JTAG debugger on the hardware.\n\n<!-- -->\n\nDebugger recommendation: JLink V9\n    Debugger protocol: JTAG\n\n-   2\\. Install Platform IO using Visual Studio Code.\n\nDownload Visual Studio Code: \\[ <https:\/\/code.visualstudio.com\/> \\] and install it.\n\n-   3\\. Install the GD32V library using Platform IO.\n\n`platformio platform install gd32v`\n\\* 4. Create a new example in PIO Home\n\n-   5\\. Modify the debug and download protocol of platform.ini file as following parameters.\n\n<!-- -->\n\nupload_protocol = jlink\n     debug_tool = jlink\n     board = sipeed-longan-nano-lite\n\n-   6\\. Download Zadig and replace the JLink driver.\n-   7\\. Replace the main.c file with following code.\n\n<!-- -->\n\n#include \"gd32vf103.h\"\n    #include \"systick.h\"\n    #include <stdio.h>\n    #include <stdint.h>\n\n\/* This address will generate I2C address: 0x41, you can detect this address by using \"i2cdetect -y 1\" on Raspberry Pi\n    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\n    *\/\n    #define I2C0_SLAVE_ADDRESS7 0x82\n\nuint8_t ubRegIndex = 0;\n    uint8_t aReceiveBuffer[255];",
                "char_count": 1184,
                "token_estimate": 296
            },
            {
                "title": "EP-0117aA",
                "rev_id": 10676,
                "heading_path": "Getting Start > Development and debugging methods",
                "chunk_index": 5,
                "content": "\/* GD32VF103 I2C event handler *\/\n    void I2C0_EV_IRQHandler(void)\n    {\n        \/* Received request *\/\n        if (i2c_interrupt_flag_get(I2C0, I2C_INT_FLAG_ADDSEND))\n        {\n            i2c_interrupt_flag_clear(I2C0, I2C_INT_FLAG_ADDSEND);\n            \/* here are 2 possibilities for receiving a host write, write address \/ write data. *\/\n        }\n        else if (i2c_interrupt_flag_get(I2C0, I2C_INT_FLAG_RBNE))\n        {\n            if (ubRegIndex == 0)\n            {\n                ubRegIndex = i2c_data_receive(I2C0);\n            }\n            else\n            {\n                aReceiveBuffer[ubRegIndex++] = i2c_data_receive(I2C0);\n            }\n            \/* After receiving the host read signal, you should send the read content *\/\n        }\n        else if (i2c_interrupt_flag_get(I2C0, I2C_INT_FLAG_TBE))\n        {\n            i2c_data_transmit(I2C0, aReceiveBuffer[ubRegIndex++]);\n            \/* If the host is stopped, it should stop. *\/\n        }\n        else if (i2c_interrupt_flag_get(I2C0, I2C_INT_FLAG_STPDET))\n        {\n            i2c_stop_on_bus(I2C0);\n            ubRegIndex = 0;",
                "char_count": 1109,
                "token_estimate": 278
            },
            {
                "title": "EP-0117aA",
                "rev_id": 10676,
                "heading_path": "Getting Start > Development and debugging methods",
                "chunk_index": 6,
                "content": "\/* If you receive a NACK, it also means that the host does not want to send any more data.. *\/\n        }\n        else if (i2c_interrupt_flag_get(I2C0, I2C_INT_FLAG_AERR))\n        {\n            ubRegIndex = 0;\n        }\n    }\n    \/* IRQ handler, if you want to add some interrupt request put here *\/\n    void I2C0_ER_IRQHandler(void)\n    {\n    }",
                "char_count": 344,
                "token_estimate": 86
            },
            {
                "title": "EP-0117aA",
                "rev_id": 10676,
                "heading_path": "Getting Start > Development and debugging methods",
                "chunk_index": 7,
                "content": "int main(void)\n    {\n        \/* Clock initialization *\/\n        rcu_periph_clock_enable(RCU_GPIOA);\n        rcu_periph_clock_enable(RCU_GPIOB);\n        rcu_periph_clock_enable(RCU_GPIOC);\n        rcu_periph_clock_enable(RCU_I2C0);\n        \/* Init 1 x button *\/\n        gpio_init(GPIOC, GPIO_MODE_IPU, GPIO_OSPEED_50MHZ, GPIO_PIN_13);\n        \/* Init 2 x LED *\/\n        gpio_init(GPIOA, GPIO_MODE_OUT_PP, GPIO_OSPEED_50MHZ, GPIO_PIN_1 | GPIO_PIN_2);\n        gpio_init(GPIOB, GPIO_MODE_OUT_PP, GPIO_OSPEED_50MHZ, GPIO_PIN_0);\n        \/* I2C GPIO initialization : PB6 => I2C0_SCL,PB7 => I2C0_SDA *\/\n        gpio_init(GPIOB, GPIO_MODE_AF_OD, GPIO_OSPEED_50MHZ, GPIO_PIN_6 | GPIO_PIN_7);\n        \/* Reset I2C peripheral *\/\n        i2c_software_reset_config(I2C0, I2C_SRESET_SET);\n        i2c_software_reset_config(I2C0, I2C_SRESET_RESET);\n        \/* I2C clock configuration, as a slave, this is not important, you do not need to modify this line. *\/\n        i2c_clock_config(I2C0, 100000, I2C_DTCY_2);\n        \/* I2C address configuration *\/\n        i2c_mode_addr_config(I2C0, I2C_I2CMODE_ENABLE, I2C_ADDFORMAT_7BITS, I2C0_SLAVE_ADDRESS7);\n        \/* Enable I2C funtion *\/\n        i2c_enable(I2C0);",
                "char_count": 1193,
                "token_estimate": 299
            },
            {
                "title": "EP-0117aA",
                "rev_id": 10676,
                "heading_path": "Getting Start > Development and debugging methods",
                "chunk_index": 8,
                "content": "\/* Allow ACK *\/\n        i2c_ack_config(I2C0, I2C_ACK_ENABLE);\n        \/* Turn on interrupt transactions *\/\n        i2c_interrupt_enable(I2C0, I2C_INT_ERR);\n        i2c_interrupt_enable(I2C0, I2C_INT_EV);\n        i2c_interrupt_enable(I2C0, I2C_INT_BUF);",
                "char_count": 252,
                "token_estimate": 63
            },
            {
                "title": "EP-0117aA",
                "rev_id": 10676,
                "heading_path": "Getting Start > Development and debugging methods",
                "chunk_index": 9,
                "content": "eclic_global_interrupt_enable();\n        eclic_irq_enable(I2C0_EV_IRQn, 1, 0);\n\n\/* It is a loop to blink. (2 LED shifting) *\/\n        while (1)\n        {\n            if(SET ==  gpio_input_bit_get(GPIOC, GPIO_PIN_13)){\n                if (aReceiveBuffer[3] % 2){\n                    gpio_bit_set(GPIOB, GPIO_PIN_0);\n                }else{\n                    gpio_bit_reset(GPIOB, GPIO_PIN_0);\n                }\n                gpio_bit_set(GPIOA, GPIO_PIN_1);               \/* Turn on  LED *\/\n                gpio_bit_reset(GPIOA, GPIO_PIN_2);             \/* Turn off  LED *\/\n                delay_1ms(aReceiveBuffer[1] * 50 + 100);       \/*  delay for a while *\/\n                gpio_bit_set(GPIOA, GPIO_PIN_2);               \/* Turn on  LED *\/\n                gpio_bit_reset(GPIOA, GPIO_PIN_1);             \/* Turn off  LED *\/\n                delay_1ms(aReceiveBuffer[1] * 50 + 100);       \/*  delay for a while *\/\n            }\n        }\n    }",
                "char_count": 946,
                "token_estimate": 237
            },
            {
                "title": "EP-0117aA",
                "rev_id": 10676,
                "heading_path": "Getting Start > Development and debugging methods",
                "chunk_index": 10,
                "content": "-   8\\. Compile and download to DockerPi RISCV prototype board by using J-link programmer.\n-   9\\. Enter debugging mode and end debugging mode.\n-   10.Test on Raspberry Pi.\n    -   Connect RISCV prototype board to Raspberry Pi via GPIO Pins.\n    -   Power on Raspberry Pi which already flashed latest Raspbian OS on TF card and open a terminal and typing this command:\n\n<!-- -->\n\ni2cdetect -y 1\n\nyou should see following picture: <img src=\"Riscvi2c.jpg\" title=\"Riscvi2c.jpg\" width=\"320\" alt=\"Riscvi2c.jpg\" \/>",
                "char_count": 508,
                "token_estimate": 127
            },
            {
                "title": "EP-0117aA",
                "rev_id": 10676,
                "heading_path": "Keywords",
                "chunk_index": 11,
                "content": "-   RISCV, DockerPi series, GeeekPi, RISCV prototype board, PIO, GD32VF103, Raspberry Pi 4B, Raspberry Pi cooperate MCU",
                "char_count": 119,
                "token_estimate": 30
            }
        ]
    }
}