{"id":3534,"date":"2021-01-22T16:24:20","date_gmt":"2021-01-22T09:24:20","guid":{"rendered":"https:\/\/www.makeriot2020.com\/?p=3534"},"modified":"2021-01-22T16:24:25","modified_gmt":"2021-01-22T09:24:25","slug":"getting-started-with-the-raspberry-pi-pico-part-2-of-the-pico-series","status":"publish","type":"post","link":"https:\/\/www.makeriot2020.com\/index.php\/2021\/01\/22\/getting-started-with-the-raspberry-pi-pico-part-2-of-the-pico-series\/","title":{"rendered":"Getting Started with the Raspberry Pi Pico &#8212; Part 2 of the Pico Series&#8230;"},"content":{"rendered":"\n<p>Welcome to Part two of my RPi Pico Series. You can buy yours from <a rel=\"noreferrer noopener\" href=\"https:\/\/th.cytron.io\/p-raspberry-pi-pico?utm_source=Jean&amp;utm_medium=pico&amp;utm_campaign=new%20product\" target=\"_blank\">Cytron Technologies<\/a>.<br>In this post, we will look at some more of the features of the board, as well as how to get started using this development board. I will focus on MicroPython in this post, and cover C\/C++ in the next post.<\/p>\n\n\n\n<p>But before we do that, lets run over some of the specifications of the board first&#8230;<br>The Python Stuff will be at the end of this post&#8230;<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Board Specifications<\/h2>\n\n\n\n<p><strong>Raspberry Pi Pico is a low-cost, high-performance microcontroller board with flexible digital interfaces. Key features include:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>RP2040 microcontroller chip designed by Raspberry Pi in the United Kingdom<\/li><li>Dual-core Arm Cortex M0+ processor, flexible clock running up to 133 MHz<\/li><li>264KB of SRAM, and 2MB of on-board Flash memory<\/li><li>Castellated module allows soldering direct to carrier boards<\/li><li>USB 1.1 with device and host support<\/li><li>Low-power sleep and dormant modes<\/li><\/ul>\n\n\n\n<ul class=\"wp-block-list\"><li>Drag-and-drop programming using mass storage over USB<\/li><li>26 \u00d7 multi-function GPIO pins<\/li><li>2 \u00d7 SPI, 2 \u00d7 I2C, 2 \u00d7 UART, 3 \u00d7 12-bit ADC, 16 \u00d7 controllable PWM channels<\/li><li>Accurate clock and timer on-chip<\/li><li>Temperature sensor<\/li><li>Accelerated floating-point libraries on-chip<\/li><li>8 \u00d7 Programmable I\/O (PIO) state machines for custom peripheral support<\/li><\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"878\" height=\"648\" data-src=\"http:\/\/144.126.248.244\/wp-content\/uploads\/2021\/01\/Screenshot-at-2021-01-22-15-38-25.png\" alt=\"\" class=\"wp-image-3641 lazyload\" data-srcset=\"https:\/\/www.makeriot2020.com\/wp-content\/uploads\/2021\/01\/Screenshot-at-2021-01-22-15-38-25.png 878w, https:\/\/www.makeriot2020.com\/wp-content\/uploads\/2021\/01\/Screenshot-at-2021-01-22-15-38-25-600x443.png 600w, https:\/\/www.makeriot2020.com\/wp-content\/uploads\/2021\/01\/Screenshot-at-2021-01-22-15-38-25-300x221.png 300w, https:\/\/www.makeriot2020.com\/wp-content\/uploads\/2021\/01\/Screenshot-at-2021-01-22-15-38-25-768x567.png 768w\" data-sizes=\"(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 878px; --smush-placeholder-aspect-ratio: 878\/648;\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Utilities<\/h2>\n\n\n\n<p><strong>What is on your Pico?<\/strong><\/p>\n\n\n\n<p>If you have forgotten what has been programmed into your Raspberry Pi Pico, and the program was built using our Pico C\/C++ SDK, it will usually have a name and other useful information embedded into the binary. You can use the Picotool command line utility to find out these details. Full instructions on how to use Picotool to do this are available in the  &#8216;<a href=\"https:\/\/rptl.io\/pico-get-started\">getting started<\/a>&#8216; documentation.<\/p>\n\n\n\n<p><a rel=\"noreferrer noopener\" href=\"https:\/\/github.com\/raspberrypi\/picotool\" target=\"_blank\">Pico Github Repo<\/a><\/p>\n\n\n\n<p><strong>Debugging using another Raspberry Pi Pico<\/strong><\/p>\n\n\n\n<p>It is possible to use one Raspberry Pi Pico to debug another Pico. This is possible via picoprobe, an application that allows a Pico to act as a USB \u2192 SWD and UART converter. This makes it easy to use a Pico on non-Raspberry Pi platforms such as Windows, Mac, and Linux computers where you don\u2019t have GPIOs to connect directly to your Pico. Full instructions on how to use Picoprobe to do this are available in the &#8216;<a href=\"https:\/\/rptl.io\/pico-get-started\">getting started<\/a>&#8216; documentation.<\/p>\n\n\n\n<p><a rel=\"noreferrer noopener\" href=\"https:\/\/github.com\/raspberrypi\/picoprobe\" target=\"_blank\">PicoProbe Github Repo<\/a><br><\/p>\n\n\n\n<div class=\"wp-block-file\"><a href=\"http:\/\/144.126.248.244\/wp-content\/uploads\/2021\/01\/picoprobe.zip\">picoprobe<\/a><a href=\"http:\/\/144.126.248.244\/wp-content\/uploads\/2021\/01\/picoprobe.zip\" class=\"wp-block-file__button\" download>Download<\/a><\/div>\n\n\n\n<p><strong>Resetting Flash memory<\/strong><\/p>\n\n\n\n<p>Pico&#8217;s BOOTSEL mode lives in read-only memory inside the RP2040 chip, and can&#8217;t be overwritten accidentally. No matter what, if you hold down the BOOTSEL button when you plug in your Pico, it will appear as a drive onto which you can drag a new UF2 file. There is no way to brick the board through software. However, there are some circumstances where you might want to make sure your Flash memory is empty. You can do this by dragging and dropping a special UF2 binary onto your Pico when it is in mass storage mode.<\/p>\n\n\n\n<div class=\"wp-block-file\"><a href=\"http:\/\/144.126.248.244\/wp-content\/uploads\/2021\/01\/flash_nuke.zip\">flash_nuke<\/a><a href=\"http:\/\/144.126.248.244\/wp-content\/uploads\/2021\/01\/flash_nuke.zip\" class=\"wp-block-file__button\" download>Download<\/a><\/div>\n\n\n\n<p>The Code for the flash eraser is available below<br><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\n\/**\n * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.\n *\n * SPDX-License-Iden\n\/**\n * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n *\/\n\n\/\/ Obliterate the contents of flash. This is a silly thing to do if you are\n\/\/ trying to run this program from flash, so you should really load and run\n\/\/ directly from SRAM. You can enable RAM-only builds for all targets by doing:\n\/\/\n\/\/ cmake -DPICO_NO_FLASH=1 ..\n\/\/\n\/\/ in your build directory. We've also forced no-flash builds for this app in\n\/\/ particular by adding:\n\/\/\n\/\/ pico_set_binary_type(flash_nuke no_flash)\n\/\/\n\/\/ To the CMakeLists.txt app for this file. Just to be sure, we can check the\n\/\/ define:\n#if !PICO_NO_FLASH\n#error \"This example must be built to run from SRAM!\"\n#endif\n\n#include \"pico\/stdlib.h\"\n#include \"hardware\/flash.h\"\n#include \"pico\/bootrom.h\"\n\nint main() {\n    flash_range_erase(0, PICO_FLASH_SIZE_BYTES);\n    \/\/ Leave an eyecatcher pattern in the first page of flash so picotool can\n    \/\/ more easily check the size:\n    static const uint8_t eyecatcher&#91;FLASH_PAGE_SIZE] = \"NUKE\";\n    flash_range_program(0, eyecatcher, FLASH_PAGE_SIZE);\n\n    \/\/ Flash LED for success\n    gpio_init(PICO_DEFAULT_LED_PIN);\n    gpio_set_dir(PICO_DEFAULT_LED_PIN, GPIO_OUT);\n    for (int i = 0; i &lt; 3; ++i) {\n        gpio_put(PICO_DEFAULT_LED_PIN, 1);\n        sleep_ms(100);\n        gpio_put(PICO_DEFAULT_LED_PIN, 0);\n        sleep_ms(100);\n    }\n\n    \/\/ Pop back up as an MSD drive\n    reset_usb_boot(0, 0);\n}tifier: BSD-3-Clause\n *\/\n\n\/\/ Obliterate the contents of flash. This is a silly thing to do if you are\n\/\/ trying to run this program from flash, so you should really load and run\n\/\/ directly from SRAM. You can enable RAM-only builds for all targets by doing:\n\/\/\n\/\/ cmake -DPICO_NO_FLASH=1 ..\n\/\/\n\/\/ in your build directory. We've also forced no-flash builds for this app in\n\/\/ particular by adding:\n\/\/\n\/\/ pico_set_binary_type(flash_nuke no_flash)\n\/\/\n\/\/ To the CMakeLists.txt app for this file. Just to be sure, we can check the\n\/\/ define:\n#if !PICO_NO_FLASH\n#error \"This example must be built to run from SRAM!\"\n#endif\n\n#include \"pico\/stdlib.h\"\n#include \"hardware\/flash.h\"\n#include \"pico\/bootrom.h\"\n\nint main() {\n    flash_range_erase(0, PICO_FLASH_SIZE_BYTES);\n    \/\/ Leave an eyecatcher pattern in the first page of flash so picotool can\n    \/\/ more easily check the size:\n    static const uint8_t eyecatcher&#91;FLASH_PAGE_SIZE] = \"NUKE\";\n    flash_range_program(0, eyecatcher, FLASH_PAGE_SIZE);\n\n    \/\/ Flash LED for success\n    gpio_init(PICO_DEFAULT_LED_PIN);\n    gpio_set_dir(PICO_DEFAULT_LED_PIN, GPIO_OUT);\n    for (int i = 0; i &lt; 3; ++i) {\n        gpio_put(PICO_DEFAULT_LED_PIN, 1);\n        sleep_ms(100);\n        gpio_put(PICO_DEFAULT_LED_PIN, 0);\n        sleep_ms(100);\n    }\n\n    \/\/ Pop back up as an MSD drive\n    reset_usb_boot(0, 0);\n}<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Getting Started with MicroPython on the RPi Pico<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Drag and drop MicroPython<\/h3>\n\n\n\n<p>You can program your Pico by connecting it to a computer via USB, then dragging and dropping a file onto it, so we\u2019ve put together a downloadable UF2 file to let you install MicroPython more easily. Following the procedure below, you can install MicroPython onto the Pico in a few seconds&#8230;<br><br>1. Download and unzip the UF2 file below into a folder on your computer.<\/p>\n\n\n\n<p>2. Hold down the Bootsel button on the Pico, and connect it to a USB cable that was already connected to your computer. ( This means, connect ons side of the usb cable to the computer, but dont connect the Pico yet. then hold down BOOTSEL, and connect the cable to the pico)<\/p>\n\n\n\n<p>3. Now, release the BootSEL button<\/p>\n\n\n\n<p>4. After a few Seconds, you will have a new USB storage device on your computer, called RPI-RP2<\/p>\n\n\n\n<p>5. Drag the UF2 file into this USB Storage device. The Pico will reboot&#8230; You have now installed  MicroPython on your RPi Pico<\/p>\n\n\n\n<div class=\"wp-block-file\"><a href=\"http:\/\/144.126.248.244\/wp-content\/uploads\/2021\/01\/pico_micropython-1.zip\">Micropython UF2 File for RPi Pico<\/a><a href=\"http:\/\/144.126.248.244\/wp-content\/uploads\/2021\/01\/pico_micropython-1.zip\" class=\"wp-block-file__button\" download>Download<\/a><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Accessing the MicroPython REPL<\/h2>\n\n\n\n<p>You can now access REPL from a serial terminal, or a MicroPython IDE , like Thonny&#8230;<br>I will show you how to do it from the Linux Terminal below. <\/p>\n\n\n\n<p>The Pico will show up as a USB device called ttyACM0<br>you can find it by issuing the <strong>ls \/dev\/tty* <\/strong> command<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"720\" height=\"419\" data-src=\"http:\/\/144.126.248.244\/wp-content\/uploads\/2021\/01\/Screenshot-at-2021-01-22-16-08-47.png\" alt=\"\" class=\"wp-image-3727 lazyload\" data-srcset=\"https:\/\/www.makeriot2020.com\/wp-content\/uploads\/2021\/01\/Screenshot-at-2021-01-22-16-08-47.png 720w, https:\/\/www.makeriot2020.com\/wp-content\/uploads\/2021\/01\/Screenshot-at-2021-01-22-16-08-47-600x349.png 600w, https:\/\/www.makeriot2020.com\/wp-content\/uploads\/2021\/01\/Screenshot-at-2021-01-22-16-08-47-300x175.png 300w\" data-sizes=\"(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 984px) 61vw, (max-width: 1362px) 45vw, 600px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 720px; --smush-placeholder-aspect-ratio: 720\/419;\" \/><\/figure>\n\n\n\n<p>Start minicom or your preferred serial terminal emulator <\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"738\" height=\"495\" data-src=\"http:\/\/144.126.248.244\/wp-content\/uploads\/2021\/01\/Screenshot-at-2021-01-22-16-16-32.png\" alt=\"\" class=\"wp-image-3728 lazyload\" data-srcset=\"https:\/\/www.makeriot2020.com\/wp-content\/uploads\/2021\/01\/Screenshot-at-2021-01-22-16-16-32.png 738w, https:\/\/www.makeriot2020.com\/wp-content\/uploads\/2021\/01\/Screenshot-at-2021-01-22-16-16-32-600x402.png 600w, https:\/\/www.makeriot2020.com\/wp-content\/uploads\/2021\/01\/Screenshot-at-2021-01-22-16-16-32-300x201.png 300w\" data-sizes=\"(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 984px) 61vw, (max-width: 1362px) 45vw, 600px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 738px; --smush-placeholder-aspect-ratio: 738\/495;\" \/><\/figure>\n\n\n\n<p>Press enter a few times, and you should get a REPL prompt<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"737\" height=\"351\" data-src=\"http:\/\/144.126.248.244\/wp-content\/uploads\/2021\/01\/Screenshot-at-2021-01-22-16-18-38.png\" alt=\"\" class=\"wp-image-3737 lazyload\" data-srcset=\"https:\/\/www.makeriot2020.com\/wp-content\/uploads\/2021\/01\/Screenshot-at-2021-01-22-16-18-38.png 737w, https:\/\/www.makeriot2020.com\/wp-content\/uploads\/2021\/01\/Screenshot-at-2021-01-22-16-18-38-600x286.png 600w, https:\/\/www.makeriot2020.com\/wp-content\/uploads\/2021\/01\/Screenshot-at-2021-01-22-16-18-38-300x143.png 300w\" data-sizes=\"(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 984px) 61vw, (max-width: 1362px) 45vw, 600px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 737px; --smush-placeholder-aspect-ratio: 737\/351;\" \/><\/figure>\n\n\n\n<p>You can now test MicroPython on your Pico, by typing the following commands:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"739\" height=\"493\" data-src=\"http:\/\/144.126.248.244\/wp-content\/uploads\/2021\/01\/Screenshot-at-2021-01-22-16-21-23.png\" alt=\"\" class=\"wp-image-3740 lazyload\" data-srcset=\"https:\/\/www.makeriot2020.com\/wp-content\/uploads\/2021\/01\/Screenshot-at-2021-01-22-16-21-23.png 739w, https:\/\/www.makeriot2020.com\/wp-content\/uploads\/2021\/01\/Screenshot-at-2021-01-22-16-21-23-600x400.png 600w, https:\/\/www.makeriot2020.com\/wp-content\/uploads\/2021\/01\/Screenshot-at-2021-01-22-16-21-23-300x200.png 300w\" data-sizes=\"(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 984px) 61vw, (max-width: 1362px) 45vw, 600px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 739px; --smush-placeholder-aspect-ratio: 739\/493;\" \/><\/figure>\n\n\n\n<p>The complete MicroPython SDK for the RPi Pico is available for download at the link below&#8230;<br><\/p>\n\n\n\n<div class=\"wp-block-file\"><a href=\"http:\/\/144.126.248.244\/wp-content\/uploads\/2021\/01\/pico_python_sdk-1.pdf\">pico_python_sdk-1<\/a><a href=\"http:\/\/144.126.248.244\/wp-content\/uploads\/2021\/01\/pico_python_sdk-1.pdf\" class=\"wp-block-file__button\" download>Download<\/a><\/div>\n\n\n\n<p>In the next part of this series, we will look at using the Thonny IDE, as well as C\/C++ to program the Pico<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Welcome to Part two of my RPi Pico Series. You can buy yours from Cytron Technologies.In this post, we will look at some more of the features of the board, as well as how to get started using this development board. I will focus on MicroPython in this post, and cover C\/C++ in the next &hellip; <a href=\"https:\/\/www.makeriot2020.com\/index.php\/2021\/01\/22\/getting-started-with-the-raspberry-pi-pico-part-2-of-the-pico-series\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Getting Started with the Raspberry Pi Pico &#8212; Part 2 of the Pico Series&#8230;&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":3542,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[94,1],"tags":[98],"class_list":["post-3534","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-raspberry-pi-pico","category-uncategorized","tag-pi-pico"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.makeriot2020.com\/index.php\/wp-json\/wp\/v2\/posts\/3534","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.makeriot2020.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.makeriot2020.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.makeriot2020.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.makeriot2020.com\/index.php\/wp-json\/wp\/v2\/comments?post=3534"}],"version-history":[{"count":0,"href":"https:\/\/www.makeriot2020.com\/index.php\/wp-json\/wp\/v2\/posts\/3534\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.makeriot2020.com\/index.php\/wp-json\/wp\/v2\/media\/3542"}],"wp:attachment":[{"href":"https:\/\/www.makeriot2020.com\/index.php\/wp-json\/wp\/v2\/media?parent=3534"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.makeriot2020.com\/index.php\/wp-json\/wp\/v2\/categories?post=3534"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.makeriot2020.com\/index.php\/wp-json\/wp\/v2\/tags?post=3534"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}