How simplified is good enough ... ?Or maybe make a simplified schematic public, and see what the community can do next?
Code:
.---. .----------------. .---. _ _+8V )----|REG|--. N/C -| USB+ |====| ? |====|_| |GND )-. `-.-' | N/C -| USB- |== `---' ==|_| | 4 x | | | | |== .---. ==|_| | Lego }----' | .---------| SWDIO |====| ? |====|_| _| | .-------' | .-------| SWCLK | `---' | | | | | | | | | | .----| RX UART | .-------. | | .-> 3V3 | | | .--| TX UART RUN |====| Flash | | | | O O | | `------------.---' `-------' | | | | | | o o o o o o o o o o o o o o o o o o o o o o o o |_______________________________________________| 40-way GPIO Header - Not shown in pin order
I am not actually familiar with the Build HAT, am only on the same page as I was looking for a HAT which had an RP2040 on-board and it caught my eye and intrigued me -- And the verdict there is a WaveShare RP2040-PiZero, StackyPi, HAT 2040 or similar would make more sense.
It seems to me there's the BHBL, Build HAT Boot Loader, which is held in Flash which you can communicate with over UART serial, upload 'firmware.bin' into RAM. That then runs and controls Lego devices according to further commands sent over UART serial, with Pi-side Python code calling a library which talks to the RP2040.
I'm even less familiar with PyBricks but I would guess that if you can produce a Python library and your own RP2040 based code you can implement what you need.
The main problem you have is that your RP2040 code, 'your-firmware.bin', will not be loaded by BHBL unless you can produce a valid 'your-signature.bin'.
You could however create a replacement Boot Loader which will load 'your-firmware.bin' without needing a signature.
The challenge there is in getting your Boot Loader into the RP2040 Flash in the first place. SWD is exposed on pads but AIUI not connected to the GPIO header.
For the experts, adding wires to SWD or linking SWD to the GPIO header will get you all you would need to burn and use your own Boot Loader. For others that's not so great.
If you can determine how 'your-signature.bin' needs to be generated you can burn a new Boot Loader via 'your-firmware.bin' using BHBL, but there's no need to as you'll know how to get BHBL to load 'your-firmware.bin' anyway; no need to modify the Build HAT or re-flash the RP2040 at all.
So that's the only obstacle or challenge to doing whatever you want with the Build HAT. Plus writing whatever you need to write for PyBricks to work.
Statistics: Posted by hippy — Thu Aug 08, 2024 4:42 pm