RV-Debugger-BL702 is an opensource project that implement a JTAG+UART debugger with BL702C-A0.

Overview

Description

RV-Debugger-BL702 is an opensource project that implement a JTAG+UART debugger with BL702C-A0.

BL702 is highly integrated BLE and Zigbee combo chipset for IoT applications, contains 32-bit RISC-V CPU with FPU, frequency up to 144MHz, with 132KB RAM and 192 KB ROM, 1Kb eFuse, 512KB embedded Flash, USB2.0 FS device interface, and many other features.

The firmware implement is inspired by open-ec, implement by Sipeed teams and community developers.

The firmware emulate an FT2232D device, defaultly implement an JTAG+UART debugger, and can be implement as a Dual-Serial Port debugger, a bluetooth debugger, etc.

Community Forum: bbs.sipeed.com

Hardware

Offical Board

Sipeed RV-Debugger-Plus (BL702C-A0)

Purchase link: taobao.com/xxx

Schematic: BL702_USB2JTAG_3610_sch.pdf

Assembly: BL702_USB2JTAG_3610_asm.pdf

(LED0 is the led close to edge, indicate for RX)


Third-party Hardware

TODO

Firmware

Flash Tutorial

Press "boot" button then plug usb cable, and you will see "CDC Virtual ComPort" in device manager , remember the com number.

The flash tool is in tools/bflb_flash_tool directory, and input the command (replace port number and firmware name):

Windows:
.\bflb_mcu_tool.exe --chipname=bl702 --port=COM9 --xtal=32M --firmware="main.bin"
Linux:
./bflb_mcu_tool --chipname=bl702 --port=COM9 --xtal=32M --firmware="main.bin"
tools\bflb_flash_tool> .\bflb_mcu_tool.exe --chipname=bl702 --port=COM9 --xtal=32M --firmware="main.bin"
[22:07:28.296] - ==================================================
[22:07:28.296] - Chip name is bl702
[22:07:28.297] - Serial port is COM9
[22:07:28.299] - Baudrate is 115200
[22:07:28.299] - Firmware is main.bin
[22:07:28.300] - Default flash clock is 72M
[22:07:28.300] - Default pll clock is 144M
[22:07:28.311] - ==================================================
[22:07:28.483] - Update flash cfg finished
[22:07:28.500] - EFUSE_CFG
[22:07:28.500] - BOOTHEADER_CFG
......
[22:07:31.274] - Load 53856/53856 {"progress":100}
[22:07:31.274] - Write check
[22:07:31.274] - Flash load time cost(ms): 267.942626953125
[22:07:31.275] - Finished
[22:07:31.276] - Sha caled by host: 825d198270c2cf509acda8f8e0830751c532da802060c324a4479e1fe599ae1f
[22:07:31.276] - xip mode Verify
[22:07:31.288] - Read Sha256/53856
[22:07:31.288] - Flash xip readsha time cost(ms): 12.508056640625
[22:07:31.288] - Finished
[22:07:31.288] - Sha caled by dev: 825d198270c2cf509acda8f8e0830751c532da802060c324a4479e1fe599ae1f
[22:07:31.288] - Verify success
[22:07:31.289] - Program Finished
[22:07:31.289] - All time cost(ms): 2220.2548828125
[22:07:31.390] - [All Success]

Another GUI flash tool is BouffaloLabDevCube:

usb2uartjtag (default)

Support JTAG+UART function

UART support baudrate below 2Mbps, and 3Mbps, and some experimental baudrate (stability is not guaranteed):

12M, 9.6M, 8M, 6.4M, 6M, 4.8M, 4M, 3.2M
we remap baudrate in 10000~12000 to (baud-10000)*10000
for example, 11200bps -> 12Mbps

LED0 for RX indication, LED1 for TX indication.

JTAG function is verified for :

  • RV32 Xuantie E906/E907
  • RV64 Xuantie C906
  • Gowin FPGA GW1N-1, GW1NS-4C.

usb2dualuart

TODO.

Project Structure

RV-Debugger-BL702
├── bsp
│   ├── board
│   │   └── bl702_debugger
│   └── bsp_common
│       └── platform
├── common
│   ├── device
│   ├── libc
│   ├── list
│   ├── memheap
│   ├── misc
│   ├── partition
│   ├── ring_buffer
│   └── soft_crc
├── components
│   ├── shell
│   └── usb_stack
├── drivers
│   └── bl702_driver
├── examples
│   └── usb
│       ├── usb2uartjtag
│       └── usb2dualuart
├── out
├── tools
│   ├── bflb_flash_tool
│   ├── cdk_flashloader
│   ├── cmake
│   └── openocd
└── hardware
    

