Week 3

Things I did this week:

  1. browse through the data sheet for your microcontroller
  2. write program for a microcontroller development board
  3. compare the performance and development workflows for other architectures

browse through the data sheet for your microcontroller

Listing out things that I went through

  1. Naming (Why RP2040):
    • RP: Raspberry Pi
    • Number of processor cores (2)
    • Loosely which type of processor (M0+)
    • floor(log2(ram / 16k))
    • floor(log2(nonvolatile / 16k)) or 0 if no onboard nonvolatile storage
  2. There's a pinout reference, but we only have access to a few of them using the Seeed XIAO RP2040 microcontroller.
  3. Size of SRAM: 264kB.
  4. Chip-level reset: can reset the whole chip, except the debug port, or only reset the Rescure DP(Debug Port).
  5. RP2040 has several clock generators, such as system clock that is almost always running and peripheral clock.
  6. PIO instructions are 16 bits long, and first three bits distinguishes the instruction.
  7. Peripherals:
    • USB: there's a graph showing loewlevel USB traces of how packets are sent to transfer data.
      Useful link: https://www.usbmadesimple.co.uk/
    • The UART performs:
      • Serial-to-parallel conversion on data received from a peripheral device
      • Parallel-to-serial conversion on data transmitted to the peripheral device
    • Pulse width modulation (PWM) is a scheme where a digital signal provides a smoothly varying average voltage.
    • The system timer peripheral on RP2040 provides a global microsecond timebase for the system, and generates interrupts based on this timebase.
    • The watchdog is a countdown timer that can restart parts of the chip if it reaches zero. This can be used to restart the processor if software gets stuck in an infinite loop. The programmer must periodically write a value to the watchdog to stop it from reaching zero. (interesting? design)
    • The Real-time Clock (RTC) provides time in human-readable format and can be used to generate interrupts at specific times.
    • ADC (analog-digital converter) and temperature sensor
      • The on board temperature sensor is very sensitive to errors in the reference voltage.
BACK TO TOP

write program for a microcontroller development board

We learned how to solder during the lab. And I soldered pin headers to my microcontroller.

With help from Clair, I was able to set up the Arduino IDE with the seeed XIAO RP2040 microcontroller. I then go on and tried some sample code.

1. Rainbow

I refered to this website since I want to use the Nexopixel RGB LED, and control the color of it.
I simply search for RGB of the rainbow and used that color in the code.

2. CAT!!

I wrote a simple code so that the controller can talk back to my computer.
I blinked the builtin LED green just for an indication of the program running.

3. Communication

I used the example provided on the class website to communicate with the microcomtroller with my computer.
The code does the following: if receiving chars, the LED blink pink purple pink purple pink, but when reach the end of a sentence (i.e.'\n'), the LED blink red blue red blue red.

4. Button

I followed the official tutorial on how to use a button to control an LED light.
I modified the code so that the LED blinks when the button is not pushed and stops blinking when the button is pushed.
One thing that I found convenient was that instead of using the pin number, we could use the letter+number on the pinout.

BACK TO TOP

compare the performance and development workflows for other architectures

My main development was done in Arduino IDE with C++. I used this website as a reference to set up Thonny with the Seeed XIAO RO2040 chip. The whole process was pretty straight forward and easy to use. Since I have software engineering background. Both languages (Python and C++) are very easy to me, for now I think I will stick with Arduino IDE.

The above is a classic Von Neumann architecure, it simply consists of main memory, a processor and an interconnect between memory and the processor. Its bottleneck is the separation of processor and memory.

The Harvard architecture is a computer architecture with separate storage and signal pathways for instructions and data. The main difference between the Harvard architecture and Von Neumann architecture is that in Harvard architecture program instructions and data share the same memory and pathways.
Advantages: Faster access to both data and instructions, making it well-suited for embedded systems and real-time applications.
Used often in microcontrollers.

The Field Programmable Gate Array (FPGA) is an integrated circuit that consists of internal hardware blocks with user-programmable interconnects to customize operation for a specific application. A basic FPGA architecture (Figure 1) consists of thousands of fundamental elements called configurable logic blocks (CLBs) surrounded by a system of programmable interconnects, called a fabric, that routes signals between CLBs. Input/output (I/O) blocks interface between the FPGA and external devices.
Advantages: Highly parallel and customizable, making it suitable for applications like digital signal processing, hardware acceleration, and prototyping custom hardware.

PIO (Programmable Input/Output) is a mechanism for controlling input and output operations directly at the hardware level, without the need for a CPU to manage them.
Advantages: Low-latency I/O operations, useful for tasks like interfacing with sensors, LEDs, and other peripherals.

GPU (Graphics Processing Unit)are specialized processors designed primarily for rendering graphics but are highly parallel and capable of performing a wide range of general-purpose computations.
Advantages: Exceptional parallel computing power, ideal for tasks like 3D graphics rendering, scientific simulations, and machine learning.

BACK TO TOP