Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shared SPI bus between devices with different SPI modes #608

Open
dan-corneanu opened this issue Jun 16, 2024 · 2 comments
Open

Shared SPI bus between devices with different SPI modes #608

dan-corneanu opened this issue Jun 16, 2024 · 2 comments

Comments

@dan-corneanu
Copy link

dan-corneanu commented Jun 16, 2024

I have a small board that has 2 devices attached to the same SPI bus

  • AD9833 DDS that uses SPI MODE 2
  • MCP41010 Digital Potentiometer that can use SPI MODE 0 or MODE 3

Each device has its own CS pin.

I am using the following two drivers

The problem that I am facing is that my program can only communicate with one of the devices because
the SpiDevice can not change the mode of the SpiBus.

I think this design decision was discussed back in 2022 in this comment #351 (comment).

Could you please advise on how I could address this problem in my code?

If interested in the code of my application you can have a look at this branch https://github.com/dan-corneanu/ad983x_signal_generator/tree/features/configure_ushell.

@eldruin
Copy link
Member

eldruin commented Jun 21, 2024

At the moment this must be implemented in a HAL-specific way. The difficulty will depend on the HAL you are using (I cannot access your application repo) but it will probably involve rewriting a bit of embedded-hal-bus so that when a device is activated, the bus is reconfigured.

@dan-corneanu
Copy link
Author

Have made it public.

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

No branches or pull requests

2 participants