Week6. Embedded programming Group assignment¶
- Browse through the datasheet for your microcontroller
- Compare the performance and development workflows for other architectures
- Document your work to the group work page and reflect on your individual page what you learned
RP2040 data sheet¶
For our electronics production week, we used seed studio XIAO-RP2040. This datasheet has more that 600 pages so I started by going thought the content and found this page where it said: ** Why is the Chip Called RP2040?**
- 2 is because it has mainly 2 processor core
- 0 chip uses ARM Cortex-M0+
- 4 The “floor(log2(ram / 16k))” calculation gives a number that represents how much RAM the chip has, measured in increments of 16 kilobytes (16k).
- 0 no onboard nonvolatile/ flash memory storage
RP2040 is 7.75 mm by 5.40 mm in width and length but if you want to know more in details a footprint is also given in the datasheet.
image source
Here is the summary for the RP2040 taken from the datasheet.
• Dual Cortex M0+ processor cores, up to 133 MHz
• 264 kB of embedded SRAM in 6 banks
• 30 multifunction GPIO
• 6 dedicated IO for SPI Flash (supporting XIP)
• Dedicated hardware for commonly used peripherals
• Programmable IO for extended peripheral support
• 4 channel ADC with internal temperature sensor, 0.5 MSa/s, 12 bit conversion
Some of finding of the chip:
-
Case temperature which the chip can handle for normal oprtation, Minimum:-20C and Maximum: 85C
-
The RP2040 includes a wide range of built-in peripherals, including UART, SPI, I2C, PWM, and ADC. These peripherals enable communication with external devices, sensor interfacing, motor control, and analog signal acquisition.
-
RP2040 also has interupt functionality using RTC (real time clock).
-
It is 16kB ROM, 264kB of on-chip SRAM in 6 banks and 16kb for flash and 4kb for USB which increased the SRAM to 284kb if they are not used.
-
Digital Input/Output can be powered at a normal voltage of 1.8v- 3.3v.
-
There are 4 dual Analog and digital pins in Rp2040.
Comparision between different boards¶
All the boards has been programmed used ArduinoIDE.
To use Arduino IDE for any new board other than arduino we need to download the board using the board manager.
Step1: Go to file-> preferences Step2: Paste the url to the board as shown below.
Step3: Go to tools-> Boards and click on Boards manager to download the boards. Step4: The Board will appear under boards.
Xiao-RP2040¶
The board used on quentores xiao-RP2040 makes use of only few of the pins and allows all the other functionalities of the chip. It allows UART, I2C and also SPI serial communication. It also enables JTAG insystem development.
image source
In the electroncs boards week, we had milled this board and programed a blink code which worked. The board manager package was added using the URL: https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json
And a simple blink code was uploaded after selceting the board which was installed using the board manager. There are two LEDs and we decied to use the one attched to pin 26 of RP2040.
Arduion UNO¶
Arduino is name of a company that makes ardunio Boards. There are different types of arduino boards but we decided to arduino Uno. This is a microcontroller board that used Atmega328P as its mircocontroller. This microcontroller follow Havard archetecture whcih means that it has seperate flash memory and SRAM.
Some important points on Atmege328P that I got from chatgpt are : - Its CPU is 8bit AVR microcontroller - operates at 16MHZ but can run at low speed. - Flash Memory: 32 KB, SRAM: 2 KB, EEPROM: 1 KB for non-volatile. - 23 digital I/O pins, 6 analoug pins - It allows, UART, SPI and I2C communication. - Typically operated at 5V
Picture below shows the selcetion of the boards and port.
This is the code we used. We did a simple fading of LED experimant.
pinMode(bled, OUTPUT);
}
void loop() {
// LED brightness from min to max
//pass value from 0 to 255 to pin 5
for(int i=0;i<255;i++)
{
analogWrite(bled,i);
delay(10);
}
//LED brightness from max to min
// pass values from 255 to 0 to pin 5
for(int j=255;j>0;j--)
{
analogWrite(bled,j);
delay(10);
}
}
ESP-32¶
ESP 32 is widly used for IoT applications and it is a boards developed by Espressif Syatem. This chip too uses Havard Archetecture.
Some of the features of this chip that I got from chatGPT:
-
Dual-core Xtensa LX6 microprocessor, each core running at up to 240 MHz.
-
Up to 16 MB of external SPI flash memory for storing program instructions and firmware and Up to 520 KB of internal SRAM for data storage and execution.
3.Supports IEEE 802.11 b/g/n (2.4 GHz) and Bluetooth v4.2 and BLE (Bluetooth Low Energy). Also has dual-mode Bluetooth with Classic Bluetooth (BR/EDR) and BLE support.
-
34 programmable GPIO pins for digital input/output and 18 Analog input.
-
UART, SPI, I2C: Standard communication interfaces for connecting to peripherals and external devices. And Controlled Area Network(CAN) bus communication.
-
Typically operates at 3.3V
For ESP 32, we firsltly installed the board by adding the board uing the URL:https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json and installed from the board manager.
We need to select a programmer called esptool programming the board using Arduino IDE.
/*
ESP32 Blink by DroneBot Workshop 2020
*/
// LED on GPIO2
int ledPin = 2;
void setup() {
// set LED as output
pinMode(ledPin, OUTPUT);
// Serial monitor setup
Serial.begin(115200);
}
void loop() {
Serial.print("Hello");
digitalWrite(ledPin, HIGH);
delay(500);
Serial.println("world!");
digitalWrite(ledPin, LOW);
delay(500);
}
Von Nueman Archetecture
Computer architecture design in which both program instructions and data are stored in the same memory space. It is characterized by a single bus used for both instruction fetches and data accesses. This architecture was proposed by mathematician and physicist John von Neumann in the late 1940s and has since become one of the most widely used architectures in modern computers. It is less common in microcontrollers.