0% found this document useful (0 votes)
132 views7 pages

Getting Started With Rpi Pico

The document provides a comprehensive guide on setting up and programming the Raspberry Pi Pico using the C/C++ SDK on Windows, detailing the hardware specifications and installation processes. It outlines both a one-click installer and manual configuration for necessary components, as well as step-by-step instructions for creating a new project in Visual Studio Code. Additionally, it includes specific instructions for programming the Raspberry Pi Pico W with Wi-Fi capabilities, highlighting differences in project setup for the two boards.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
132 views7 pages

Getting Started With Rpi Pico

The document provides a comprehensive guide on setting up and programming the Raspberry Pi Pico using the C/C++ SDK on Windows, detailing the hardware specifications and installation processes. It outlines both a one-click installer and manual configuration for necessary components, as well as step-by-step instructions for creating a new project in Visual Studio Code. Additionally, it includes specific instructions for programming the Raspberry Pi Pico W with Wi-Fi capabilities, highlighting differences in project setup for the two boards.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Getting Started with Rpi pico using C/C++ SDK on Windows

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

Overview - Buy a Raspberry Pi Pico – Raspberry Pi


Pinout configuration
Getting Started
Reference Documentation
Installation and setup

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

1. Make a project directory say “Blink”.


2. Copy “pico_sdk_import.cmake” from C:\Program Files\Raspberry
Pi\Pico SDK 1.5.1\pico-sdk\external or PICO_SDK_PATH\external\
into “Blink” folder.
3. Copy “.vscode” folder from C:\Users\\Documents\Pico-\pico examples
into “Blink” folder.
4. Create a file “CMakeLists.txt” into “Blink” and paste following content
in to the CMakeLists.txt
# Set minimum required version of CMake
cmake_minimum_required(VERSION 3.12)

#Include build functions for Pico SDK


include(pico_sdk_import.cmake)

#set name of project (as PROJECT NAME) and C/C++ standards


project(blink C CXX ASM)
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)

#create a pico-sdk subdirectory in our project for the libraries


pico_sdk_init()

#Tell CMake where to find the executable source file


add_executable(blink
main.c
)

#Create map/bin/hex/uf2 files


pico_add_extra_outputs(blink)

#Link to pico_stdlib (gpio, time, etc, functions)


target_link_libraries(blink
pico_stdlib
)
Note :
Becarefull about name of CMakeLists it is a case sensitive.

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);
}
}

6. Open “Pico – VS Code” from Start Menu(not VSCode directly) and


Goto->File->Open Folder->(Your Project{Blink}) folder.
7. If asked about selecting a kit, select “Pico ARM GCC”
8. Press Ctrl+Shift+P to open command pallete in VSCode, Type
CMake:Configure, let it complete. It’ll generate a build directory.
9. Press Ctrl+Shift+P to open command pallete in VSCode, Type
CMake:Build, this will generate map/bin/hex/uf2 files in build
directory.
10. The uf2 file generate is to be uploaded in Pico to dump code. For
that, press boot switch of pico and insert power cable to PC. It’ll get
detected as flash drive, we need to paste blink.uf2 file there and Pico
will restart automatically and onboard LED will blink.
Rpi Pico W

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)

#IMPORTANT!!! Use this only to set board Pico W, otherwise


#comment
set(PICO_BOARD pico_w)

#Include build functions for Pico SDK


include(pico_sdk_import.cmake)

#set name of project (as PROJECT NAME) and C/C++ standards


project(blink C CXX ASM)
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)

#create a pico-sdk subdirectory in our project for the libraries


pico_sdk_init()

#Tell CMake where to find the executable source file


add_executable(blink
main.c
)

#Create map/bin/hex/uf2 files


pico_add_extra_outputs(blink)

#Link to pico_stdlib (gpio, time, etc, functions)


target_link_libraries(blink
pico_stdlib
pico_cyw43_arch_none # we need Wifi to access the GPIO,
#but we don't need anything else
)

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);
}
}

Now follow the remaining steps as already given above

You might also like