HAL-Bus SPI Exclusive Device Unsatisfied Traits
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- rust
- Domain
- embedded-iot
Research direction
Reproduce the failure from examples/tiva-c-connected-launchpad/examples/spi_hello.rs, then inspect embedded-hal-bus-0.1.0/src/spi/exclusive.rs and the tm4c129x_hal SPI implementation. Trace the required blocking SPI Write and Default trait bounds and compare them with the HAL's implemented traits. Done means identifying which component causes the mismatch and documenting or correcting the compatible trait usage.
Written by the indexing model from the issue text.
Description
Good morning,
I am trying to understand if the unsatisfied traits error I am receiving in my implementation is due to an error in my implementation, the platform HAL package, or the underlying embedded HAL code.
I am trying to use the embedded_hal_bus ExclusiveDevice struct to wrap an SPI bus into an SPI device.
The SPI bus I have initialised using the platform HAL package (tm4c129x_hal):
let mut spi0 = hal::spi::Spi::spi0(
p.SSI0,
(
porta
.pa2
.into_af_push_pull::<hal::gpio::AF15>(&mut porta.control),
porta
.pa5
.into_af_push_pull::<hal::gpio::AF15>(&mut porta.control),
porta
.pa4
.into_af_push_pull::<hal::gpio::AF15>(&mut porta.control),
),
hal::spi::MODE_0,
1_u32.mhz(),
&clocks,
&sc.power_control,
);
I'm then wrapping that up in the ExclusiveDevice object (cs0 is just a normal GPIO pin in output mode).
let mut spi0_dev0 = ExclusiveDevice::new_no_delay(
&spi0, cs0
);
However, this won't compile when I try to use the write() method of the ExlusiveDevice object. (message is a Vec of bytes).
error[E0599]: the method `write` exists for struct `ExclusiveDevice<&Spi<SSI0, (PA2<AlternateFunction<AF15, ...>>, ..., ...)>, ..., ...>`, but its trait bounds were not satisfied
--> examples/tiva-c-connected-launchpad/examples/spi_hello.rs:67:27
|
67 | let _ = spi0_dev0.write(message);
| ^^^^^ method cannot be called due to unsatisfied trait bounds
|
::: /home/***/.cargo/registry/src/index.crates.io-6f17d22bba15001f/embedded-hal-bus-0.1.0/src/spi/exclusive.rs:19:1
|
19 | pub struct ExclusiveDevice<BUS, CS, D> {
| --------------------------------------
| |
| doesn't satisfy `_: Default<_>`
| doesn't satisfy `_: _embedded_hal_blocking_spi_Write<_>`
|
= note: the full type name has been written to '.../target/thumbv7em-none-eabihf/debug/examples/spi_hello-b9cc2dd24018ba0e.long-type-5094367532974101285.txt'
= note: the following trait bounds were not satisfied:
`ExclusiveDevice<&tm4c129x_hal::spi::Spi<tm4c129x_hal::tm4c129x::SSI0, (PA2<AlternateFunction<AF15, PushPull>>, PA5<AlternateFunction<AF15, PushPull>>, PA4<AlternateFunction<AF15, PushPull>>)>, PA6<Output<PushPull>>, NoDelay>: embedded_hal::blocking::spi::write::Default<_>`
which is required by `ExclusiveDevice<&tm4c129x_hal::spi::Spi<tm4c129x_hal::tm4c129x::SSI0, (PA2<AlternateFunction<AF15, PushPull>>, PA5<AlternateFunction<AF15, PushPull>>, PA4<AlternateFunction<AF15, PushPull>>)>, PA6<Output<PushPull>>, NoDelay>: tm4c129x_hal::prelude::_embedded_hal_blocking_spi_Write<_>`
What I can't work out is what needs to be changed so that the trait bounds are satisfied. Can anyone shed some light?
- Dominant language
- Rust
- Stars
- 2.7k
- Forks
- 282
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from rust-embedded/embedded-hal
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
rust-embedded/embedded-hal#742 · 1 comment ·
-
Difficulty 5/5 Over a week Newbie friendliness 30/100
rust-embedded/embedded-hal#747 · 5 comments · 1 reaction ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
rust-embedded/embedded-hal#746 · 2 comments · 1 reaction ·
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
rust-embedded/embedded-hal#745 · 1 reaction ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 55/100
rust-embedded/embedded-hal#744 · 1 comment ·
All issues in rust-embedded/embedded-hal
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
kwakseongjae/auto-hwp#319 ·
-
area:cli bug filter-quality good first issue priority:medium
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
bevyengine/bevy#25861 ·
-
comp-datalake
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
ClickHouse/ClickHouse#121222 ·
-
enhancement remote
Difficulty 2/5 1-3 hours Newbie friendliness 68/100