Introducing Adafruit Feather RP2040 Created by Kattni Rembor

Total Page:16

File Type:pdf, Size:1020Kb

Introducing Adafruit Feather RP2040 Created by Kattni Rembor Introducing Adafruit Feather RP2040 Created by Kattni Rembor Last updated on 2021-07-21 12:22:58 PM EDT Guide Contents Guide Contents 2 Overview 6 Pinouts 12 Power Pins and Connections 13 Logic Pins 14 I2C and SPI on RP2040 14 PWM on RP2040 14 Analog Pins 15 Digital Pins 15 CircuitPython Pins vs GPxx Pins 15 CircuitPython I2C, SPI and UART 15 GPIO Pins by Pin Functionality 16 I2C Pins 16 SPI Pins 16 UART Pins 16 PWM Pins 16 Microcontroller and Flash 17 Buttons and RST Pin 17 LEDs 18 STEMMA QT 19 Debug Interfaces 19 Assembly 22 Header Options! 22 Soldering in Plain Headers 25 Prepare the header strip: 25 Add the breakout board: 26 And Solder! 26 Soldering on Female Header 28 Tape In Place 28 Flip & Tack Solder 29 And Solder! 30 Power Management 32 Battery + USB Power 32 Power supplies 33 Measuring Battery 33 ENable pin 34 Alternative Power Options 34 Install CircuitPython 36 CircuitPython Quickstart 36 Safe Mode 37 Entering Safe Mode in CircuitPython 6.x 38 Entering Safe Mode in CircuitPython 7.x 38 In Safe Mode 39 Flash Resetting UF2 39 Installing Mu Editor 40 Download and Install Mu 40 Using Mu 40 Creating and Editing Code 42 Creating Code 42 Editing Code 44 Your code changes are run as soon as the file is done saving. 45 1. Use an editor that writes out the file completely when you save it. 45 © Adafruit Industries https://learn.adafruit.com/adafruit-feather-rp2040-pico Page 2 of 122 2. Eject or Sync the Drive After Writing 46 Oh No I Did Something Wrong and Now The CIRCUITPY Drive Doesn't Show Up!!! 46 Back to Editing Code... 47 Exploring Your First CircuitPython Program 48 Imports & Libraries 48 Setting Up The LED 48 Loop-de-loops 49 What Happens When My Code Finishes Running? 49 What if I don't have the loop? 50 More Changes 51 Naming Your Program File 51 Connecting to the Serial Console 52 Are you using Mu? 52 Setting Permissions on Linux 53 Using Something Else? 54 Interacting with the Serial Console 55 The REPL 59 Returning to the serial console 62 CircuitPython Pins and Modules 63 CircuitPython Pins 63 import board 63 I2C, SPI, and UART 64 What Are All the Available Names? 65 Microcontroller Pin Names 66 CircuitPython Built-In Modules 67 CircuitPython Libraries 68 Installing the CircuitPython Library Bundle 69 Example Files 70 Copying Libraries to Your Board 71 Example: ImportError Due to Missing Library 71 Library Install on Non-Express Boards 73 Updating CircuitPython Libraries/Examples 73 Frequently Asked Questions 74 I have to continue using an older version of CircuitPython; where can I find compatible libraries? 74 Is ESP8266 or ESP32 supported in CircuitPython? Why not? 74 How do I connect to the Internet with CircuitPython? 75 Is there asyncio support in CircuitPython? 76 My RGB NeoPixel/DotStar LED is blinking funny colors - what does it mean? 77 What is a MemoryError? 78 What do I do when I encounter a MemoryError? 78 Can the order of my import statements affect memory? 79 How can I create my own .mpy files? 79 How do I check how much memory I have free? 79 Does CircuitPython support interrupts? 79 Does Feather M0 support WINC1500? 80 Can AVRs such as ATmega328 or ATmega2560 run CircuitPython? 80 Commonly Used Acronyms 80 Welcome to the Community! 81 Adafruit Discord 81 Adafruit Forums 82 Adafruit Github 83 ReadTheDocs 84 © Adafruit Industries https://learn.adafruit.com/adafruit-feather-rp2040-pico Page 3 of 122 Advanced Serial Console on Windows 86 Windows 7 Driver 86 What's the COM? 86 Install Putty 87 Advanced Serial Console on Mac and Linux 89 What's the Port? 89 Connect with screen 91 Permissions on Linux 92 Troubleshooting 95 Always Run the Latest Version of CircuitPython and Libraries 95 I have to continue using CircuitPython 5.x, 4.x, 3.x or 2.x, where can I find compatible libraries? 95 CPLAYBOOT, TRINKETBOOT, FEATHERBOOT, or GEMMABOOT Drive Not Present 95 You may have a different board. 96 MakeCode 96 MacOS 96 Windows 10 96 Windows 7 or 8.1 96 Windows Explorer Locks Up When Accessing boardnameBOOT Drive 97 Copying UF2 to boardnameBOOT Drive Hangs at 0% Copied 98 CIRCUITPY Drive Does Not Appear 98 Windows 7 and 8.1 Problems 98 Serial Console in Mu Not Displaying Anything 98 CircuitPython RGB Status Light 99 ValueError: Incompatible .mpy file. 100 CIRCUITPY Drive Issues 100 Easiest Way: Use storage.erase_filesystem() 101 Old Way: For the Circuit Playground Express, Feather M0 Express, and Metro M0 Express: 101 Old Way: For Non-Express Boards with a UF2 bootloader (Gemma M0, Trinket M0): 103 Old Way: For non-Express Boards without a UF2 bootloader (Feather M0 Basic Proto, Feather Adalogger, Arduino Zero): 103 Running Out of File Space on Non-Express Boards 103 Delete something! 103 Use tabs 104 MacOS loves to add extra files. 104 Prevent & Remove MacOS Hidden Files 104 Copy Files on MacOS Without Creating Hidden Files 105 Other MacOS Space-Saving Tips 106 Device locked up or boot looping 107 CircuitPython Essentials 108 Blink 109 LED Location 109 Blinking an LED 109 Digital Input 111 LED and Button 111 Controlling the LED with a Button 111 Built-In NeoPixel LED 113 NeoPixel Location 113 NeoPixel Color and Brightness 113 RGB LED Colors 115 © Adafruit Industries https://learn.adafruit.com/adafruit-feather-rp2040-pico Page 4 of 122 NeoPixel Rainbow 116 CPU Temperature 118 Microcontroller Location 118 Reading the Microcontroller Temperature 118 Downloads 120 Files: 120 Schematic 120 Fab Print 120 3D Model 121 © Adafruit Industries https://learn.adafruit.com/adafruit-feather-rp2040-pico Page 5 of 122 Overview A new chip means a new Feather, 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 Feather Treatment" and so we did! This Feather features the RP2040, and all niceties you know and love about Feather Measures 2.0" x 0.9" x 0.28" (50.8mm x 22.8mm x 7mm) without headers soldered in © Adafruit Industries https://learn.adafruit.com/adafruit-feather-rp2040-pico Page 6 of 122 Light as a (large?) feather - 5 grams 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! 21 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 Feather locations 16 x PWM outputs - for servos, LEDs, etc The 8 digital 'non-ADC/non-peripheral' GPIO are consecutive for maximum PIO compatibility Built in 200mA lipoly charger with charging status indicator LED Pin #13 red LED for general purpose blinking RGB NeoPixel with power pin on GPIO so you can depower it for low power usages. On-board STEMMA QT connector that lets you quickly connect any Qwiic, STEMMA QT or Grove I2C devices with no soldering! Both Reset button and Bootloader select button for quick restarts (no unplugging-replugging to relaunch code) 3.3V Power/enable pin Optional SWD debug port can be soldered in for debug access (https://adafru.it/w5e) 4 mounting holes 12 MHz crystal for perfect timing. 3.3V regulator with 500mA peak current output USB Type C 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 © Adafruit Industries https://learn.adafruit.com/adafruit-feather-rp2040-pico Page 7 of 122 program new firmware, you can hold down the BOOTSEL button while plugging it into USB (or pulling 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. There are 16 PWM channels, each pin has a channel it can be set to (ditto on the pinout). You'll note there's no I2S peripheral, or SDIO, or camera, what's up with that? Well instead of having specific hardware support for serial-data-like peripherals like these, the RP2040 comes with the PIO state machine system which is a unique and powerful way to create custom hardware logic and data processing blocks that run on their own without taking up a CPU. For example, NeoPixels - often we bitbang the timing-specific protocol for these LEDs. For the RP2040, we instead use PIO object that reads in the data buffer and clocks out the right bitstream with perfect accuracy.
Recommended publications
  • Raspberry Pi Pico SDK
    FAQ Colophon Copyright © 2020 Raspberry Pi (Trading) Ltd. The documentation of the RP2040 microcontroller is licensed under a Creative Commons Attribution-NoDerivatives 4.0 International (CC BY-ND). build-date: 2021-09-30 build-version: 000dcb1-clean About the SDK Throughout the text "the SDK" refers to our Raspberry Pi Pico SDK. More details about the SDK can be found in the Raspberry Pi Pico C/C++ SDK book. Source code included in the documentation is Copyright © 2020 Raspberry Pi (Trading) Ltd. and licensed under the 3-Clause BSD license. Legal Disclaimer Notice TECHNICAL AND RELIABILITY DATA FOR RASPBERRY PI PRODUCTS (INCLUDING DATASHEETS) AS MODIFIED FROM TIME TO TIME (“RESOURCES”) ARE PROVIDED BY RASPBERRY PI (TRADING) LTD (“RPTL) "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW IN NO EVENT SHALL RPTL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THE RESOURCES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. RPTL reserves the right to make any enhancements, improvements, corrections or any other modifications to the RESOURCES or any products described in them at any time and without further notice. The RESOURCES are intended for skilled users with suitable levels of design knowledge.
    [Show full text]
  • Micropython for Satlink 3 Documentation Release 1.8.4
    MicroPython for Satlink 3 Documentation Release 1.8.4 Damien P. George, contributors, and Sutron Corporation Jul 28, 2017 CONTENTS 1 Python first time setup & configuration1 1.1 1. Download & Install LinkComm....................................1 1.2 2. Download & Install Python......................................1 1.3 3. Download & Install Pyinstaller....................................3 1.4 4. Download & Install PyCharm.....................................3 1.5 5. Testing out .py to .exe converter....................................5 1.6 6. Python PyQt5 GUI..........................................6 1.7 7. Connect PyCharm into external programs like linkcomm or micropython..............6 1.8 8. Configure PyCharm for program development using LinkComm..................9 1.9 9. Configure PyCharm with SL3 API for auto completion....................... 11 1.10 10. Setting docstring stub in PyCharm.................................. 13 2 MicroPython libraries 15 2.1 Python standard libraries and micro-libraries.............................. 15 2.2 MicroPython-specific libraries...................................... 16 2.3 Libraries specific to the Satlink 3.................................... 19 3 The MicroPython language 39 3.1 Overview of MicroPython Differences from Standard Python..................... 39 3.2 Code examples of how MicroPython differs from Standard Python with work-arounds........ 41 3.3 The MicroPython Interactive Interpreter Mode (aka REPL)....................... 56 3.4 Maximising Python Speed.......................................
    [Show full text]
  • Setting up Your Environment
    APPENDIX A Setting Up Your Environment Choosing the correct tools to work with asyncio is a non-trivial choice, since it can significantly impact the availability and performance of asyncio. In this appendix, we discuss the interpreter and the packaging options that influence your asyncio experience. The Interpreter Depending on the API version of the interpreter, the syntax of declaring coroutines change and the suggestions considering API usage change. (Passing the loop parameter is considered deprecated for APIs newer than 3.6, instantiating your own loop should happen only in rare circumstances in Python 3.7, etc.) Availability Python interpreters adhere to the standard in varying degrees. This is because they are implementations/manifestations of the Python language specification, which is managed by the PSF. At the time of this writing, three relevant interpreters support at least parts of asyncio out of the box: CPython, MicroPython, and PyPy. © Mohamed Mustapha Tahrioui 2019 293 M. M. Tahrioui, asyncio Recipes, https://doi.org/10.1007/978-1-4842-4401-2 APPENDIX A SeTTinG Up YouR EnViROnMenT Since we are ideally interested in a complete or semi-complete implementation of asyncio, our choice is limited to CPython and PyPy. Both of these products have a great community. Since we are ideally using a lot powerful stdlib features, it is inevitable to pose the question of implementation completeness of a given interpreter with respect to the Python specification. The CPython interpreter is the reference implementation of the language specification and hence it adheres to the largest set of features in the language specification. At the point of this writing, CPython was targeting API version 3.7.
    [Show full text]
  • Python Crypto Misuses in the Wild
    Python Crypto Misuses in the Wild Anna-Katharina Wickert Lars Baumgärtner [email protected] [email protected] Technische Universität Darmstadt Technische Universität Darmstadt Darmstadt, Germany Darmstadt, Germany Florian Breitfelder Mira Mezini [email protected] [email protected] Technische Universität Darmstadt Technische Universität Darmstadt Darmstadt, Germany Darmstadt, Germany ABSTRACT 1 INTRODUCTION Background: Previous studies have shown that up to 99.59 % of the Cryptography, hereafter crypto, is widely used nowadays to protect Java apps using crypto APIs misuse the API at least once. However, our data and ensure confidentiality. For example, without crypto, these studies have been conducted on Java and C, while empirical we would not be able to securely use online banking or do online studies for other languages are missing. For example, a controlled shopping. Unfortunately, previous research results show that crypto user study with crypto tasks in Python has shown that 68.5 % of the is often used in an insecure way [3, 4, 7, 9, 11]. One such problem is professional developers write a secure solution for a crypto task. the choice of an insecure parameter, like an insecure block mode, for Aims: To understand if this observation holds for real-world code, crypto primitives like encryption. Many static analysis tools exist we conducted a study of crypto misuses in Python. Method: We to identify these misuses such as CryptoREX [13], CryptoLint [4], developed a static analysis tool that covers common misuses of5 CogniCryptSAST [8], and Cryptoguard [12]. different Python crypto APIs. With this analysis, we analyzed 895 While these tools and the respective in-the-wild studies concen- popular Python projects from GitHub and 51 MicroPython projects trate on Java and C, user studies suggest that the existing Python for embedded devices.
    [Show full text]
  • How Python Is Winning New Friends
    How Python is Winning New Friends Steve Holden CTO, Global Stress Index Limited [email protected] IntroducFons • Programmer since 1967 • Computaonal scienFst by training • Engineer at heart • Python user since Python 1.4 (c. 1995) • Enjoy helping people to learn I’ve WriSen about Python Any Python users out there? Developments in CompuFng SOME HISTORY 1948 Programming Was Hard • No operang system • No libraries • No compilers • No assemblers • The painful process of abstracFon layering began 1977 Easier to Program • Assemblers/compilers available • UNIX starFng to emerge as a common base – Microprogramming handled hardware complexity • Storage flexibly handled by the OS • Networking heading to ubiquity 1984 2015 2016 2017 2020 ? Whatever it is, it will be complex! And so to Python “BUT IT’S [JUST] A SCRIPTING LANGUAGE …” What’s a “ScripFng Language”? • “First they ignore you; then they abuse you; then they crack down on you and then you win.” – not Mahatma Ghandi What’s a “ScripFng Language”? • “First they ignore you; then they abuse you; then they crack down on you and then you win.” – not Mahatma Ghandi • “Ridicule is like repression. Both give place to respect when they fail to produce the intended effect.” – Mahatma Ghandi Note to Purists • Learners do not have complex needs – Simplicity and consistency are important – ExecuFon speed mostly isn’t • Direct hands-on experience enables • Large resources not required – Wide availability and ease of access are criFcal The Programming Audience • Professional soiware engineers • ScienFsts • Lab
    [Show full text]
  • Pdf for a Detailed Explanation, Along with Various Techniques for Debouncing
    MicroPython Documentation Release 1.11 Damien P. George, Paul Sokolovsky, and contributors May 29, 2019 CONTENTS i ii CHAPTER ONE MICROPYTHON LIBRARIES Warning: Important summary of this section • MicroPython implements a subset of Python functionality for each module. • To ease extensibility, MicroPython versions of standard Python modules usually have u (“micro”) prefix. • Any particular MicroPython variant or port may miss any feature/function described in this general docu- mentation (due to resource constraints or other limitations). This chapter describes modules (function and class libraries) which are built into MicroPython. There are a few categories of such modules: • Modules which implement a subset of standard Python functionality and are not intended to be extended by the user. • Modules which implement a subset of Python functionality, with a provision for extension by the user (via Python code). • Modules which implement MicroPython extensions to the Python standard libraries. • Modules specific to a particular MicroPython port and thus not portable. Note about the availability of the modules and their contents: This documentation in general aspires to describe all modules and functions/classes which are implemented in MicroPython project. However, MicroPython is highly configurable, and each port to a particular board/embedded system makes available only a subset of MicroPython libraries. For officially supported ports, there is an effort to either filter out non-applicable items, or mark individual descriptions with “Availability:” clauses describing which ports provide a given feature. With that in mind, please still be warned that some functions/classes in a module (or even the entire module) described in this documentation may be unavailable in a particular build of MicroPython on a particular system.
    [Show full text]
  • Bringing Python to Godot
    Bringing Python to Godot 01/02/2020 Emmanuel Leblond - https://github.com/touilleMan/godot-python Godot ? Open source (MIT) Full featured Linux support ❤❤❤ Demo time ! Godot: dynamic from the ground class Node2D : public Node { godot/node2d.hpp GDCLASS(Node2D, Node); void set_rot(float p_angle); float get_rot() const; ... void _bind_methods() { ClassDB::bind_method(D_METHOD("get_rot"), &Node2D::get_rot); ClassDB::bind_method(D_METHOD("set_rot", "degrees"), &Node2D::set_rot); ... } } Godot: dynamic from the ground class Node2D : public Node { godot/node2d.hpp GDCLASS(Node2D, Node); void set_rot(float p_angle); float get_rot() const; ... void _bind_methods() { ClassDB::bind_method(D_METHOD("get_rot"), &Node2D::get_rot); ClassDB::bind_method(D_METHOD("set_rot", "degrees"), &Node2D::set_rot); ... } } Godot: dynamic from the ground class Node2D : public Node { godot/node2d.hpp GDCLASS(Node2D, Node); void set_rot(float p_angle); float get_rot() const; ... void _bind_methods() { ClassDB::bind_method(D_METHOD("get_rot"), &Node2D::get_rot); ClassDB::bind_method(D_METHOD("set_rot", "degrees"), &Node2D::set_rot); ... } } # C++ static traditional way Node2D *obj = new Node2D(); obj->set_ret(4.2); Godot: dynamic from the ground class Node2D : public Node { godot/node2d.hpp GDCLASS(Node2D, Node); void set_rot(float p_angle); float get_rot() const; ... void _bind_methods() { ClassDB::bind_method(D_METHOD("get_rot"), &Node2D::get_rot); ClassDB::bind_method(D_METHOD("set_rot", "degrees"), &Node2D::set_rot); ... } } # C++ static traditional way # C++ Dynamic
    [Show full text]
  • Micropython Documentation Release 1.10 Damien P. George, Paul
    MicroPython Documentation Release 1.10 Damien P. George, Paul Sokolovsky, and contributors Jan 25, 2019 CONTENTS 1 MicroPython libraries 1 1.1 Python standard libraries and micro-libraries..............................2 1.1.1 Builtin functions and exceptions................................2 1.1.2 array – arrays of numeric data................................5 1.1.3 cmath – mathematical functions for complex numbers....................5 1.1.4 gc – control the garbage collector...............................6 1.1.5 math – mathematical functions................................7 1.1.6 sys – system specific functions................................9 1.1.7 ubinascii – binary/ASCII conversions........................... 11 1.1.8 ucollections – collection and container types...................... 11 1.1.9 uerrno – system error codes................................. 12 1.1.10 uhashlib – hashing algorithms............................... 13 1.1.11 uheapq – heap queue algorithm................................ 14 1.1.12 uio – input/output streams................................... 14 1.1.13 ujson – JSON encoding and decoding............................ 16 1.1.14 uos – basic “operating system” services............................ 16 1.1.15 ure – simple regular expressions............................... 20 1.1.16 uselect – wait for events on a set of streams........................ 22 1.1.17 usocket – socket module................................... 23 1.1.18 ussl – SSL/TLS module................................... 28 1.1.19 ustruct – pack and unpack
    [Show full text]
  • Sistema Basado En Tecnología 5G De Monitorización Psicoacústica Del Paisaje Sonoro En Smart Cities Con Offloading Computacional Dinámico En El Edge
    SISTEMA BASADO EN TECNOLOGÍA 5G DE MONITORIZACIÓN PSICOACÚSTICA DEL PAISAJE SONORO EN SMART CITIES CON OFFLOADING COMPUTACIONAL DINÁMICO EN EL EDGE Jaume Segura-Garcia1, Santiago Felici-Castell1, Jose M. Alcaraz Calero2, Qi Wang2, Jesús López-Ballester1, Rafael Fayos-Jordán1, Juan J. Pérez-Solano1, Miguel Arana-Burgui3 1 Dpt Informàtica, ETSE – Universitat de València {e-mail: [email protected], [email protected], [email protected], [email protected], [email protected]} 2 School of Computing, Engineering and Physical Sciences – University of the West of Scotland 3 INAMAT – Universidad Pública de Navarra, Spain Resumen En las tecnologías de próxima generación, el control de las molestias por ruido ambiental en una Smart City debería ser lo más eficiente posible. Los sistemas IoT sobre tecnologías 5G ofrecen una gran oportunidad para hacer offloading del cómputo en los nodos sensores, ya que proporciona una serie de nuevos conceptos para el cómputo dinámico que las tecnologías anteriores no ofrecían. En este artículo, se ha implementado un sistema IoT completo basado en tecnología 5G para la monitorización psicoacústica utilizando diferentes opciones para descargar el cómputo a diferentes partes del sistema. Esta descarga se ha realizado mediante el desarrollo de diferentes splittings funcionales de los algoritmos de cálculo de las métricas psicoacústicas. Por último, se muestra una comparación del rendimiento entre los diferentes splittings funcionales y su aplicación con un análisis detallado. Palabras clave: 5G LTE-M1, psicoacústica, monitorización del soundscape, splitting funcional, Smart City. Abstract In the next generation technologies, the environmental noise nuisance monitoring in a Smart City should be as much efficient as possible. 5G IoT systems offer a big opportunity to offload the computation from the sensor nodes, since it provides a series of new concepts for dynamic computing that the previous technologies did not offer.
    [Show full text]
  • Release 1.9.2 Damien P. George, Paul Sokolovsky, and Contributors
    MicroPython Documentation Release 1.9.2 Damien P. George, Paul Sokolovsky, and contributors August 23, 2017 CONTENTS 1 Quick reference for the WiPy1 1.1 General board control (including sleep modes).............................1 1.2 Pins and GPIO..............................................1 1.3 Timers..................................................1 1.4 PWM (pulse width modulation).....................................2 1.5 ADC (analog to digital conversion)...................................2 1.6 UART (serial bus)............................................2 1.7 SPI bus..................................................2 1.8 I2C bus..................................................3 1.9 Watchdog timer (WDT).........................................3 1.10 Real time clock (RTC)..........................................3 1.11 SD card..................................................4 1.12 WLAN (WiFi)..............................................4 1.13 Telnet and FTP server..........................................4 1.14 Heart beat LED..............................................4 2 General information about the WiPy7 2.1 No floating point support.........................................7 2.2 Before applying power..........................................7 2.3 WLAN default behaviour........................................7 2.4 Telnet REPL...............................................7 2.5 Local file system and FTP access....................................7 2.6 FileZilla settings.............................................8 2.7 Upgrading
    [Show full text]
  • Building Micropython with KEIL and Programming with Python on I.MX RT1050/1060 Rev
    AN13242 Building Micropython with KEIL and Programming with Python on i.MX RT1050/1060 Rev. 0 — 27 April, 2021 Application Note Contents 1 Introduction 1 Introduction......................................1 This application note introduces the porting of MicroPython, the packaging of 2 Hardware platform...........................1 2.1 i.MX RT1050/60 crossover peripheral functions, and the adaptation of circuit boards, using the example process........................................ 1 of our work on the i.MX RT1050/1060EVK development board. The code are 2.2 i.MX RT1050/60 EVK board........ 1 mainly written in C language, but are presented to the users as Python modules 3 Micropython.....................................2 and types. You can either evaluate and use MicroPython on this development 3.1 Brief introduction to Python board, or use it to port and adapt your new board design. MicroPython’s native Language.....................................2 project management and build environment is based on GCC and Make under 3.2 Brief introduction to Micropython Linux. To facilitate the development habits of most MCU embedded engineers, .....................................................3 the development environment is also ported to Keil MDK5. 4 Building and running Micropython on i.MX RT1050/1060 EVK.................. 3 The readers are expected to have basic experience of development with KEIL 4.1 Downloading source code........... 3 MDK, knowing what is CMSIS-Pack, the concept of target in KEIL and how to 4.2 Opening project with KEIL
    [Show full text]
  • Or How to Avoid Recoding Your (Entire) Application in Another Language Before You Start
    Speeding up Python Or how to avoid recoding your (entire) application in another language Before you Start ● Most Python projects are “fast enough”. This presentation is not for them. ● Profle your code, to identify the slow parts AKA “hot spots”. ● The results can be surprising at times. ● Don’t bother speeding up the rest of your code. Improving your Python ● Look into using a better algorithm or datastructure next. ● EG: Sorting inside a loop is rarely a good idea, and might be better handled with a tree or SortedDict. Add Caching ● Memorize expensive-to-compute (and recompute) values. ● Can be done relatively easily using functools.lru_cache in 3.2+. Parallelise ● Multicore CPU’s have become common. ● Probably use threading or multiprocessing. Threading ● CPython does not thread CPU-bound tasks well. ● CPython can thread I/O-bound tasks well. ● CPython cannot thread a mix of CPU-bound and I/ O-bound well. ● Jython, IronPython and MicroPython can thread arbitrary workloads well. ● Data lives in the same threaded process. This is good for speed, bad for reliability. Multiprocessing ● Works with most Python implementations. ● Is a bit slower than threading when threading is working well. ● Gives looser coupling than threading, so is easier to “get right”. ● Can pass data from one process to another using shared memory. Numba ● If you’re able to isolate your performance issue to a small number of functions or methods (callables), consider using Numba. ● It’s just a decorator – simple. ● It has “object mode” (which doesn’t help much), and “nopython mode” (which can help a lot, but is more restrictive).
    [Show full text]