Skip to content

Initial support for SPI BIDIR (3-wire)#181

Merged
Baldanos merged 3 commits intohydrabus:masterfrom
4z0x:spi_bidir
Dec 20, 2025
Merged

Initial support for SPI BIDIR (3-wire)#181
Baldanos merged 3 commits intohydrabus:masterfrom
4z0x:spi_bidir

Conversation

@4z0x
Copy link
Copy Markdown
Contributor

@4z0x 4z0x commented Dec 19, 2025

Initial support half-duplex bi-directionnal mode for SPI.

Added subcommand for BBIO. If the changes are OK I can update the wiki and pyHydrabus accordingly, just let me know.

Not tested on a real device yet, but seems to work between two Hydrabus in master-slave mode.

@Baldanos Baldanos merged commit 9f806c7 into hydrabus:master Dec 20, 2025
1 check passed
@Baldanos
Copy link
Copy Markdown
Collaborator

All good and merged, thanks !

Also please take some time to update the wiki ;)

proto->config.spi.dev_polarity = 0;
proto->config.spi.dev_phase = 0;
proto->config.spi.dev_bit_lsb_msb = DEV_FIRSTBIT_MSB;
proto->config.spi.dev_bidir = 0;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't bidir intended to be enabled by default in serprog mode?
Documentation of serprog protocol states that S_SPI_MODE command (0x17), have two available modes, and the 0x00 mode that means Half Duplex is default one.
Source: https://www.flashrom.org/supported_hw/supported_prog/serprog/serprog-protocol.html, and look for S_SPI_MODE command

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bidir uses only one data line compared to the usual two in SPI.

The two serprog modes are for deciding whether you can write and read data at the same time (ie. the same clock cycle).
That is handled by proto->config.wwr in Hydrafw SPI mode but the serprog S_SPI_MODE is currently not handled, as I have no device to test and validate this feature. If you have some, feel free to submit a PR adding this mode ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants