Skip to content

Changing bit shift order of spidriver #24

@boxofrox

Description

@boxofrox

I'm using the spidriver to interface with a PN532 NFC module. The former uses most-significant bit (MSB) first shifting while the latter uses least-significant bit (LSB) first shifting on the SPI bus.

It seems from the datasheet for the spidrivers microcontroller, the hardware SPI shift order can be configured, and would be a nice feature to have.

Unfortunately, I don't know Forth to implement a PR. Instead, I've modified the spicli tool [1] to add "lsb" and "msb" commands to reverse the bits in bytes before transmitting and after receiving, and it works well enough that writing shell scripts against spicli remains clean and readable.

[1]: https://github.com/boxofrox/spidriver/tree/feature/bit-shift-order

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions