Form a team and register your time slots before 2.10
Lab Exercise¶
Learning Objectives: In this exercise, you will become familiar with the programming environment for the hardware we are using in the course. The exercise also teaches how to create tasks and communicate with various devices using the provided device.
After the exercise, you will be able to create programs for your device using the provided IDE, debug these programs, flash and run them on the device, and use different peripheral components/devices:
- Use buttons and LEDs with using the device
GPIO. - Read data from a sensor using the
i2cprotocol. - Implement a simple state machine to synchronize sensor data reading and transmission.
- Communicate with simple messages in the development environment's terminal window.
Implementation
The lab exercise is divided into two sessions. You must attend to exactly one slot for each one of the two sessions. Attendance is mandatory, and all team members must attend at the same time.
Schedule can be found in the schedule and deadlines section in Lovelace
Preparations¶
Before 2.10, you must form a team and register for different time slots.
Before starting the exercise, the exercises of Module one have to be completed. The exercise largely involves copy & paste from lecture materials and your own C language exercises. In addition students must have STUDY sections 1 to 8 (MODULE 2) in Lovelace. Without a good understanding of these chapters is IMPOSSIBLE to follow the exercise.
Step 0: Create a group and book your time.¶
Form and register teams of 2-3 students.
Step 1: Review the lecture material¶
The lab exercise is designed for learning device programming, so students should have an understanding of C language before starting the exercise.
To ensure smooth progress, it is mandtory to go through the following lecture chapters independently before the exercise:
- Lecture Chapter 1 : Embedded Real Time Operating Systems
- How to program with the Raspberry Pi Pico using FreeRTOS.
- Lecture Chapter 2 : Implementation of FreeRTOS program
- Creating tasks. Task life-cycle
- Lecture Chapter 3: Input / Output
- How to initialize and use buttons and LEDs in the program
- How to use PWM
- Lecture Chapter 4: Interrupts
- How to write an interrupt handler for a pin?
- How to create a timer?
- Lecture Chapter 5: Serial Communication
- How to send the stdio to computers using serial communcation
- How to send data using the USB.
- How to compose an I2C transation? How to read and write data from peripherals devices?
- Lecture Chapter 7: State Machines
- How to use a state variable between tasks?
- Lecture Chapter 8: Peripherals
- How to interpret sensor data from registers?
- How to look for help?
Step 2 - Installing the Development Environment¶
All required development environment is installed in a virtual machine, and it is accessible through all university computers. This is the option recommended by the course staff. You can also install the development environment on your own computer. In this case, the SensorTag development environment can be set up in two ways:
- All the required software is pre-installed on a virtual machine. This also requires installing a virtual machine runtime environment. It is compatible with both Windows and Linux (not Mac). This is the option recommended by the course staff.
We will not offer specifc instructions for each one of the OS. Instead, we will point students to the official Raspberry Pi Pico documentation. We will include some additional configuration tips, for some OS, but should be clear that we are not providing any additional set-up or configuration guidelines apart from official documentation. We are supporting Virtual Machines for that purpose.
Option 1: Virtual Machine¶
The recommended option is to bring the course’s virtual machine to your own computer. The virtual machine comes with all neccessary software installed
The package size is 15GB, so downloading it will take some time. When copied from the workstation, the virtual machine fits on a 16GB USB stick / Google Drive, etc.
NOTE for MAC users with M1 and M2 chips: Unfortunately, VirtualBox is not supported on this platform, so you cannot use your computer for SensorTag programming.
The virtual machine image file can be downloaded here.
For instructions on installing and setting up the VirtualBox environment, you can check the instructions here.
Option 2: Installing in your own computer¶
You can follow instructions in official raspberrypi documentation how to install the Raspberry Pi C SDK environment.
In addition, you would need to install FreeRTOS. This page offers a nice tutorial.
Notes for Linux users¶
TBD
Notes for Windows users¶
TBD
Give feedback on this content
Comments about this material