Skip to content

Commit

Permalink
Use log levels in the nRF52 Workshops.
Browse files Browse the repository at this point in the history
Also regenerated the trace files.
  • Loading branch information
jonathanpallant committed Dec 10, 2024
1 parent 6543e23 commit 016f19d
Show file tree
Hide file tree
Showing 21 changed files with 457 additions and 364 deletions.
91 changes: 45 additions & 46 deletions exercise-book/src/nrf52-usb-getting-device-configured.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,59 +49,58 @@ NOTE: On Windows, you may get a `GET_STATUS` request *before* the `SET_CONFIGURA

## Expected output

✅ Run the progam and check the log output.
✅ Run the program and check the log output.

Once you are correctly handling the `SET_CONFIGURATION` request you should get logs like these:

```console
INFO:usb_5 -- USB: UsbReset @ 397.15576ms
INFO:usb_5 -- USB reset condition detected
INFO:usb_5 -- USB: UsbEp0Setup @ 470.00122ms
INFO:usb_5 -- EP0: GetDescriptor { descriptor: Device, length: 64 }
INFO:dk::usbd -- EP0IN: start 18B transfer
INFO:usb_5 -- USB: UsbEp0DataDone @ 470.306395ms
INFO:usb_5 -- EP0IN: transfer complete
INFO:dk::usbd -- EP0IN: transfer done
INFO:usb_5 -- USB: UsbReset @ 520.721433ms
INFO:usb_5 -- USB reset condition detected
INFO:usb_5 -- USB: UsbEp0Setup @ 593.292235ms
INFO:usb_5 -- EP0: SetAddress { address: Some(21) }
INFO:usb_5 -- USB: UsbEp0Setup @ 609.954832ms
INFO:usb_5 -- EP0: GetDescriptor { descriptor: Device, length: 18 }
INFO:dk::usbd -- EP0IN: start 18B transfer
INFO:usb_5 -- USB: UsbEp0DataDone @ 610.260008ms
INFO:usb_5 -- EP0IN: transfer complete
INFO:dk::usbd -- EP0IN: transfer done
INFO:usb_5 -- USB: UsbEp0Setup @ 610.443113ms
INFO:usb_5 -- EP0: GetDescriptor { descriptor: DeviceQualifier, length: 10 }
WARN:usb_5 -- EP0IN: stalled
INFO:usb_5 -- USB: UsbEp0Setup @ 610.809325ms
INFO:usb_5 -- EP0: GetDescriptor { descriptor: DeviceQualifier, length: 10 }
WARN:usb_5 -- EP0IN: stalled
INFO:usb_5 -- USB: UsbEp0Setup @ 611.175535ms
INFO:usb_5 -- EP0: GetDescriptor { descriptor: DeviceQualifier, length: 10 }
WARN:usb_5 -- EP0IN: stalled
INFO:usb_5 -- USB: UsbEp0Setup @ 611.511228ms
INFO:usb_5 -- EP0: GetDescriptor { descriptor: Configuration { index: 0 }, length: 9 }
INFO:dk::usbd -- EP0IN: start 9B transfer
INFO:usb_5 -- USB: UsbEp0DataDone @ 611.846922ms
INFO:usb_5 -- EP0IN: transfer complete
INFO:dk::usbd -- EP0IN: transfer done
INFO:usb_5 -- USB: UsbEp0Setup @ 612.030027ms
INFO:usb_5 -- EP0: GetDescriptor { descriptor: Configuration { index: 0 }, length: 18 }
INFO:dk::usbd -- EP0IN: start 18B transfer
INFO:usb_5 -- USB: UsbEp0DataDone @ 612.365721ms
INFO:usb_5 -- EP0IN: transfer complete
INFO:dk::usbd -- EP0IN: transfer done
INFO:usb_5 -- USB: UsbEp0Setup @ 612.640378ms
INFO:usb_5 -- EP0: SetConfiguration { value: Some(42) }
INFO:usb_5 -- entering the configured state
```text
[DEBUG] Initializing the board (dk dk/src/lib.rs:312)
[DEBUG] Clocks configured (dk dk/src/lib.rs:330)
[DEBUG] RTC started (dk dk/src/lib.rs:349)
[DEBUG] I/O pins have been configured for digital output (dk dk/src/lib.rs:359)
[DEBUG] USB: UsbReset @ 00:00:00.324523 (usb_5 src/bin/usb-5.rs:56)
[WARN ] USB reset condition detected (usb_5 src/bin/usb-5.rs:60)
[DEBUG] USB: UsbEp0Setup @ 00:00:00.367462 (usb_5 src/bin/usb-5.rs:56)
[DEBUG] SETUP: bmrequesttype: 0b00000000, brequest: 5, wlength: 0, windex: 0x0000, wvalue: 0x000b (usb_5 src/bin/usb-5.rs:88)
[INFO ] EP0: SetAddress { address: Some(11) } (usb_5 src/bin/usb-5.rs:99)
[DEBUG] USB: UsbEp0Setup @ 00:00:00.370758 (usb_5 src/bin/usb-5.rs:56)
[DEBUG] SETUP: bmrequesttype: 0b10000000, brequest: 6, wlength: 8, windex: 0x0000, wvalue: 0x0100 (usb_5 src/bin/usb-5.rs:88)
[INFO ] EP0: GetDescriptor { descriptor: Device, length: 8 } (usb_5 src/bin/usb-5.rs:99)
[DEBUG] EP0IN: start 8B transfer (dk dk/src/usbd.rs:59)
[DEBUG] USB: UsbEp0DataDone @ 00:00:00.371337 (usb_5 src/bin/usb-5.rs:56)
[INFO ] EP0IN: transfer complete (usb_5 src/bin/usb-5.rs:65)
[INFO ] EP0IN: transfer done (dk dk/src/usbd.rs:83)
[DEBUG] USB: UsbEp0Setup @ 00:00:00.371917 (usb_5 src/bin/usb-5.rs:56)
[DEBUG] SETUP: bmrequesttype: 0b10000000, brequest: 6, wlength: 18, windex: 0x0000, wvalue: 0x0100 (usb_5 src/bin/usb-5.rs:88)
[INFO ] EP0: GetDescriptor { descriptor: Device, length: 18 } (usb_5 src/bin/usb-5.rs:99)
[DEBUG] EP0IN: start 18B transfer (dk dk/src/usbd.rs:59)
[DEBUG] USB: UsbEp0DataDone @ 00:00:00.372497 (usb_5 src/bin/usb-5.rs:56)
[INFO ] EP0IN: transfer complete (usb_5 src/bin/usb-5.rs:65)
[INFO ] EP0IN: transfer done (dk dk/src/usbd.rs:83)
[DEBUG] USB: UsbEp0Setup @ 00:00:00.373046 (usb_5 src/bin/usb-5.rs:56)
[DEBUG] SETUP: bmrequesttype: 0b10000000, brequest: 6, wlength: 9, windex: 0x0000, wvalue: 0x0200 (usb_5 src/bin/usb-5.rs:88)
[INFO ] EP0: GetDescriptor { descriptor: Configuration { index: 0 }, length: 9 } (usb_5 src/bin/usb-5.rs:99)
[DEBUG] EP0IN: start 9B transfer (dk dk/src/usbd.rs:59)
[DEBUG] USB: UsbEp0DataDone @ 00:00:00.373748 (usb_5 src/bin/usb-5.rs:56)
[INFO ] EP0IN: transfer complete (usb_5 src/bin/usb-5.rs:65)
[INFO ] EP0IN: transfer done (dk dk/src/usbd.rs:83)
[DEBUG] USB: UsbEp0Setup @ 00:00:00.373901 (usb_5 src/bin/usb-5.rs:56)
[DEBUG] SETUP: bmrequesttype: 0b10000000, brequest: 6, wlength: 18, windex: 0x0000, wvalue: 0x0200 (usb_5 src/bin/usb-5.rs:88)
[INFO ] EP0: GetDescriptor { descriptor: Configuration { index: 0 }, length: 18 } (usb_5 src/bin/usb-5.rs:99)
[DEBUG] EP0IN: start 18B transfer (dk dk/src/usbd.rs:59)
[DEBUG] USB: UsbEp0DataDone @ 00:00:00.374603 (usb_5 src/bin/usb-5.rs:56)
[INFO ] EP0IN: transfer complete (usb_5 src/bin/usb-5.rs:65)
[INFO ] EP0IN: transfer done (dk dk/src/usbd.rs:83)
[DEBUG] USB: UsbEp0Setup @ 00:00:00.379211 (usb_5 src/bin/usb-5.rs:56)
[DEBUG] SETUP: bmrequesttype: 0b00000000, brequest: 9, wlength: 0, windex: 0x0000, wvalue: 0x002a (usb_5 src/bin/usb-5.rs:88)
[INFO ] EP0: SetConfiguration { value: Some(42) } (usb_5 src/bin/usb-5.rs:99)
[INFO ] entering the configured state (usb_5 src/bin/usb-5.rs:198)
```

