ESP32 Bit Pirate home
  • Bytecode
  • Intermediate
  • 5 min
  • I2C / SPI / UART

Recipe · Intermediate · Instructions

How to use bytecode instruction syntax

The instruction parser lets you express small write/read/delay sequences directly at the prompt. It is useful for probing simple transactions before writing firmware code.

Protocol lab with bus signals and command blocks.
Instructions are parsed into byte-level actions such as write, read and delay.
Step 1

Commands

Start with examples documented in the wiki: a SPI JEDEC read, a write/read UART probe, and explicit delays.

Result

What it means

If [0x9F r:3] returns three bytes from a SPI flash, the wiring and SPI mode are good enough for a first transaction.

Troubleshooting

  • Using unsupported syntax such as loops, nested brackets or bit-level operations.
  • Using single quotes for a multi-character string instead of double quotes.
  • Running a sequence in a mode that does not execute all parsed bytecodes yet.
  • Forgetting to configure pins before the instruction.

Next steps

  • Use [0x9F r:3] as the minimal SPI flash sanity check.
  • Use ["AT" D:1 r:64] as a short UART probe.
  • Move repeated sequences into a dedicated controller or script once the transaction is known.

Bytecode instruction FAQ

When should I use bytecode instructions?

Use bytecode for small transactions where you need explicit writes, reads and delays at the prompt. It is useful for quick SPI, I2C or UART probes before writing a larger script.

Why start with a short instruction?

Short instructions are easier to verify and less likely to hide a wrong mode, pinout or chip-select setting. Confirm a small response before building a longer transaction.

Can bytecode replace a protocol-specific shell?

Not always. Bytecode is precise and flexible, but protocol shells often know chip geometry, addressing rules or safer defaults. Use the dedicated shell when it exists for the device family.

Go deeper