BL SDK usage tutorial refer to http://bouffalolab.gitee.io/bl_mcu_sdk/

Develop Guide

the main file is:

examples/usb/usb2uartjtag:
├── main.c
├── uart_interface.c
├── jtag_process.c
└── io_cfg.h         //main io cfg, another file is pinmux_config.h in bsp/board/bl702_debugger
components/usb_stack/class/vendor:
└── usbd_ftdi.c      //all FTDI vendor request process, like baudrate set, dtr/rts set, Latency_Timer

TODO

Comments
  • make sdk as submodule & move and update code & update workflows

    make sdk as submodule & move and update code & update workflows

    1. use bl_mcu_sdk as submodule than intrusive modification (because bouffalolab has not accept my pr)
    2. move codes to firmware/app/usb2uartjtag and do a few fixes because of updated sdk
    3. move usbd_ftdi.c/.h also to firmware/app/usb2uartjtag and update CMakeList.txt
    4. delete ld file because not needed
    5. update the build_firmware.yml with checked and passed

    Details about codes fix:

    1. change DMA_CHANNEL_* to DEVICE_CTRL_DMA_CHANNEL_* in uart_interface.c
    2. change uart_register() and dma_register() to use two params than three
    3. change irq_disable() and irq_enable() to cpu_global_irq_disable() and cpu_global_irq_enable()

    All of my work are just move and rename and a little fix, and if there is any bug I cant recognized, please tell me and I will reply soon.

    opened by taorye 0
  • Add usb2dualuart

    Add usb2dualuart

    Application usb2dualuart is added to examples/usb/usb2dualuart.

    Basically, usb2dualuart is cloned from usb2uartjtag and kept close resemblance. Unfortunately, the BSP has to be modified.

    Known issues :

    • no idea how the EEPROM is functioning, related code not modified
    • no idea what's going on with SIO_POLL_MODEM_STATUS_REQUEST in ftdi_vendor_request_handler()
    • bflb_platform_printf() is not nullified at compile-time, it is disabled at runtime instead
    • documentation not updated

    To build, run "make APP=usb2dualuart"

    opened by emuzit 0
  • OpenOCD: No progress with mpsse_flush( )

    OpenOCD: No progress with mpsse_flush( )

    The mpsse implementation seems to be buggy. I cannot get this adapter to reliably work with OpenOCD. At times OpenOCD just hangs with the message "Haven't made progress in mpsse_flush()..."

    This seems to happen more with OpenOCD 0.11.0-4, but I have also seen it happen with 0.10.0, which comes with Ubuntu (18.04 LTS).

    opened by GideonZ 1
  • No Setup/Hold time on TDI / TMS

    No Setup/Hold time on TDI / TMS

    With my purchased Sipeed RV Debugger Plus, which seems to use this firmware, I am not getting any successful JTAG connection using OpenOCD.

    One issue is that the setup and hold times on TDI and TMS are near zero. This is wrong!

    TDI and TCK toggle AT THE SAME TIME. Even more so, TDI / TMS also change on the falling edge of TCK. I did not expect this, and it is highly suspicious.

    Please fix, as this adapter is totally unusable with a timing like this.

    opened by GideonZ 1
  • USB enumeration issues

    USB enumeration issues

    I'm experiencing USB enumeration issues on the Tang Nano 1K, 4K, and 9K boards. It seems that they use the same chip and presumably also the same firmware as this project so I'm reporting it here. Correct me if I'm wrong.

    The problem is that when I try to connect the programmer to my computer over a USB hub, it fails to enumerate.

    [29332.909014] usb 7-1.2: new full-speed USB device number 8 using xhci_hcd
    [29338.196264] usb 7-1.2: device descriptor read/64, error -71
    [29343.532540] usb 7-1.2: device descriptor read/64, error -71
    [29343.722499] usb 7-1.2: new full-speed USB device number 9 using xhci_hcd
    [29348.862626] usb 7-1.2: device descriptor read/64, error -71
    [29354.196037] usb 7-1.2: device descriptor read/64, error -71
    [29354.302915] usb 7-1-port2: attempt power cycle
    [29354.916045] usb 7-1.2: new full-speed USB device number 10 using xhci_hcd
    [29360.086242] xhci_hcd 0000:0a:00.3: Timeout while waiting for setup device command
    [29365.419676] xhci_hcd 0000:0a:00.3: Timeout while waiting for setup device command
    [29365.626240] usb 7-1.2: device not accepting address 10, error -62
    [29365.709582] usb 7-1.2: new full-speed USB device number 11 using xhci_hcd
    [29365.709791] usb 7-1.2: Device not responding to setup address.
    [29365.916323] usb 7-1.2: Device not responding to setup address.
    [29366.123016] usb 7-1.2: device not accepting address 11, error -71
    [29366.123294] usb 7-1-port2: unable to enumerate USB device
    

    This also happens on the front-panel USB hubs if there are other USB devices connected to the adjacent ports. However, if I unplug all other devices from the front panel it successfully enumerates again.

    Enumeration works fine when directly connecting to USB ports in the motherboard.

    I haven't experienced any enumeration issues with my other USB devices on these hubs so it seems like the issue related to the BL702 implementation.

    opened by chiplet 0
  • Build fixes; uploader is still linux-only

    Build fixes; uploader is still linux-only

    1. entry.S doesn't build with popular toolchains. The fix is exactly the same as in: https://github.com/robertlipe/bl_mcu_sdk/commit/b44f151b2c70917c95ffeec665d23c07e491cbbf

    2. $ make download fails when run on a non-Linux system because The uploader is provided as a Linux-only binary. This is an offshoot of https://github.com/bouffalolab/bl_iot_sdk/issues/20

    opened by Bit-Sculptor 0
  • [Instruction] How to build on Debian Buster and Bullseye

    [Instruction] How to build on Debian Buster and Bullseye

    How to build on Debian Buster

    To build RV-Debugger-BL702 you need a compiler. which is available in the following 3 packages.

    binutils-riscv64-unknown-elf
    gcc-riscv64-unknown-elf
    picolibc-riscv64-unknown-elf
    

    Current stable, Buster, does not have these packages. So we'll have to borrow them from current testing, Bullseye.

    Specifically you'll need the following 3 package files. ( at the time of writing )

    pool/main/b/binutils-riscv64-unknown-elf/binutils-riscv64-unknown-elf_2.32.2020.04+dfsg-2_amd64.deb
    pool/main/g/gcc-riscv64-unknown-elf/gcc-riscv64-unknown-elf_8.3.0.2019.08+dfsg-1_amd64.deb
    pool/main/p/picolibc/picolibc-riscv64-unknown-elf_1.5.1-2_all.deb
    

    Which can be found at the following locations respectively.

    https://ftp.debian.org/debian/pool/main/b/binutils-riscv64-unknown-elf/
    https://ftp.debian.org/debian/pool/main/g/gcc-riscv64-unknown-elf/
    https://ftp.debian.org/debian/pool/main/p/picolibc/
    

    Install those 3 packages using dpkg command.

    > dpkg -i binutils-riscv64-unknown-elf_2.32.2020.04+dfsg-2_amd64.deb
    > dpkg -i gcc-riscv64-unknown-elf_8.3.0.2019.08+dfsg-1_amd64.deb
    > dpkg -i picolibc-riscv64-unknown-elf_1.5.1-2_all.deb
    

    note: you need root privilege

    clone this repo and do a small patching.

    > git clone https://github.com/sipeed/RV-Debugger-BL702
    > cd RV-Debugger-BL702
    > echo "add_compile_options(-specs=picolibc.specs)" >> tools/cmake/compiler_flags.cmake
    > echo "add_link_options(-specs=picolibc.specs)" >> tools/cmake/compiler_flags.cmake
    

    then edit CMakeList.txt .

    @@ -1,1 +1,1 @@
    - cmake_minimum_required(VERSION 3.15)
    + cmake_minimum_required(VERSION 3.13)
    

    finally fire up the make command.

    > make
    

    and binary firmware file will be created at out/usb/usb2uartjtag/main.bin .

    of course you need make and cmake. so do install them if you haven't yet.

    > apt install make cmake
    

    note: you need root privilege

    opened by elfmimi 1
