Adafruit Itsybitsy RP2040 Created by Kattni Rembor

Adafruit Itsybitsy RP2040 Created by Kattni Rembor

Adafruit ItsyBitsy RP2040 Created by Kattni Rembor Last updated on 2021-09-27 01:10:56 PM EDT Guide Contents Guide Contents 2 Overview 5 Pinouts 10 Power 10 Logic Pins 12 I2C and SPI on RP2040 12 PWM on RP2040 12 The Bottom Edge 12 Analog Pins 13 Digital Pins 13 The Top Edge 14 Digital Pins 14 The Short Edge 15 Digital Pins 16 CircuitPython Pins vs GPxx Pins 16 CircuitPython I2C, SPI and UART 16 GPIO Pins by Pin Functionality 16 I2C Pins 16 SPI Pins 16 UART Pins 17 PWM Pins 17 Microcontroller and Flash 17 Buttons 18 LEDs 18 Debug 19 CircuitPython 21 CircuitPython Quickstart 21 Safe Mode 23 Entering Safe Mode in CircuitPython 6.x 23 Entering Safe Mode in CircuitPython 7.x 23 In Safe Mode 24 Flash Resetting UF2 24 Installing Mu Editor 25 Download and Install Mu 25 Using Mu 25 Creating and Editing Code 27 Creating Code 27 Editing Code 29 Your code changes are run as soon as the file is done saving. 30 1. Use an editor that writes out the file completely when you save it. 30 2. Eject or Sync the Drive After Writing 31 Oh No I Did Something Wrong and Now The CIRCUITPY Drive Doesn't Show Up!!! 31 Back to Editing Code... 32 Exploring Your First CircuitPython Program 33 Imports & Libraries 33 Setting Up The LED 33 Loop-de-loops 34 What Happens When My Code Finishes Running? 34 What if I don't have the loop? 35 More Changes 36 Naming Your Program File 36 Connecting to the Serial Console 37 © Adafruit Industries https://learn.adafruit.com/adafruit-itsybitsy-rp2040 Page 2 of 110 Are you using Mu? 37 Setting Permissions on Linux 38 Using Something Else? 39 Interacting with the Serial Console 40 The REPL 44 Returning to the serial console 47 CircuitPython Pins and Modules 48 CircuitPython Pins 48 import board 48 I2C, SPI, and UART 49 What Are All the Available Names? 50 Microcontroller Pin Names 51 CircuitPython Built-In Modules 52 CircuitPython Libraries 53 Installing the CircuitPython Library Bundle 54 Example Files 55 Copying Libraries to Your Board 56 Example: ImportError Due to Missing Library 56 Library Install on Non-Express Boards 58 Updating CircuitPython Libraries/Examples 58 Frequently Asked Questions 59 I have to continue using an older version of CircuitPython; where can I find compatible libraries? 59 Is ESP8266 or ESP32 supported in CircuitPython? Why not? 59 How do I connect to the Internet with CircuitPython? 60 Is there asyncio support in CircuitPython? 61 My RGB NeoPixel/DotStar LED is blinking funny colors - what does it mean? 62 What is a MemoryError? 63 What do I do when I encounter a MemoryError? 63 Can the order of my import statements affect memory? 64 How can I create my own .mpy files? 64 How do I check how much memory I have free? 64 Does CircuitPython support interrupts? 64 Does Feather M0 support WINC1500? 65 Can AVRs such as ATmega328 or ATmega2560 run CircuitPython? 65 Commonly Used Acronyms 65 Welcome to the Community! 66 Adafruit Discord 66 Adafruit Forums 67 Adafruit Github 68 ReadTheDocs 69 Advanced Serial Console on Windows 71 Windows 7 Driver 71 What's the COM? 71 Install Putty 73 Advanced Serial Console on Mac and Linux 75 What's the Port? 75 Connect with screen 77 Permissions on Linux 78 Troubleshooting 81 Always Run the Latest Version of CircuitPython and Libraries 81 © Adafruit Industries https://learn.adafruit.com/adafruit-itsybitsy-rp2040 Page 3 of 110 I have to continue using CircuitPython 5.x, 4.x, 3.x or 2.x, where can I find compatible libraries? 81 CPLAYBOOT, TRINKETBOOT, FEATHERBOOT, or GEMMABOOT Drive Not Present 81 You may have a different board. 82 MakeCode 82 MacOS 82 Windows 10 82 Windows 7 or 8.1 82 Windows Explorer Locks Up When Accessing boardnameBOOT Drive 83 Copying UF2 to boardnameBOOT Drive Hangs at 0% Copied 84 CIRCUITPY Drive Does Not Appear 84 Device Errors or Problems on Windows 84 Serial Console in Mu Not Displaying Anything 85 CircuitPython RGB Status Light 86 ValueError: Incompatible .mpy file. 86 CIRCUITPY Drive Issues 87 Easiest Way: Use storage.erase_filesystem() 87 Old Way: For the Circuit Playground Express, Feather M0 Express, and Metro M0 Express: 87 Old Way: For Non-Express Boards with a UF2 bootloader (Gemma M0, Trinket M0): 89 Old Way: For non-Express Boards without a UF2 bootloader (Feather M0 Basic Proto, Feather Adalogger, Arduino Zero): 90 Running Out of File Space on Non-Express Boards 90 Delete something! 90 Use tabs 90 MacOS loves to add extra files. 90 Prevent & Remove MacOS Hidden Files 91 Copy Files on MacOS Without Creating Hidden Files 91 Other MacOS Space-Saving Tips 92 Device locked up or boot looping 93 CircuitPython Essentials 95 Blink 96 LED Location 96 Blinking an LED 96 Digital Input 98 LED and Button 98 Controlling the LED with a Button 98 Built-In NeoPixel LED 100 NeoPixel Location 100 NeoPixel Color and Brightness 100 RGB LED Colors 102 NeoPixel Rainbow 103 CPU Temperature 106 Microcontroller Location 106 Reading the Microcontroller Temperature 106 Downloads 108 Files 108 Schematic and Fab Print 108 3D Models 109 © Adafruit Industries https://learn.adafruit.com/adafruit-itsybitsy-rp2040 Page 4 of 110 Overview A new chip means a new ItsyBitsy, and the Raspberry Pi RP2040 is no exception. When we saw this chip we thought "this chip is going to be awesome when we give it the ItsyBitsy teensy-weensy treatment" and so we did! This Itsy' features the RP2040, and all niceties you know and love about the ItsyBitsy family (https://adafru.it/S4E) What's smaller than a Feather but larger than a Trinket? It's an Adafruit ItsyBitsy RP2040 featuring the Raspberry Pi RP2040! Small, powerful, with a ultra fast dual Cortex M0+ processor running at 125 MHz - this microcontroller board is perfect when you want something very compact, with lots of horsepower and a bunch of pins. This Itsy has sports car speed, but SUV roominess with 8 MB of FLASH and 264KB of SRAM. © Adafruit Industries https://learn.adafruit.com/adafruit-itsybitsy-rp2040 Page 5 of 110 ItsyBitsy RP2040 is only 1.4" long by 0.7" wide, but has 6 power pins, 23 digital GPIO pins (4 of which can be analog in and 16 x PWM out). It's the same chip as the Feather RP2040 (http://adafru.it/4884) and Raspberry Pi Pico (http://adafru.it/4883) but really really small. So it's great once you've finished up a prototype, and want to make the project much smaller. It even comes with 8 MB of SPI Flash built in, for data logging, file storage, or CircuitPython/MicroPython code Same size and form-factor as the rest of the ItsyBitsy family (https://adafru.it/S4E) and nearly-identical pinout © Adafruit Industries https://learn.adafruit.com/adafruit-itsybitsy-rp2040 Page 6 of 110 Measures 1.4" x 0.7" x 0.2" (36mm x 18mm x 4mm) without headers soldered in RP2040 32-bit Cortex M0+ dual core running at ~125 MHz @ 3.3V logic and power 264 KB RAM 8 MB SPI FLASH chip for storing files and CircuitPython/MicroPython code storage. No EEPROM Tons of GPIO! 23 x GPIO pins with following capabilities: Four 12 bit ADCs (one more than Pico) Two I2C, Two SPI and two UART peripherals, we label one for the 'main' interface in standard ItsyBitsy locations 16 x PWM outputs - for servos, LEDs, etc The 10 digital 'non-ADC/non-peripheral' GPIO are consecutive for maximum PIO compatibility Pin #13 red LED for general purpose blinking RGB NeoPixel with power pin on GPIO so you can depower it for low power usages. Both Reset button and Bootloader select button for quick restarts (no unplugging-replugging to relaunch code) 3.3V regulator with 500mA peak current output 3.3V Power/enable pin Power with either USB or external output (such as a battery) - it'll automatically switch over Broken-out SWD pins for debug access 12 MHz crystal for perfect timing. Special Vhigh output pin gives you the higher voltage from VBAT or VUSB, for driving NeoPixels, servos, and other 5V-logic devices. Digital 5 level-shifted output for high-voltage logic level output. USB Micro B connector lets you access built-in ROM USB bootloader and serial port debugging Inside the RP2040 is a 'permanent ROM' USB UF2 bootloader . What that means is when you want to program new firmware, you can hold down the BOOTSEL button while plugging it into USB (or pulling © Adafruit Industries https://learn.adafruit.com/adafruit-itsybitsy-rp2040 Page 7 of 110 down the RUN/Reset pin to ground) and it will appear as a USB disk drive you can drag the firmware onto. Folks who have been using Adafruit products will find this very familiar - we use the technique on all our native-USB boards. Just note you don't double-click reset, instead hold down BOOTSEL during boot to enter the bootloader! The RP2040 is a powerful chip, which has the clock speed of our M4 (SAMD51), and two cores that are equivalent to our M0 (SAMD21). Since it is an M0 chip, it does not have a floating point unit or DSP hardware support - so if you're doing something with heavy floating point math, it will be done in software and thus not as fast as an M4. For many other computational tasks, you'll get close-to-M4 speeds! For peripherals, there are two I2C controllers, two SPI controllers, and two UARTs that are multiplexed across the GPIO - check the pinout for what pins can be set to which.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    110 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us