
Deep Dive w/Scott: Raspberry Pi CircuitPython speedup and SD card #adafruit
Scott recaps work on the Raspberry Pi running CircuitPython and then continues working on SD card support.
Visit the Adafruit shop online - http://www.adafruit.com
Chat with me and a lot of others on the Adafruit Discord at https://adafru.it/discord.
Deep Dive happens every week. Next week is on Friday at 2pm Pacific.
0:00 Getting Started
09:32 Housekeeping
13:00 Raspberry Pi Zero 2 W discussion
19:50 raspberry pi .org vs. .com
20:51 Dune and DOS
21:49 USB Host and Tiny USB
23:07 Edit code on a Pi over BLE
23:38 working on Pi 400 steps to figure out
24:14 Pi-DOS project mention
26:00 Glasses come off / glasses setup
27:00 Pi Zero - epic for CP with .5 GB RAM
29:00 Zero 2 is the ultimate board for CP!!!
29:50 Review last week’s status -
30:00 Now Tac has High Speed working
31:08 Last week - HDMI was very slow - investigate caches off/on
31:38 Not caching “enough”
32:48 Scrolling demo, much faster than last week, caching on for everything
33:42 Tweek resolution
34:00 “what is CP”
35:15 Still Broadcom chip
36:14 Flash speed vs. run from RAM
37:37 once I get the SD card working, there will be some re-organization for all the boards
38:20 experiment with screen resolutions, to demo refresh performance
40:17 640x480 REPL - pretty quick
42:00 1080p seems blurry
43:10 Are there any plans to make this a simpler process, eg moving it to a Java IDE?
Suggested https://codewith.mu/
45:10 check out visual studion circuitpython plugin
47:11 Python 3.10 has deprecated “distutils”. Spent my day on that for Yocto Project. It’s nice to not need to worry with CP
48:00 rebooted to ‘lower’ resolution
48:30 flash wear discussion Nand flash, Nor flash, flash protocol
49:36 Should you have some knowledge of Python before learning Circuit Python?
50:00 Pi4 is ARM64....so theoretically you could port CPY to the M1 chip
50:32 core of CP is just like Python
50:57 SD Cards technical proprietary, but …
51:27 Why use bare-metal CP over blinka ( ease of setup, just does one thing )
52:20 Implementation
53:11 adafruit_sdcard.py - SPI 1, 4 or 8 bits at a time
54:15 here is a lot of IO stuff that you couldn't do under a Linux kernel like bitbanging is quite hard/limited in a non realtime OS
55:16 raspi3-tutorial / 0B_readsector / sd.c
56:39 habits that lead to more reusable code :-)
57:04 declaring 5 global variables on one line with no comments
57:37 SBD generated structs vs.
58:05 multiple things on one line - suggest using curly braces freely
59:00 initializing some but not all variables ( on one line )
59:26 ‘weird’ globals
59:39 q:is there a native async library in circuitpython? I found a library called "asynccp" it works for me now but it would be better to use the native way.
1:01:04 use single letter variables sparingly
1:02:06 perhaps run it through a formatter
1:02:18 “I still don’t know what this code does” :-)
1:02:55 consider naming style for global variables
1:03:15 ‘circle’ reference gighub rsta2/circle - well commented
1:04:10 check out the license
1:06:04 sdcard.org PDFs
1:06:44 Scott’s Pi Zero arrives on Monday!
1:08:11 640x480 HDMI raspberry pi bare metal REPL demo - last piece is SD card reading in CP - connect to USB mass storage
1:09:40 goal: read SD card over USB
1:10:29 Exception levels - switch from EL2 to EL1 ( os exception level ) CP is running EL1
1:12:00 Waiting for high speed to be merged into tiny USB
1:12:40 HDMI output used for display IO
1:14:40 Looking at board.c in CP ports/broadcom/boards/PI4
1:15:15 sdioio API
1:15:35 “with this big chonky font, CP needs to implement CBM ASCII to get cool map-building "letters"”
1:15:42 detour - fantasy console - mimic but modernize
1:16:34 nerd fonts project (nerdfonts.com)
1:18:00 Does circuitpython use Unicode strings?
1:18:14 Twitter emojis opensourced twitter/twemoji
1:19:44 displayio doesn't display it yet - though emoji variable names do
1:24:30 in cpython you can only use unicode characters in variable names if the belong to the "letter" class, so you can do accented characters, or Chinese, or Hebrew, but not emoji
1:25:37 back to sdioio/SDCard.c
1:27:54 second argument to SD send command - refer to adafruit_sdcard.py
1:30:50 SD Specs - commands , and back to adafruit_sdcard.py
1:39:03 bztsrc/raspi3-tutorial 0B_readsector/sd.c sd_cmd() / 32-bit commands vs BCM2835 ARM Peripherals.docx
1:41:21 Q: been experimenting with the sdcard module on circuitpython but it stops the code if there is no card in the reader
1:42:36 consider the response type ( number of bits )
1:43:54 sdioio/SDCard.h
1:45:03 sdcard.org Part1_Physical_Layer_Simplified_Specification_Ver800.pdf r2 response codes
1:48:57 autogenerated SVD generated file bcm2711_ipa.h
1:52:45 sdcard.org Design Guide « Whitepaper » is a pretty cool resource. https://www.sdcard.org/cms/wp-content/uploads/2020/11/SD_Express_Design_Guide.pdf
2:04:00 CM4 Appendix B - ordering codes ( wireless, eMMC, RAM )
2:06:15 Wrap up - next week Pi Zero on Friday
2:09:35 have a great weekend
Other Videos By Adafruit Industries
Other Statistics
Counter-Strike: Source Statistics For Adafruit Industries
Adafruit Industries presently has 14,378 views for Counter-Strike: Source across 11 videos, and about 7 hours worth of Counter-Strike: Source videos were uploaded to his channel. This is less than 0.22% of the total video content that Adafruit Industries has uploaded to YouTube.