These logs are from a Linux host. You can find traces for other OSes in these files (they are in the [`nrf52-code/usb-app-solutions/traces`](../../nrf52-code/usb-app-solutions/traces) folder):

- `linux-configured.txt` (same logs as the ones shown above)
- `linux-configured.txt`
- `win-configured.txt`, this file only contains the logs produced by running `cargo xtask usb-descriptors`
- `macos-configured.txt`
- `macos-configured.txt` (same logs as the ones shown above)

You can find a solution to this part of the exercise in [`nrf52-code/usb-app-solutions/src/bin/usb-5.rs`](../../nrf52-code/usb-app-solutions/src/bin/usb-5.rs).
94 changes: 44 additions & 50 deletions exercise-book/src/nrf52-usb-idle-state.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,67 +3,61 @@
Once you have handled all the previously covered requests the device should be enumerated and remain idle awaiting for a new host request. Your logs may look like this:

```console
INFO:usb_4 -- USB: UsbReset @ 318.66455ms
INFO:usb_4 -- USB reset condition detected
INFO:usb_4 -- USB: UsbEp0Setup @ 391.418456ms
INFO:usb_4 -- EP0: GetDescriptor { descriptor: Device, length: 64 }
INFO:dk::usbd -- EP0IN: start 18B transfer
INFO:usb_4 -- USB: UsbEp0DataDone @ 391.723632ms
INFO:usb_4 -- EP0IN: transfer complete
INFO:dk::usbd -- EP0IN: transfer done
INFO:usb_4 -- USB: UsbReset @ 442.016601ms
INFO:usb_4 -- USB reset condition detected
INFO:usb_4 -- USB: UsbEp0Setup @ 514.709471ms
INFO:usb_4 -- EP0: SetAddress { address: Some(17) }
INFO:usb_4 -- USB: UsbEp0Setup @ 531.37207ms
INFO:usb_4 -- EP0: GetDescriptor { descriptor: Device, length: 18 }
INFO:dk::usbd -- EP0IN: start 18B transfer
INFO:usb_4 -- USB: UsbEp0DataDone @ 531.646727ms
INFO:usb_4 -- EP0IN: transfer complete
INFO:dk::usbd -- EP0IN: transfer done
INFO:usb_4 -- USB: UsbEp0Setup @ 531.829832ms
INFO:usb_4 -- EP0: GetDescriptor { descriptor: DeviceQualifier, length: 10 }
ERROR:usb_4 -- EP0IN: unexpected request; stalling the endpoint
INFO:usb_4 -- USB: UsbEp0Setup @ 532.226562ms
INFO:usb_4 -- EP0: GetDescriptor { descriptor: DeviceQualifier, length: 10 }
ERROR:usb_4 -- EP0IN: unexpected request; stalling the endpoint
INFO:usb_4 -- USB: UsbEp0Setup @ 532.592772ms
INFO:usb_4 -- EP0: GetDescriptor { descriptor: DeviceQualifier, length: 10 }
ERROR:usb_4 -- EP0IN: unexpected request; stalling the endpoint
INFO:usb_4 -- USB: UsbEp0Setup @ 533.020018ms
INFO:usb_4 -- EP0: GetDescriptor { descriptor: Configuration { index: 0 }, length: 9 }
INFO:dk::usbd -- EP0IN: start 9B transfer
INFO:usb_4 -- USB: UsbEp0DataDone @ 533.386228ms
INFO:usb_4 -- EP0IN: transfer complete
INFO:dk::usbd -- EP0IN: transfer done
INFO:usb_4 -- USB: UsbEp0Setup @ 533.569335ms
INFO:usb_4 -- EP0: GetDescriptor { descriptor: Configuration { index: 0 }, length: 18 }
INFO:dk::usbd -- EP0IN: start 18B transfer
INFO:usb_4 -- USB: UsbEp0DataDone @ 533.935546ms
INFO:usb_4 -- EP0IN: transfer complete
INFO:dk::usbd -- EP0IN: transfer done
INFO:usb_4 -- USB: UsbEp0Setup @ 534.118651ms
INFO:usb_4 -- EP0: SetConfiguration { value: Some(42) }
ERROR:usb_4 -- EP0IN: unexpected request; stalling the endpoint
[DEBUG] USB: UsbReset @ 00:00:00.347259 (usb_4 src/bin/usb-4.rs:56)
[WARN ] USB reset condition detected (usb_4 src/bin/usb-4.rs:60)
[DEBUG] USB: UsbEp0Setup @ 00:00:00.389770 (usb_4 src/bin/usb-4.rs:56)
[DEBUG] SETUP: bmrequesttype: 0b00000000, brequest: 5, wlength: 0, windex: 0x0000, wvalue: 0x000a (usb_4 src/bin/usb-4.rs:88)
[INFO ] EP0: SetAddress { address: Some(10) } (usb_4 src/bin/usb-4.rs:99)
[DEBUG] USB: UsbEp0Setup @ 00:00:00.393066 (usb_4 src/bin/usb-4.rs:56)
[DEBUG] SETUP: bmrequesttype: 0b10000000, brequest: 6, wlength: 8, windex: 0x0000, wvalue: 0x0100 (usb_4 src/bin/usb-4.rs:88)
[INFO ] EP0: GetDescriptor { descriptor: Device, length: 8 } (usb_4 src/bin/usb-4.rs:99)
[DEBUG] EP0IN: start 8B transfer (dk dk/src/usbd.rs:59)
[DEBUG] USB: UsbEp0DataDone @ 00:00:00.393585 (usb_4 src/bin/usb-4.rs:56)
[INFO ] EP0IN: transfer complete (usb_4 src/bin/usb-4.rs:65)
[INFO ] EP0IN: transfer done (dk dk/src/usbd.rs:83)
[DEBUG] USB: UsbEp0Setup @ 00:00:00.394409 (usb_4 src/bin/usb-4.rs:56)
[DEBUG] SETUP: bmrequesttype: 0b10000000, brequest: 6, wlength: 18, windex: 0x0000, wvalue: 0x0100 (usb_4 src/bin/usb-4.rs:88)
[INFO ] EP0: GetDescriptor { descriptor: Device, length: 18 } (usb_4 src/bin/usb-4.rs:99)
[DEBUG] EP0IN: start 18B transfer (dk dk/src/usbd.rs:59)
[DEBUG] USB: UsbEp0DataDone @ 00:00:00.394958 (usb_4 src/bin/usb-4.rs:56)
[INFO ] EP0IN: transfer complete (usb_4 src/bin/usb-4.rs:65)
[INFO ] EP0IN: transfer done (dk dk/src/usbd.rs:83)
[DEBUG] USB: UsbEp0Setup @ 00:00:00.395385 (usb_4 src/bin/usb-4.rs:56)
[DEBUG] SETUP: bmrequesttype: 0b10000000, brequest: 6, wlength: 9, windex: 0x0000, wvalue: 0x0200 (usb_4 src/bin/usb-4.rs:88)
[INFO ] EP0: GetDescriptor { descriptor: Configuration { index: 0 }, length: 9 } (usb_4 src/bin/usb-4.rs:99)
[DEBUG] EP0IN: start 9B transfer (dk dk/src/usbd.rs:59)
[DEBUG] USB: UsbEp0DataDone @ 00:00:00.396057 (usb_4 src/bin/usb-4.rs:56)
[INFO ] EP0IN: transfer complete (usb_4 src/bin/usb-4.rs:65)
[INFO ] EP0IN: transfer done (dk dk/src/usbd.rs:83)
[DEBUG] USB: UsbEp0Setup @ 00:00:00.396270 (usb_4 src/bin/usb-4.rs:56)
[DEBUG] SETUP: bmrequesttype: 0b10000000, brequest: 6, wlength: 18, windex: 0x0000, wvalue: 0x0200 (usb_4 src/bin/usb-4.rs:88)
[INFO ] EP0: GetDescriptor { descriptor: Configuration { index: 0 }, length: 18 } (usb_4 src/bin/usb-4.rs:99)
[DEBUG] EP0IN: start 18B transfer (dk dk/src/usbd.rs:59)
[DEBUG] USB: UsbEp0DataDone @ 00:00:00.396942 (usb_4 src/bin/usb-4.rs:56)
[INFO ] EP0IN: transfer complete (usb_4 src/bin/usb-4.rs:65)
[INFO ] EP0IN: transfer done (dk dk/src/usbd.rs:83)
[DEBUG] USB: UsbEp0Setup @ 00:00:00.401824 (usb_4 src/bin/usb-4.rs:56)
[DEBUG] SETUP: bmrequesttype: 0b00000000, brequest: 9, wlength: 0, windex: 0x0000, wvalue: 0x002a (usb_4 src/bin/usb-4.rs:88)
[INFO ] EP0: SetConfiguration { value: Some(42) } (usb_4 src/bin/usb-4.rs:99)
[WARN ] EP0IN: unexpected request; stalling the endpoint (usb_4 src/bin/usb-4.rs:71)
```

