Getting Started With Rpi Pico
Getting Started With Rpi Pico
The Raspberry Pi Pico series is a range of tiny, fast, and versatile boards
built using RP2040, the flagship microcontroller chip designed by
Raspberry Pi in the UK.
• Dual-core Arm Cortex M0+ processor, flexible clock running up to
133 MHz
• 264kB of SRAM, and 2MB of on-board flash memory
• USB 1.1 with device and host support
• Low-power sleep and dormant modes
• Drag-and-drop programming using mass storage over USB
• 26 × multi-function GPIO(General Purpose input-output) pins
• 2 × SPI(Serial Peripheral Interface),
• 2 × I2C(inter integragted Circuits),
• 2 × UART(Universal Asynchronous Receiver/Transmitter),
• 3 × 12-bit ADC, 16 × controllable PWM channels
• 8 × Programmable I/O (PIO) state machines for custom peripheral
support
We can directly install Rpi pico sdk and required configurations using one
click installer
Download link
Or
We should Manually download and configure the each component
separately
Following are the component that needed to be configured separately, if
One Click Installer is not working.
• Arm GNU Toolchain
• CMake
• Ninja
• Python 3.9
• Git for Windows
• Visual Studio Code
• OpenOCD
For setting up manually you can either refer above reference document or
this link
Visual studio code
Step -1
After Done with the above setup. Start Vscode , In your Start Menu, search
for the *Pico - Visual Studio Code* shortcut. The shortcut sets up the
needed environment variables and then launches Visual Studio Code.
Note
If you have previously had Visual Studio Code installed, we often see
problems due to random settings inserted by other extensions, or by the
user, in an existing installation. If this is the case for you, please go to the
Pico Installer Wiki for a checklist of known issues and solutions.
Step - 2
Now Open the examples of Rpi Pico Repository ,The first time you launch
Visual Studio Code using the Start Menu shortcut, it will directly open the
following repository
GitHub - raspberrypi/pico-examples
Inorder to reopen the examples repository later you can follow this
location
(default)`C:\Users\\Documents\Pico-\pico-examples`.
Creating a New Project
5. Create a file “Main.c” in the “Blink” project and paste following code :
#include "pico/stdlib.h"
#include <sys/types.h>
int main() {
const uint LED_PIN = 25;
//const uint LED_PIN = PICO_DEFAULT_LED_PIN;
gpio_init(LED_PIN);
gpio_set_dir(LED_PIN, GPIO_OUT);
while (true) {
gpio_put(LED_PIN, 1);
sleep_ms(200);
gpio_put(LED_PIN, 0);
sleep_ms(200);
gpio_put(LED_PIN, 1);
sleep_ms(500);
gpio_put(LED_PIN, 0);
sleep_ms(500);
}
}
The setup and creating process for Rpi pico w is same as above but we
need to include wifi module of rpi pico i.e. “pico_cyw43_arch_none”. The
pico_cyw43_arch_none is a component in the Raspberry Pi Pico SDK that
specifically relates to the use of the CYW43 wireless module on the
Raspberry Pi Pico W. The Raspberry Pi Pico W uses the CYW43439
wireless chip, which provides Wi-Fi and Bluetooth functionality.
1. Follow the process of creating New project similar like Rpi pico in
step4 copy the CMakeLists.txt content below
# Set minimum required version of Cmake
cmake_minimum_required(VERSION 3.12)
2. Create a file “Main.c” in the “Blink” project and paste following code :
#include "pico/stdlib.h"
#include "pico/cyw43_arch.h"
int main() {
stdio_init_all();
if (cyw43_arch_init()) {
printf("Wi-Fi init failed");
return -1;
}
while (true) {
cyw43_arch_gpio_put(CYW43_WL_GPIO_LED_PIN, 1);
sleep_ms(250);
cyw43_arch_gpio_put(CYW43_WL_GPIO_LED_PIN, 0);
sleep_ms(250);
cyw43_arch_gpio_put(CYW43_WL_GPIO_LED_PIN, 1);
sleep_ms(500);
cyw43_arch_gpio_put(CYW43_WL_GPIO_LED_PIN, 0);
sleep_ms(500);
}
}