Deep Dive w/Scott: More USB Host API #adafruit
Join Scott as he answers questions and further discusses the USB Host API for CircuitPython.
Next week will be on Friday at 2pm Pacific and be the last stream with Scott as host for a while. Foamyguy will stream in the time slot starting in two weeks.
Join the Discord at https://adafru.it/discord
All notes for Deep Dives are available at https://github.com/adafruit/deep-dive-notes
0:00 Getting Started
6:15 Let’s get the show on the road…
8:22 next week - last deep dive before taking leave / foamyguy
9:20 deep dive notes on github https://github.com/adafruit/deep-dive-notes/
12:00 rock climbing shirt discussion
13:32 examples of interrupt usage in CircPy?
14:55 async io enabled in recent CP
16:50 let’s talk usbhost
18:00 Desktop notes from last week
21:15 Last weeks Ben Eater USB videos very helpful
22:00 Usb Host vs. Peripheral and TinyUSB TUD vs TUH D)evice, H)ost
24:27 So how does collision detection work on a USB bus? Do the devices just not communicate until the host asks it for a data packet?
26:06 speed - see Jan Axelson’s USB Complete book
29:00 Linux can do USB host / look at python for API ideas
30:00 PyUsb on github
33:06 "USB 3.0 suspends device polling, which is replaced by interrupt-driven protocol."
35:03 return to the Python USB api
35:40 SparkFun has a power delivery dev board.
36:00 pyOCD github ( uses pyUSB )
36:30 pyDFU ( uses usb.core and usb.util )
38:30 Chip Shortage is real :-(
38:56 Usb in a nutshell discussion https://www.beyondlogic.org/usbnutshell/usb4.shtml
41:10 blinka is also using pyusb (via pyftdi)
42:20 https://rpilocator.com/ and Octapart
43:50 endpoints vs. hubs
44:50 pyusb tutorial.rst on github
46:32 port.c shared-bindings / sublime merge diff
47:55 usb_host diffs PyUSB API compiles
51:05 circuitpy_defns.mk rules
52:58 __init__.c in shared-bindings/usb
53:35 Device.c
55:20 read size_or_buffer argument
56:04 shared bindings circuit python stub special processing “//|” prefix
57:25 added some type annotations and documentation near implementation
58:03 diff tools for mac users / sublime merge is supported on mac
59:48 https://www.git-tower.com/blog/diff-tools-mac/
1:01:32 back to the api usb_core_device_read to common_hal_usb_core_device_read
1:05:16 ctrl_transfer - either direction
1:08:10 mention of doxygen - “doxygen is used on all of our Arduino documentation. Sphinx on all the CP.”
1:09:07 detach_kernel_driver
1:10:12 still in Devie. Locals dict table
1:11:50 just found an IBM presentation called Documentation in the modern age that has a slide titled "Cool kids do Sphinx" and another titled "Cool kids used to do Doxygen"
1:13:20 shared modules - stubs
1:16:05 CP Pre-commit auto formatting
1:18:20 shell window - load code imx1060 dev board
1:20:03 get CP running on the dev board
1:21:40 Makefile for imx, compare to tinyUSB
1:28:52 pyocd prompts - ( after inition make -j 32 )
1:31:04 plug in another usb device - connect vi “tio”
1:32:25 import usb_host
1:32:50 dir(board)
1:34:35 nxp.com i.MX. RT1170 clocked at 1Ghz
1:36:31 i.MX RT Crossover MCUs
1:37:15 teensy 4.1 has a header for the second USB port
1:37:35 USB Host Cable
1:39:49 question about the new esp32 board
1:40:31 teensy 4.0 board has usb ports broken out on pads
1:41:16 i.MX RT1060 Evaluation Kit image of the “B” version (EVK vs EVKB)
1:42:25 regarding your keep host initialized on reboot: would the endpoints/pipes need to be re-initialized on reboot or would remain the state too?
1:43:30 Design resources / design files
1:44:25 download and look at sch-31358_a3 schematic / pinout
1:46:18 USB OTG2
1:46:28 pins.c USB_DP1, USB_DM1 (and DP2) pins
1:49:45 dm or dn? (pin names)
1:50:20 back to datasheet
1:51:05 Data Sheet ( also has 3522 page reference manuals )
1:52:20 looking for the “pad” name - try to match the data sheet
1:53:00 EVKB adds an M.2 connector for radios and other headers for audio and other expansion
1:54:30 I guess my question on pyusb is can we write a driver for the IntelliKeys that sends that EZUSB firmware at startup and then reads/writes like the driver GDSports wrote for Arduino on the M0?
1:55:05 How do we add a custom device?
1:55:52 ATMakers USB Host Mode conversation (youtube )
1:57:17 For the record, GDSports on GitHub did most of the USB Host work (I just got the original driver open sourced) There is a great teardown by @scanlime as well
1:58:30 OTG1_DN, DP name to match reference manual
1:59:11 what would happen if you connected a hub?
2:01:07 pin object on imx ( mcu_pin_obj_t ):
2:02:37 So, just to setup my weekend do you think if I get the IntelliKeys driver ported to CPython/pyusb I'll be on a useful path?
2:05:20 if the pins were not defined for device mode, why add them for host mode?
2:07:39 wrap up / next week with Scott, then foamyguy taking over
2:10:48 Pet the cat
2:11:34 have a good weekend everyone
Visit the Adafruit shop online - http://www.adafruit.com