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

stm32f103 usb doenst work #521

Open
blackdllx opened this issue Dec 17, 2024 · 0 comments
Open

stm32f103 usb doenst work #521

blackdllx opened this issue Dec 17, 2024 · 0 comments

Comments

@blackdllx
Copy link

usb example compiles with errors

error[E0308]: mismatched types
   --> src/main.rs:60:38
    |
60  |     let mut serial = SerialPort::new(&usb_bus);
    |                      --------------- ^^^^^^^^ expected `&UsbBusAllocator<_>`, found `&UsbBusAllocator<UsbBus<...>>`
    |                      |
    |                      arguments to this function are incorrect
    |
    = note: `UsbBusAllocator<UsbBus<...>>` and `UsbBusAllocator<_>` have similar names, but are actually distinct types
note: `UsbBusAllocator<UsbBus<...>>` is defined in crate `usb_device`
   --> /home/soda/.cargo/registry/src/index.crates.io-6f17d22bba15001f/usb-device-0.2.9/src/bus.rs:149:1
    |
149 | pub struct UsbBusAllocator<B: UsbBus> {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: `UsbBusAllocator<_>` is defined in crate `usb_device`
   --> /home/soda/.cargo/registry/src/index.crates.io-6f17d22bba15001f/usb-device-0.3.2/src/bus.rs:152:1
    |
152 | pub struct UsbBusAllocator<B: UsbBus> {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: perhaps two different versions of crate `usb_device` are being used?
note: associated function defined here
   --> /home/soda/.cargo/registry/src/index.crates.io-6f17d22bba15001f/usbd-serial-0.2.2/src/serial_port.rs:49:12
    |
49  |     pub fn new<'alloc: 'a>(
    |            ^^^

error[E0308]: mismatched types
   --> src/main.rs:62:45
    |
62  |     let mut usb_dev = UsbDeviceBuilder::new(&usb_bus, UsbVidPid(0x16c0, 0x27dd))
    |                       --------------------- ^^^^^^^^ expected `&UsbBusAllocator<_>`, found `&UsbBusAllocator<UsbBus<...>>`
    |                       |
    |                       arguments to this function are incorrect
    |
    = note: `UsbBusAllocator<UsbBus<...>>` and `UsbBusAllocator<_>` have similar names, but are actually distinct types
note: `UsbBusAllocator<UsbBus<...>>` is defined in crate `usb_device`
   --> /home/soda/.cargo/registry/src/index.crates.io-6f17d22bba15001f/usb-device-0.2.9/src/bus.rs:149:1
    |
149 | pub struct UsbBusAllocator<B: UsbBus> {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: `UsbBusAllocator<_>` is defined in crate `usb_device`
   --> /home/soda/.cargo/registry/src/index.crates.io-6f17d22bba15001f/usb-device-0.3.2/src/bus.rs:152:1
    |
152 | pub struct UsbBusAllocator<B: UsbBus> {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: perhaps two different versions of crate `usb_device` are being used?
note: associated function defined here
   --> /home/soda/.cargo/registry/src/index.crates.io-6f17d22bba15001f/usb-device-0.3.2/src/device_builder.rs:85:12
    |
85  |     pub fn new(alloc: &'a UsbBusAllocator<B>, vid_pid: UsbVidPid) -> UsbDeviceBuilder<'a, B> {
    |            ^^^

Some errors have detailed explanations: E0308, E0463.

Cargo.toml

[package]
name = "rusty-blink"
version = "0.1.0"
edition = "2021"

[dependencies]
cortex-m = {version="0.7.1", features=["critical-section-single-core"] }     # Access to the generic ARM peripherals
cortex-m-rt = "*"  # Startup code for the ARM Core
cortex-m-semihosting = "0.5.0"
panic-semihosting = "0.6.0"
embedded-hal = "1.0"  # Access to generic embedded functions (`set_high`)
nb = "1.1"
rtt-target = {version="0.6", features=["defmt"]}
usb-device = "0.3.1"
usbd-serial = "0.2.2"
stm32-usbd="0.6.0"
embedded-io="0.6.1"
vcell = "0.1.2"


[dependencies.stm32f1xx-hal]
features = ["stm32f103", "stm32-usbd", "rt", "medium"]
version = "0.10.0"
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

1 participant