Deep Dive w/Scott: Pi Zero 2W + CircuitPython #adafruit
Channel: Adafruit Industries
Date: 05/11/2021

Join Scott today as he gets CircuitPython going on the Raspberry Pi Zero 2W. Visit the Adafruit shop online - http://www.adafruit.com

0:00 Getting Started
0:00:45 hello
0:03:34 working on bare metal Circuit Python (CP) on raspberry pi
0:04:30 USB issues (dmesg) on Scott’s linux computer
0:05:30 Comparing M1 Mac vs. Desktop computer
0:07:01 Housekeeping / Intro
0:08:30 Next week - Friday, taking Thanksgiving weekend off 
0:09:25 Tom’s Hardware Pi Cast next Tuesday 11:30 AM Pacific Time
0:11:50 SD card library search and progress ongoing
0:16:15 Ethernet / NetBoot ( SD card boot is more reliable )
0:17:10 Q: What would you recomend for recording data from 9DOF IMU sensor. Maybe Pi Zero or Pico or is Arduino Uno or Nano better for this
0:18:23 netboot over TFTP
0:20:01 Using the SparkFun SD card breakout
0:20:49 switch to desktop - attempt to use netboot
0:21:40 Do you have any recommendations for making string formatting a bit faster in CircuitPython code? Or is it just one of those convenient things that takes a ton of cycles no matter what?
0:22:30 f-strings on CP just get translated to format()
0:24:05 To the comment on Twitter. Seeing Circuit Python written in Rust at some point would be fun. Getting it running on an Raspberry Pi would also be fun. Calling it RPy would be full circle on many levels
0:26:18 highpoint technology 4-port USB  RocketU 1244A
0:28:22 switching configuration to Pi-Zero ( no HMI USB adapter today )
0:30:14 Zero-2  with Debug ‘hat’, and power supply
0:33:15 Start with Pi-4, then Zero 2, then the other architectures
0:34:20 starting with 64 bit builds - others might need to switch compilers
0:35:40 the main problem is having the USB broken out directly
0:37:11focus on the build process - make  * zero2w *
0:38:05 Q:If the Zero is supported, would the RPi Model B (w/256mb) be supported since they use the same SoC?
0:40:33 boot and LED
0:41:55 If the Zero is supported, would the RPi Model B (w/256mb) be supported since they use the same SoC?
0:43:40 dig into OpenOCD and Pi
0:47:10 install lsof to see which process is using port 
0:49:00 source tinyusb gdbinit
0:49:20 system timer is not working
0:51:06 Jinja built on top of SVD
0:53:10 Pin muxing in gen_svd.py - bcm2837_lpa.svd 
0:54:16 update peripheral addresses - 2837 base address ultibo.org
0:55:17 base address is mapped
0:58:03 generate svd files and headers - 42,000 line xml file 
0:58:31 generates bcm2837_lpa.h 
0:59:37 svn_load peripherals/svd/gen/bcm2837_lpa.scd ( in gdb )
1:00:31 svd UART1  to read memory
1:01:10 I’d like to drive HDMI or DisplayPort from the FPGA fabric (This part I’m pretty good at) and run CircuitPython from the HPS (There it’s over my head…).
1:04:37 Note: time zone change next week here in the USA
1:07:17 bcm2835-peripherals map physical
1:07:59 raspi3-tutorial 07 delays 
1:08:59 MMIO BASE should be correct
1:09:40 let’s just see if it works … 
1:11:37 include appropriate file based on BCM_VERSION ( 2837 vs. 2711 )
1:12:43 add BCM_VERSION to Makefile
1:13:37 use rg to search for includes of bcm2711_lpa.h that need to be updated
1:18:57 now only defines.h includes it
1:19:50 generated file is “empty” - ??
1:20:22 rebuilding
1:21:00 free running counter doesn’t seem incrementing
1:23:42 back to the memory map
1:24:40  totally off topic Q... in CPY/MPY, when using MP_DEFINE_CONST_FUN_OBJ_KW with 1-7 kwargs, how do I determine which were actually set? I want to update members of a struct, but only the ones that were passed in. I have it working, but it stomps all with the default const if that kwarg was not passed.
1:26:50 How does one ask the MMU what physical address it is reading?
1:29:30 uart output? ( garbage, but at least it is something )
1:31:54 mailbox call to set clock 
1:33:49 look how others ( tutorial etc) set clock
1:36:00 try adjusting the clock frequency
1:38:26 boot messages - readable now!
1:41:27 openocd - HardFalt handlers
1:41:57 How much memory do we “really” have ?
1:42:36 The bootloader is closed-source but there are a few stubs available 
1:43:52 check how the memory is set up in the MMU
1:52:24 wrap up memory addressing in mmu.c
1:54:00 reboot with changes - to REPL !!!  ( output looked good -then crashed )
1:57:05 consider the interrupt stuff ( may be wrong )
2:00:08 next: edit interrupts.c ( handle_irq ) for zero
2:01:43 - see github
2:07:57 housekeeping and wrap up - USA changes time zone this weekend
2:09:54 Pi Cast next Tuesday
2:10:32 cat cam
2:11:12 have a great weekend!

-----------------------------------------
LIVE CHAT IS HERE! http://adafru.it/discord

Adafruit on Instagram: https://www.instagram.com/adafruit

Subscribe to Adafruit on YouTube: http://adafru.it/subscribe

New tutorials on the Adafruit Learning System: http://learn.adafruit.com/
-----------------------------------------