Owner
Sipeed
AIoT opensource hardware platform
Sipeed
Single-chip solution for Hi-speed USB2.0(480Mbps) JTAG/SPI Debugger based on RISC-V MCU CH32V30x/CH32V20x

480Mbps High Speed USB2.0 JTAG Debugger Open source information |-- bin |--------MCU: MCU target program |--------WIN APP |------------------USB20Jtag

RISC-V 58 Jan 5, 2023
bl_mcu_sdk is MCU software development kit provided by Bouffalo Lab Team for BL602/BL604, BL702/BL704/BL706 and other series of RISC-V based chips in the future.

bl mcu sdk is an MCU software development kit provided by the Bouffalo Lab Team for BL602/BL604, BL702/BL704/BL706 and other series of chips in the future

Bouffalo Lab 165 Dec 23, 2022
Raspberry Pico powered Xilinx Virtual Cable - Xilinx JTAG Cable!

This project implements a Raspberry Pico based Xilinx Virtual Cable (XVC). It allows using Raspberry Pico as a JTAG adapter for programming Xilinx FPGAs.

Dhiru Kholia 182 Jan 2, 2023
Enables Permanent UART output across boots. Supports PS4 version 6.72 only for now

Enables Permanent UART for PS4. Requires a 5.05/6.72/7.02 Jailbroken PS4. To build, you require ps4-sdk from Scene-Collective/ps4-payload-sdk In the t

