Dumb question time - Would this protocol buffer benefit the MicroPython implementation in any way?
There has been big movement on the binmodes, but the documentation has not caught up. I will get that out this week.
So, the new Bus Pirates actually support multiple binary interface modes. The v3.x was really tricky and managed to support multiple protocols from a single interface, but over time that got messy.
In the latest firmware, use the binmode
command to select the exposed interface. Currently there are binmodes for logic analyzing, a debug mode, and some other odds and ends.
A couple weeks ago @dreg added a v3.x compatibility layer binmode that can handle, I believe, SPI at the moment with I2C possible in the future. It works with flashrom and avrdude. Maybe it will be useful to your existing scripts?
Hi! I’m interested in interfacing with binary modes, but I don’t have clear references for sample code or documentation.
My use case is an automated application where I use BP to proxy an I2C communication. My preliminary approach would be this:
- connect to first serial console, send the I2C mode command and other configuration (pull ups/power), then issue the
binmode
command - connect to the second serial console and send the commands for querying I2C registers and/or setting them
I’d wish to be able to implement this as much as possible via machine interface as parsing the first serial console data could be painful (escape codes, etc…), therefore shifting features towards 2. rather than 1. is preferred.
Pointers welcome. Thanks!
In general, binmode is set in the user terminal with the binmode command, then all configuration is done on the second serial port. Binmode command usually totally resets the Bus Pirate (except in the case of the logic analyzers).
@Dreg made a compatibility layer for the old Bus Pirate BBIO1 mode. It has spi but also I think it may have I2C. I’m not sure, we can ask dreg. The docs for the old BBIO1 binmode are here.
The legacy binary SPI mode is still pretty beta and “hacky” . I’ve just done the bare minimum to make flashrom and avrdude work—it has some hacks, and well… it’s a bit of a mess. I’ll improve it gradually.
My next goal is to get Binmode-legacy-PIO-I2C-mode working—let’s see if I can pull it off!
Honestly, @raul-klg, I think new devs and scripters should focus on the binary modern mode that @ian is developing and, most importantly, give us feedback on what you need so we can improve it.
I don’t recommend using the legacy binmode yet.
Thanks all!.
So I will lean towards BBIO2. Is there any place where I can get info about the proto details or a code sample?
Also, what is the :q!
for exit binmode?
For legacy-bin-mode: re-connect usb. (I am making an exit way)
Thanks again. I cannot pull usb connector, therefore I looked into the firmware code where I saw a BM_RESET_BUSPIRATE
identified command. Depending on the firmware version this value is 27(0x1b) or 28(0x1c).For the sake of completeness, I scripted it like this:
echo -en "\x00\x00\x00\x00" > /dev/serial/by-id/usb-Bus_Pirate_Bus_Pirate_5_XXXXXXXXXXXX-if02
echo -en "\x1b" > /dev/serial/by-id/usb-Bus_Pirate_Bus_Pirate_5_XXXXXXXXXXXX-if02