122 lines
4.7 KiB
Markdown
122 lines
4.7 KiB
Markdown
# Picoco
|
|
|
|
A repository to store Rasbperry Pico C sample projects.
|
|
|
|
It uses the **Freenove Super Starter Kit For Raspberry Pi Pico**, the tutorial and ressources can be found [here](https://github.com/Freenove/Freenove_Super_Starter_Kit_for_Raspberry_Pi_Pico).
|
|
|
|
The official documentation to start with the Raspberry Pi Pico: [Getting started with Raspberry Pi Pico-series](https://datasheets.raspberrypi.com/pico/getting-started-with-pico.pdf) and the [C SDK documentation](https://datasheets.raspberrypi.com/pico/raspberry-pi-pico-c-sdk.pdf). Some examples can be found here: [github.com/raspberrypi/pico-examples](https://github.com/raspberrypi/pico-examples).
|
|
|
|
**NOTE**: the configuration defined in `config/FreeRTOSConfig.h` is specific for the **Raspberry Pi Pico 2 RP2350**. Feel free to update it for your Pico spec.
|
|
|
|
The FreeRTOS documentation can found here: [FreeRTOS book](https://freertos.org/Documentation/02-Kernel/07-Books-and-manual/01-RTOS_book).
|
|
|
|
## Installation
|
|
|
|
In order to build and deploy the binary in the Raspberry Pi Pico, you have to install the **Pico C SDK**, **Picotool** & **FreeRTOS Raspberry Kernel**.
|
|
|
|
So, you need to execute the following command that will installed all:
|
|
```bash
|
|
make install
|
|
```
|
|
|
|
**NOTE**: this will install the **SDK**, **Picotool** and **FreeRTOS** in the current directory. If you want to set an other intallation path,
|
|
set the `INSTALL_PATH` variable. The `INSTALL_PATH` directory must exists, create it before and make sure user have write rights.
|
|
|
|
The **SDK** and **Picotool** version used is: **2.1.0**.
|
|
|
|
## Generate a project
|
|
|
|
You can generate a new Pico C project with the command:
|
|
```
|
|
make project name=<project_name>
|
|
```
|
|
|
|
It will create a new project in the current directory and build it.
|
|
|
|
## Compile
|
|
|
|
Update you `main.c` file and then launch:
|
|
```
|
|
make compile name=<project_name>
|
|
```
|
|
|
|
It will generate the `.elf` file in the `build` directory.
|
|
|
|
## Load binary into the device
|
|
|
|
You can combine both **compilation** and **load** with the following command:
|
|
```bash
|
|
make push name=<project_name>
|
|
```
|
|
|
|
**NOTE**: you have to USB plug your Pico device in **BOOTSEL** mode before executing the command.
|
|
|
|
After the load, the device will automatically reboot and be unpluged. And the program freshly pushed will start.
|
|
|
|
## Available projects
|
|
* [simple_led](simple_led): A little program with a single LED + a button. You can push the button 10+ times, after the LED lights off. You can reset the application by pressing the button ~2 secs. It used FreeRTOS engine on two cores.
|
|
* [bit_counter](bit_counter): Nothing extraordinary, just a bit counter wit a LED bar.
|
|
* [breathing_led](breathing_led): Plays with PWM on a LED bar to lights on LED in funny way (meteor, waves, etc...).
|
|
* [buzzer](buzzer): Actually this is not a buzzer... It just an alarm using a passive buzzer that you can run/stop by pushing the button. It used FreeRTOS engine on two cores.
|
|
|
|
## Get device info
|
|
When plugging your device in **BOOTSEL** mode, you can get the device information using:
|
|
```bash
|
|
make info
|
|
|
|
Program Information
|
|
name: simple_led
|
|
version: 0.1
|
|
binary start: 0x10000000
|
|
binary end: 0x10001744
|
|
target chip: RP2350
|
|
image type: ARM Secure
|
|
|
|
Fixed Pin Information
|
|
none
|
|
|
|
Build Information
|
|
sdk version: 2.1.0
|
|
pico_board: pico2
|
|
boot2_name: boot2_w25q080
|
|
build date: Feb 18 2025
|
|
build attributes: Release
|
|
|
|
Metadata Block 1
|
|
address: 0x10000138
|
|
next block address: 0x10001730
|
|
block type: image def
|
|
target chip: RP2350
|
|
image type: ARM Secure
|
|
```
|
|
|
|
## Show program outputs via USB serial mode
|
|
In order to show logs from your program running on the microcontroller, you have to integrate [TinyUSB](https://github.com/raspberrypi/tinyusb/tree/pico) in the Pico C SDK.
|
|
|
|
### Installation
|
|
To do it, simply launch the following command:
|
|
```bash
|
|
./scripts/install_tiny_usb.bash <version>
|
|
# for the 0.17.0 version
|
|
./scripts/install_tiny_usb.bash 0.17.0
|
|
```
|
|
|
|
It will download TinyUSB sources and create a symbolic link in the Pico C SDK for integration at compilation.
|
|
|
|
**NOTE**: If the SDK is located in specific directory, set the **INSTALL_PATH** variable pointing to the directory of the SDK before to launch the script.
|
|
|
|
### Display output on terminal
|
|
Recompile and push your program on the microcontroller. Then to display the program outputs, you have to use `minicom`.
|
|
|
|
```bash
|
|
sudo apt install minicom
|
|
```
|
|
|
|
**NOTE**: if you have the habit to use another tool then, use it !
|
|
|
|
After the installation, the microcontroller plug into the USB port, you can launch the command to visualize the program outputs:
|
|
|
|
```bash
|
|
sudo minicom -b 115200 -o -D /dev/ttyACM0
|
|
```
|