4. Programming the Chip Using the MOSBiusTools#

We currently provide two tools to generate bitstream files that you can use to program the switch matrix on the MOSbius chip. The tools are available from Github and as a python package.

  • The Github repository contains python modules and command-line scripts to interface with the Mobius chip.

  • A python package is available from TestPyPI as MOSbiusTools

    • we advise to create a virtual environment to install the tools

    • install using pip3 install -i https://test.pypi.org/simple MOSbiusTools

    • installs the MOSbiusTools module and two executable scripts described below.

4.1. Executable Scripts#

After installing the package the scripts should be executable from your command line.

4.1.1. connections_to_bitstream#

  • connections_to_bitstream converts a connections.json file into a bitstream to program the MOSbius chip.

  • run connections_to_bitstream -h and you get a brief description of script usage.

  • There is a blank connections.json file provided and some examples.

4.1.2. cir_to_connections#

  • cir_to_connections converts an LTSpice netlist (.cir) into a connections.json file that the connections_to_bitstream script can convert into a bitstream file.

  • Run cir_to_connections -h and you get a brief description of script usage.

  • There are some example .cir files provided in examples.

4.2. Basic Steps to Create Bitstream Files#

4.2.1. From LTspice Schematic#

  • create an LTspice schematic using the LTspice Library

  • save your design as a .cir file, e.g. my_circuit.cir. You obtain a .cir netlist for your LTSpice circuit by right clicking on the schematic, then ‘View SPICE Netlist’, then ‘Save As’.

  • create a connections.json file:

    • cir_to_connections -i my_circuit.cir -o connections_my_circuit.json -d

    • the -d is not required but will provide some output to review the conversion process.

    • you can choose your own filename for the json file, but a .json is recommended.

  • convert the connections_my_circuit.json to a bitstream file with connections_to_bitstream – see next topic.

4.2.2. From Connections Json File#

  • prepare connections file:

    • You can create a connections file in your text editor by starting from connections.json; for each BUS list the pcb pin numbers that need to be connected to it (OTA example); let’s assume you save it as connections_my_circuit.json.

    • Or, you can use the cir_to_connections script described above.

  • convert connections file to bitstream files:

    • connections_to_bitstream -i connections_my_circuit.json -o my_circuit_bitstream.txt -d

    • -d is not required but will provide output so you can review the conversion.

    • you can choose your own filename for the output file, but a .txt extension is recommended; besides my_circuit_bitstream.txt, my_circuit_bitstream_clk.txt will also be generated.

    • the bitstream files can be used with the ADALM2000 to generate the digital programming waveforms (CLK and DATA).

4.3. Example of Programming a Three-Stage Ring Oscillator#

4.3.1. Starting from LTspice Schematic#

We build the 3-stage 16-16-8 ring-oscillator circuit schematic in LTspice using the MOSbius library. It uses the two 16x inverter stages and creates an 8x inverter stage by combining the pairs of 4x nMOS and pMOS transistors; we use BUS9 for VSS and BUS10 for VDD. 3stage_RO_8x_schematic

We save the netlist of the circuit as a .cir file by right clicking on the schematic, then View Spice Netlist, and File Save as.

Next, we translate the schematic cir file to connections json file (see instructions above):

> cir_to_connections -i 3stage_RO_8x_vdd_10_vss_9.cir -o connections_3stage_RO_8x_vdd_10_vss_9.json`

Continue on with the next step.

4.3.2. Starting from a Connections File#

We can generate the connections json file from a schematic or create it manually in a text editor.

Then we translate it into a bitstream and clock file:

> connections_to_bitstream -i connections_3stage_RO_8x_vdd_10_vss_9.json -o 3stage_RO_8x_vdd_10_vss_9.txt 

4.3.3. Uploading the Bitstream File into the MOSbius Chip#

The chip is connected to the ADALM2000 as shown here: 3stage_RO_ready_for_programming

DIO channels 8 and 9[1] are wired to the CK and DT headers respectively at the top of the PCB that are the inputs of the digital level converters. Jumpers are placed on the DATA and CLK headers on the top left to connect the level-converted digital signals to the MOSbius chip. In this example, we are using a manual EN1. A jumper is placed on the bottom header on the top left of the PCB. The EMU_PUis left open for now (short jumper cable is dangling in the air in the photo). Please review the PCB description.

../_images/jumpers.gif

Fig. 4.1 Location of the digital signal connections and jumpers.#

We configure the Pattern Generator function of the ADALM2000 to have two digital output channels: DIO 8 and 9 and upload the clock and the bitstream file to channel 8 and 9 respectively as shown below. The frequency for the clock waveform has to be twice the frequency for the bitstream waveform; we typically use 200kHz for the frequency for CLK and 100kHz for the frequency for DATA.

../_images/pattern_generator_screenshot.png

Fig. 4.2 Screenshot of the Pattern Generator screen of Scopy controlling the ADALM2000 after the bitstream and clock file have been read in for channels 9 and 8 respectively.#

../_images/pattern_generator_screenshot_zoom.png

Fig. 4.3 Zoom in on the digital waveforms showing the alignment between the data and clock waveforms.#

During programming the EN needs to be LOW; we leave it floating so the internal pull-down will hold it LOW; and we also disconnect the 1+ and 2+ scope inputs, or any other connections from the ADALM2000.

We turn on the 2.5V power supply for the MOSbius chip (the red LED on the PCB turns on) and then upload the bitstream into the MOSbius chip using the Single (Run) function. If you look closely you see the data/clock LEDs on the PCB flicker briefly.

4.3.4. Enabling the MOSbius Chip#

3stage_RO_ready_for_programming

We now enable the connection matrix by asserting the EN signal by shorting the EMU_PU jumper connection[2]. Notice that the red LED shows that the chip is powered and the orange LED shows the switch matrix is enabled.

The measurements are further described here.