Alexander Boulton 15 May 12, 2022
An OLED gauge for the Speeduino ECU. Uses UART (secondary serial) for communication.

speeduino-ardugauge An OLED gauge for the Speeduino ECU. Uses UART (secondary serial) for communication. See demo video. See screenshots. NOTE: The ga

null 15 Dec 18, 2022
This repository gives an idea about how to use UART/SPI/I2C communication using HAL APIs

STM32-UART-SPI-I2C communication with Arduino board using HAL APIs This repository gives an idea about how to use UART/SPI/I2C communication using HAL

Shrilesh(Skrillex) 1 Nov 1, 2021
Using D2XX driver to capture UART data to a binary file

What is it This is the sample code to read UART data using any baud rate that FTDI supports and save them to a binary file. How to use Usage: ./larger

pandy song 1 Nov 24, 2021
Allwinner V3S Opensource

KS_V3S • Bilibili Video Introduction:https://www.bilibili.com/video/BV17z4y1S7D6 I have designed this PCB, because the sheer power of this SoC, at ver

Kevincoooool 195 Dec 29, 2022
SMARTmBOT - a new, customizable, scalable, and fully opensource mobile robot platform

The goal of this repository is to introduce a new, customizable, scalable, and fully opensource mobile robot platform, called SMARTmBOT. This repository provides a guide, and all design files and source codes so that you can build your own SMARTmBOT. SMARTmBOT can be useful for studying the basics of robotics, especially mobile robotics. It can also be used to study advanced topics such as swarm robotics.

SMART Lab at Purdue University 39 Jan 2, 2023
ORBION the OpenSource Space Mouse 3D

Orbion The OpenSource Space Mouse To ensure greater precision and fluidity it is recommended to put a foam ring under the knob (see photo above) and d

FaqTotum 314 Jan 7, 2023
sipeed opensource mechanical keyboard make with BL706

sipeed_keyboard sipeed opensource mechanical keyboard make with BL706 矽π 开源双模机械键盘 目录结构 ./ ├── LICENSE ├── README.md ├── firmware // 存放键盘固件 ├── hardwar

Sipeed 58 Dec 23, 2022
RoboMaster2021 Infantry Vision OpenSource Code of Foshan University

佛山科学技术学院醒狮战队2021赛季步兵视觉开源 致谢 首先感谢各高校开源代码为本套代码提供的参考,以及感谢2018、2019、2020赛季算法组师兄们的努力。秉承着开源精神,促进各战队间技术交流提升,我队决定本赛季开源本套代码,希望对其他战队提供一定的参考价值。 说明 本套代码是佛山科学技术学院醒

null 28 Aug 30, 2022
A repository to contribute and learn OpenSource

HacktoberFest 2021 ?? An opensource intiative organised by DigitalOcean and Intel SO this is an An Open Source repository to Teach people How to contr

BreadBoard Coding Society 19 Nov 13, 2022
free template opensource with minimal depends library flutter & dart

Project Name Sosial Media Donate ID: Jika Anda Menyukai karya saya dan ingin memberikan dana untuk saya membeli beberapa snack silahkan donasi seberap

Azka Full Snack Developer:) 34 Dec 23, 2022
This is the official source code of FreeCAD, a free and opensource multiplatform 3D parametric modeler

This is the official source code of FreeCAD, a free and opensource multiplatform 3D parametric modeler

FreeCAD 12.9k Dec 31, 2022
PyAerotech: An Opensource Python Library or interfacing directly with the Aerotech A3200 Controlle

PyAerotech: An Opensource Python Library or interfacing directly with the Aerotech A3200 Controller pyAerotech is an additional Opensource Python libr

Dr Luke Parry 3 Aug 22, 2022
This is the second genereation of my fully opensource Spacemouse called SpaceRat

SpaceRat This is the second genereation of my fully opensource Spacemouse called SpaceRat. With the help of this you can navigate in your 3D CAD softw

null 255 Jan 1, 2023
In this project ı'am trying to implement dijkstra algorithm with adjacency list representation.

AirportCheapestPath In this project, I have tried to make a flight advisor program to the 3rd party users. To do that, This program gets the data of a

Deniz TURK 11 Nov 7, 2022
This is a template project showing how to implement an application protocol on top of the MetaProtocol.

Manage any protocols in Istio service meshes with MetaProtocol and Aeraki! meta-protocol-awesomerpc This is a template project showing how to implemen

Aeraki 5 Dec 29, 2022