Week 7 Data'n'chips

Group members

Week 7 Data'n'chips

Ring oscillator

To test the ring oscillartor with multiple different chips, we wrote this code:

#define READ_PIN 5
#define WRITE_PIN 6


void setup() {
  pinMode(READ_PIN, INPUT);
  pinMode(WRITE_PIN, OUTPUT);
}

void loop() {
  while (1) {
    digitalWrite(WRITE_PIN, !digitalRead(READ_PIN));
  }
}

The purpose of the code is to read data from a pin, and write it to a different pin. The pins are connected together with a wire, so basically everything written to the WRITE_PIN is almost immediately read from the READ_PIN.

The whole thing was put into a endless while loop to mitigate any effects code provided by the Arduino library or the chip. There quite likely are some additional calls made by the chip during each tick, before loop() is called.

Below is a table that lists the chips, boards and the results from our tests.

Board Chip Language Clock speed Oscillator Architecture
Arduino nano ATMega328P Arduino (C) 16 mKz 96 kHz AVR
Arduino nano every ATMega4809 Arcuino (C) 20 mHz 114 kHz AVR
Arduino micro ATMega32u4 Arduino (C)  16 mHz 96 kHz AVR
Seeed XIAO-RP2040 Arduino (C) 133 mhZ 648 kHz ARM
Seeed XIAO-RP2040 CircuitPython 133 mHz 43 kHz ARM
Seeed ESP32-C3 Arduino (C) 160 mHz 772 kHz RISC-V
Espressif ESP32 Arduino (C) 240 mHz 934 kHz Xtensa

We used an oscilloscope to measure the hertz from the oscillator. We connected the read and write pins together, attach a oscilloscope to somewhere between them, and also attach the oscilloscope ground to the ground pin of the board. Adter that we just autoset the oscilloscope and read the hertz value.

Sometimes we had problems with the pins, sometimes it was about differently named pins on the board and on the chip, and sometimes it was ust me being stupid and attaching the wrong pins.

Once we needed to write a code that automatically oscillated the output (i.e. without a input pin), to figure out which pins were which.

Circuit python

To download the circuit python we used the following link: https://circuitpython.org/board/seeeduino_xiao_rp2040/

After downloading it. We inserted the circuit while pressing B (for boot) button on the board while connecting it. Now we could see it as an external USB device. Then copy the downloaded file and paste it inside the appeared folder and the circuit name changed. https://codewith.mu/en/download

The we could just run the python script on the device by dropping code.py file into the USB device.

Data sheets

Reasons to read data sheets:

  • Board is different from the chip
  • Chip has more pins than the board
  • The boards and chips have differently numbered pins
  • Boards and chips may have additional functionality
  • They tell you tolerances so that you do not brick your chip

Data sheets have

  • Architecture
  • Clock speed
  • Pinout
  • The chip used
  • Built-in structures of the board
  • Sometimes in Chinese
  • Nerdy details

Seeed XIAO data sheet had these interesting things in it:

  • Legal texts
  • Pin layout and description of each pin
  • Power requirements and capabilities
  • Descriptions of features
  • Loads of relevant information, if weird problems come up, like priorities and bandwidth.