Note that these logs are from a Linux host where a `SET_CONFIGURATION` request is sent after the `SET_ADDRESS` request. On other OSes you may not get that request before the bus goes idle. Also note that there are some `GET_DESCRIPTOR DeviceQualifier` requests in this case; you do not need to parse them in the `usb` crate as they'll be rejected (stalled) anyways.
Note that these logs are from a macOS host where a `SET_ADDRESS` request is sent first, and then a `GET_DESCRIPTOR` request. On other OSes the messages may be in a different order. Also note that there are some `GET_DESCRIPTOR DeviceQualifier` requests in this case; you do not need to parse them in the `usb` crate as they'll be rejected (stalled) anyways.

You can find traces for other OSes in these files (they are in the [`nrf52-code/usb-app-solutions/traces`](../../nrf52-code/usb-app-solutions/traces) folder):

- `linux-enumeration.txt` (same logs as the ones shown above)
- `macos-enumeration.txt`
- `linux-enumeration.txt`
- `macos-enumeration.txt` (same logs as the ones shown above)
- `win-enumeration.txt`

✅ Double check that the enumeration works by running [`cyme`](./nrf52-usb-listing-usb-devices.md) while `usb-4.rs` is running.
✅ Double check that the enumeration works by running `cargo xtask usb-list`](./nrf52-tools.md) while `usb-4.rs` is running.

