Annual: 2018

EM099 »
Bus Spider: flexible open source hacker multi-tool
📁Digital Design
👤Antony Pavlov
 (National Research University of Electronic Technology (MIET))
📅May 30, 2018
Semifinalist


👀 7745   💬 20

EM099 » Bus Spider: flexible open source hacker multi-tool

Description

We intend to develop Bus Spider — a better tool for DIY and hacking projects that involve serial communications.
Bus Spider is inspired and heavily influenced by Bus Pirate (http://dangerousprototypes.com/docs/Bus_Pirate).
We design Bus Spider in a way that will extend functionality and solve issues of original Bus Pirate.

Demo Video

  • URL: https://youtu.be/NS2imnwlUNk

  • Project Proposal

    1. High-level Project Description

    GitHub Repository

    https://github.com/miet-riscv-workgroup/de10-nano-bus-spider

    Introduction

    Different sensors and controllers are used during development of electronics. In most cases these controllers use serial interfaces (UART, SPI, I2C) for communication. It is useful to test them sending commands and analyzing results. However, in most cases PC does not have corresponding interfaces.

    The well-known Bus Pirate v3 device developed by Dangerous Prototypes resolves this issue. It's a cheap and universal device. It can be connected to regular PC via USB and provides ability to use several most common serial interfaces. Communication with Bus Pirate is performed through serial console.

    Unfortunately, Bus Pirate v3 has several issues:

    •  low throughput (approximately 10 KB/s);
    •  interfaces are multiplexed (only one can be used at the same time);
    •  exit from UART-USB bridge mode requires resetting the device.

    These issues are caused by the limited specs of PIC24FJ64GA002 16-bit Microchip microcontroller used in Bus Pirate v3.

    There is Bus Pirate v4. It has better throughput than Bus Pirate v3. Alas, it seems that Dangerous Prototypes abandoned Bus Pirate v4 firmware development and it never reached stable state.

    Bus Spider

    This project proposes to create Bus Spider — a superior device based on the FPGA board.
    We are using FPGA to implements a SoC with RISC-V compatible core PicoRV32. The SoC is being developed in MIET. Embedded software rewritten from scratch will provide the same well-approved serial console interface as the Bus Pirate's.

    In our project we will consider the experience of the Bus Pirate creators trying to preserve usability of original device. We plan to add hardware JTAG controller and a logical analyzer in the future.

    Features

    1. Bus Spider provides network features for remote development;
    2. Bus Spider partially preserves mature Bus Pirate protocol;
    3. Bus Spider is expandable: user can add specific interface if necessary.

    Inspired by open software

    We are inspired by open software development workflow and principles. Bus Spider is developed in way we find as close to modern open software development as possible. We hope that Bus Spider project can inspire others to perform open hardware development in manageble and maintainable way.

    Prototype

    The first prototype of the Bus Spider was based on FT2232 breakout board and CoreEP4CE6 (see Fig.1 and Fig.2). With this prototype we were able to evaluate our sketch design.

    Fig.1

    Fig.1

    Fig.2

    2. Block Diagram

    Bus Spider contains two subsystems: Linux subsystem to implement network features and microcontroller subsystem to implement interface controllers and protocol. This division allows to run Linux on HPS with better performance and at the same time isolate and encapsulate interface related hardware and software.

    User can connect to Bus Spider over network and perform various interactions with connected electronic devices. User can use I2C, UART, SPI and GPIO independently (see Fig.3).

    Fig.3

    Controlled device can be either «simple» or «complex» one. «Simple» devices are peripherials controlled by one of listed interfaces. «Complex» devices are processor boards with network capablities. In this case Bus Spider can be used as network server if connected electronic device need it (e.g. connected device is processor board). If you need additional ethernet then you can use VLAN-enabled switch (Fig. 4).

    Fig.4

    3. Intel FPGA Virtues in Your Project

    The Bus Spider is designed to use full potential of FPGA:

    1. Bus Spider has high level of system integration: Linux host and Bus Spider implemented in the same FPGA device; Linux is running on HPS for better performance.

    2. Using FPGA makes Bus Spider lifespan longer in comparision with controller based solutions. Both hardware and software can be updated on later development stages and in maintence period;

    3. Using FPGA makes Bus Spider expandable by end user. It is possible to add more functions appending existing IP cores including IP cores provided by Intel Quartus Prime design software;

    4. Using FPGA makes Bus Spider scalable. It is possible to increase number of interfaces or even number of Bus Spiders on the same FPGA device!

    4. Design Introduction

    Bus Spider has multiple parts: two subsystems, each with multiple IP-cores, linux bootloader, linux kernel and device tree, RISC-V bootloader, RISC-V software and more. To be able to maintain such project we decided to use git source control system. Every hardware and software component sources are stored in separate git repo. The main de10-nano-bus-spider git repo unites separated component repos with git submodule mechanism.

    To be able to maintain IP dependency and automate hardware project compilation we decided to use FuseSoC by Olof Kindgren. FuseSoC uses description files for IP-cores and produces project files for different CADs. FuseSoC also automates build and simulation of project. Please see the de10-nano-bus-spider-dev-flow.md page for our development workflow details.

    To be able to work on Bus Spider remotely we designed remote control device to be able to control power and communicate with DE10-Nano. We built it of off-the-shelf modules.

    We have not used any commercial IP-blocks so Bus Spider stays as close to completely open hardware as possible in the reality of modern FPGA development. Same goes for software tools – aside of Quartus every used software package is open source and free.

    5. Function Description

    The main function of the Bus Spider is to provide remotely accessed interface to serial communication controllers.

    To use Bus Spider you need to perform several steps:

    1. Set up the Bus Spider following instruction provided on GitHub (see README.md).
    2. Connect your electronic device to the Bus Spider (see DE10-Nano pinout).
    3. Connect to the Bus Spider via SSH. You will log in to Linux running on Altera HPS.
    4. Run serial communication software (e.g. minicom) on the serial port /dev/ttyAL1 to connect to the Bus Spider RISC-V SoC.
    5. Use the Bus Spider command line interface (CLI) to communicate with your electronic device. Bus Spider CLI is mostly compatible with Bus Pirate CLI.
    6. To communicate with your electronic device via UART you have to use dedicated UART /dev/ttyAL0 from Linux on Altera HPS.

    6. Performance Parameters

    Currently Bus Spider RISC-V SoC design has following characteristics:

    • Wishbone CLK = 24 MHz;
    • SRAM size = 32K;
    • BootROM size = 1K.

    Quartus Prime report data:

    • Logic utilization (in ALMs) = 2,257 / 41,910 ( 5 % ) ;
    • Total block memory bits = 272,640 / 5,662,720 ( 5 % ) ;
    • Fmax = 73.35 MHz.

    7. Design Architecture

    Bus Spider consists of two SoC subsystems – HPS with ARM® core and Bus Spider SoC based on PicoRV32 by Clifford Wolf (see Fig. 5). Such division allows to run Linux on more powerful core and keeps Bus Spider peripheral controller and firmware isolated, ready to use in another, different systems.

    Fig.5

    HPS with running Linux handles network connections and provide wide range of high level functions and services to user. HPS communicates with Bus Spider SoC via UART and GPIO controllers which are implemented in FPGA logic and are accessible by HPS through HPS-to-FPGA bridge (see Fig. 6). GPIO is used to provide hard reset for Bus Spider SoC.

    Fig. 6

    Linux host controls Bus Spider SoC over UART interface using Bus Pirate user interactive protocol. Another UART controller of Linux host subsystem is directly connected to UEXT connector bypassing Bus Spider SoC. This provides fast link and keeps simplicity of software at the moment.

    Bus Spider SoC consists of PicoRV32 RISC-V compatible core, automatically generated wishbone switch, internal instructions/data memories, UART and GPIO controllers (Fig. 7). Currently GPIO controller is used to provide I2C and SPI interfaces in bit-bang mode. At the moment only user interactive mode is supported so there is no need for high speed communications. We plan to add hardware serial controllers after implementation of machine communication protocol.

    Fig. 7

    Bus Spider SoC memory map is shown in the following table:

    base top slave ip core
    0x0000_0000 0x0000_ffff bootrom wb_bootrom
    0x4000_0000 0x4000_ffff sram wb_ram
    0x9000_0000 0x0000_001f uart uart16550-1.5.4
    0x9100_0000 0x9100_0007 gpio0 wb_gpio
    0x9100_0100 0x9100_0107 gpio1 wb_gpio

    PicoRV32 RISC-V core is configured in RV32IMC mode (RV32I base ISA, extension M (integer multiply/divide instructions) and extension C (compressed instructions)).

    Icarus Verilog and GtkWave were used for Bus Spider RISC-V SoC simulation and debug (see Fig. 8).

    Fig. 8

    We have developed software emulator for Bus Spider RISC-V SoC on top of qemu to speed up RISC-V SoC firmware development.

    To simplify the connection of UEXT modules to DE10-Nano the special adapter board on base of prototype PCB was created (see Fig. 9).

    Fig. 9

     8. Conclusion 

    At the moment the Bus Spider demonstrates functions similar to ones provided by the Bus Pirate. The Bus Spider proves that using FPGA SoC for such device was definitly right idea and will allow us to avoid MCU based Bus Pirate limitations.

    The Bus Spider is not mature project. There is much more work to be done but through Innovate FPGA competition we were able to move from prototype to managable open source project and plan out our next steps. Now, when the Bus Spider project is up and running we are planning on gradually improve and extend it to get better performance, solid documentation and wider range of features.

     9. References 

    1. Dangerous Prototypes: Bus Pirate: http://dangerousprototypes.com/docs/Bus_Pirate
    2. Bus Spider Github main repo: https://github.com/miet-riscv-workgroup/de10-nano-bus-spider
    3. Bus Spider FuseSoC generated Quartus project: https://github.com/miet-riscv-workgroup/de10-nano-bus-spider-bld-quartus
    4. Bus Spider Project Video: https://www.youtube.com/watch?v=NS2imnwlUNk (there is also an old and long version of Project Video: https://www.youtube.com/watch?v=xk4pjrGDSXQ)
    5. FuseSoC by Olof Kindgren: https://github.com/olofk/fusesoc
    6. PicoRV32 by Clifford Wolf: https://github.com/cliffordwolf/picorv32
    7. Olimex UEXT board to board connector: https://www.olimex.com/Products/Modules/UEXT/


    20 Comments

    Pedro Miguel Baptista Machado
    The video is not in English and the authors cannot expect the reader to read the subtitles. The project is interesting and can be helpful when monitoring sensors communication. More details are required for the implementation (e.g. device planning diagram) and results (e.g. functional simulation, resources utilisation, etc.).
    🕒 May 28, 2018 10:35 AM
    EM099🗸
    Thank you for comments. We will update video with English voice-over asap.
    We also will think on a better way to present our project implementation. For additional info on implementation please see our GitHub repository https://github.com/miet-riscv-workgroup/de10-nano-bus-spider
    🕒 May 28, 2018 12:50 PM
    Pedro Miguel Baptista Machado
    Dear author,
    Some more suggestions for the video. (i) Instead of using words to describe use diagrams on the video. (ii) Reduce the size of the video to +/-4min. (iii) explain what is happening when demonstrating the application running.
    Thank you for pointing out the GitHub repository. You may also want to include some details in https://rocketboards.org/.
    🕒 May 28, 2018 12:59 PM
    EM099🗸
    Dear Pedro,
    Thank you for your suggestions!
    We have updated our project:

    1. New demo video is uploaded (https://youtu.be/NS2imnwlUNk); we have completely reworked the video according to your suggestions;

    2. We have added more materials to the Design Architecture section; we have pushed our SoC testbench into Bus Spider RISC-V SoC github repo (https://github.com/open-design/riscv-soc-cores/commit/fb16bc9eec9b38cddb22556bb07f2624e02d4fd9).

    Best regards,
    EM099 team
    🕒 May 30, 2018 07:35 AM
    Pedro Miguel Baptista Machado
    Well done team. Looks much better now. I will reflect your effort in my marking.
    Bw
    PM
    🕒 May 30, 2018 08:44 AM
    Donald Bailey
    Such a tool is would be useful for debugging and development.
    🕒 Jan 25, 2018 09:06 PM
    EM099🗸
    Thank you for your opinion!
    🕒 Jan 25, 2018 09:45 PM
    Miguel Risco-Castillo
    This could be an interesting tool for digital development and debug. Keep working and good luck!
    🕒 Jan 23, 2018 03:19 PM
    EM099🗸
    Thanks a million!
    🕒 Jan 25, 2018 09:37 PM
    Yegor Yefremov
    Looks promising. Such device would be very useful for our hw development. Good luck!
    🕒 Jan 23, 2018 07:37 AM
    ZSerg
    Good project!
    🕒 Jan 22, 2018 07:48 PM
    Antony Pavlov
    Thanks!
    🕒 Jan 22, 2018 09:07 PM
    Tom Hangins
    Interested to see final result
    🕒 Jan 22, 2018 04:04 PM
    Antony Pavlov
    Thank you for your interest!

    Our preliminary results can be found on github:

    * Bus Spider RISC-V SoC sources: https://github.com/open-design/riscv-soc-cores
    * firmware for RISC-V SoC: https://github.com/frantony/bus-spider-firmware
    🕒 Jan 22, 2018 09:15 PM
    Bing Xia
    Interseting proposal, looking forward it.
    🕒 Jan 19, 2018 07:53 AM
    EM099🗸
    Thank you so much!
    🕒 Jan 22, 2018 10:50 PM
    berkay egerci
    keep going! good project and good luck !
    🕒 Jan 14, 2018 09:17 PM
    berkay egerci
    keep going! good project and good luck !
    🕒 Jan 13, 2018 10:00 AM
    kemal eddin ahmedzad
    best project
    🕒 Jan 12, 2018 01:20 PM
    MOHAMED
    Good Project. Keep moving.
    🕒 Jan 12, 2018 02:33 AM