```console
$ cyme
$ cargo xtask usb-list
(...) random other USB devices will be listed
2 15  0x1366 0x1051 J-Link 001050255503 12.0 Mb/s
2 16  0x1209 0x0717 composite_device - 12.0 Mb/s
Bus 004 Device 001: ID 1209:0717 <-- nRF52840 on the nRF52840 Development Kit
```

Both the J-Link and the device implemented by your firmware should appear in the list.
You can also try `cyme`, but we've found that on Windows, the device may not appear in the tool's output. Possibly this is because it's only showing devices which have accepted a Configuration.

You can find a working solution up to this point in [`nrf52-code/usb-app-solutions/src/bin/usb-4.rs`](../../nrf52-code/usb-app-solutions/src/bin/usb-4.rs). Note that the solution uses the `usb2` crate to parse SETUP packets and that crate supports parsing all standard requests.
6 changes: 3 additions & 3 deletions nrf52-code/boards/dk-solution/src/usbd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ impl Ep0In {

self.busy = true;

defmt::println!("EP0IN: start {}B transfer", n);
defmt::debug!("EP0IN: start {}B transfer", n);

// start DMA transfer
dma_start();
Expand All @@ -80,7 +80,7 @@ impl Ep0In {
usbd.events_ep0datadone.reset();

self.busy = false;
defmt::println!("EP0IN: transfer done");
defmt::info!("EP0IN: transfer done");
}
}
}
Expand Down Expand Up @@ -115,7 +115,7 @@ pub fn init(power: POWER, usbd: &USBD) {
// wait until the USB cable has been connected
while power.events_usbdetected.read().bits() == 0 {
if once {
defmt::println!("waiting for USB connection on port J3");
defmt::info!("waiting for USB connection on port J3");
once = false;
}

Expand Down
6 changes: 3 additions & 3 deletions nrf52-code/boards/dk/src/usbd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ impl Ep0In {

self.busy = true;

defmt::println!("EP0IN: start {}B transfer", n);
defmt::debug!("EP0IN: start {}B transfer", n);

// start DMA transfer
dma_start();
Expand All @@ -80,7 +80,7 @@ impl Ep0In {
usbd.events_ep0datadone.reset();

self.busy = false;
defmt::println!("EP0IN: transfer done");
defmt::info!("EP0IN: transfer done");
}
}
}
Expand Down Expand Up @@ -115,7 +115,7 @@ pub fn init(power: POWER, usbd: &USBD) {
// wait until the USB cable has been connected
while power.events_usbdetected.read().bits() == 0 {
if once {
defmt::println!("waiting for USB connection on port J3");
defmt::info!("waiting for USB connection on port J3");
once = false;
}

Expand Down
2 changes: 1 addition & 1 deletion nrf52-code/hal-app/src/bin/blinky.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ fn main() -> ! {
for _ in 0..10 {
led.toggle();
timer.wait(Duration::from_secs(1));
defmt::println!("LED toggled @ {=u64:tus}", dk::uptime_us());
defmt::debug!("LED toggled @ {=u64:tus}", dk::uptime_us());
}

dk::exit()
Expand Down
2 changes: 1 addition & 1 deletion nrf52-code/radio-app/src/bin/blinky.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ fn main() -> ! {
for _ in 0..10 {
led.toggle();
timer.wait(Duration::from_secs(1));
defmt::println!("LED toggled @ {=u64:tus}", dk::uptime_us());
defmt::debug!("LED toggled @ {=u64:tus}", dk::uptime_us());
}

dk::exit()
Expand Down
2 changes: 1 addition & 1 deletion nrf52-code/usb-app-solutions/src/bin/usb-1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ mod app {
}

fn on_event(_usbd: &USBD, event: Event) {
defmt::println!("USB: {} @ {}", event, dk::uptime());
defmt::debug!("USB: {} @ {=u64:tus}", event, dk::uptime_us());

match event {
Event::UsbReset => {
Expand Down
8 changes: 4 additions & 4 deletions nrf52-code/usb-app-solutions/src/bin/usb-2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ mod app {
}

fn on_event(usbd: &USBD, event: Event) {
defmt::println!("USB: {} @ {}", event, dk::uptime());
defmt::debug!("USB: {} @ {=u64:tus}", event, dk::uptime_us());

match event {
Event::UsbReset => {
Expand Down Expand Up @@ -75,8 +75,8 @@ mod app {
// let windex = usbd::windex(usbd);
// let wvalue = usbd::wvalue(usbd);

defmt::println!(
"SETUP: bmrequesttype: {}, brequest: {}, wlength: {}, windex: {}, wvalue: {}",
defmt::debug!(
"SETUP: bmrequesttype: 0b{=u8:08b}, brequest: {=u8}, wlength: {=u16}, windex: 0x{=u16:04x}, wvalue: 0x{=u16:04x}",
bmrequesttype,
brequest,
wlength,
Expand All @@ -90,7 +90,7 @@ mod app {
Request::GetDescriptor { descriptor, length }
if descriptor == Descriptor::Device =>
{
defmt::println!("GET_DESCRIPTOR Device [length={}]", length);
defmt::info!("GET_DESCRIPTOR Device [length={}]", length);

defmt::println!("Goal reached; move to the next section");
dk::exit()
Expand Down
8 changes: 4 additions & 4 deletions nrf52-code/usb-app-solutions/src/bin/usb-3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ mod app {
}

fn on_event(usbd: &USBD, ep0in: &mut Ep0In, event: Event) {
defmt::println!("USB: {} @ {}", event, dk::uptime());
defmt::debug!("USB: {} @ {=u64:tus}", event, dk::uptime_us());

match event {
Event::UsbReset => {
Expand All @@ -63,8 +63,8 @@ mod app {
let windex = usbd::windex(usbd);
let wvalue = usbd::wvalue(usbd);

defmt::println!(
"SETUP: bmrequesttype: {}, brequest: {}, wlength: {}, windex: {}, wvalue: {}",
defmt::debug!(
"SETUP: bmrequesttype: 0b{=u8:08b}, brequest: {=u8}, wlength: {=u16}, windex: 0x{=u16:04x}, wvalue: 0x{=u16:04x}",
bmrequesttype,
brequest,
wlength,
Expand All @@ -79,7 +79,7 @@ mod app {
Request::GetDescriptor { descriptor, length }
if descriptor == Descriptor::Device =>
{
defmt::println!("GET_DESCRIPTOR Device [length={}]", length);
defmt::info!("GET_DESCRIPTOR Device [length={}]", length);

let desc = usb2::device::Descriptor {
bDeviceClass: 0,
Expand Down
Loading

0 comments on commit 016f19d

Please sign in to comment.