From e2dfdcb5091388cfbd467e9d8ac9b7d2025cc833 Mon Sep 17 00:00:00 2001 From: Dario Nieuwenhuis Date: Sun, 12 May 2024 23:30:53 +0200 Subject: examples/stm32: reduce packet queue count to avoid OOM on smaller chips. --- examples/stm32h7/src/bin/eth_client.rs | 4 ++-- examples/stm32h7/src/bin/eth_client_mii.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'examples/stm32h7/src') diff --git a/examples/stm32h7/src/bin/eth_client.rs b/examples/stm32h7/src/bin/eth_client.rs index aeb169e19..0639fb99f 100644 --- a/examples/stm32h7/src/bin/eth_client.rs +++ b/examples/stm32h7/src/bin/eth_client.rs @@ -64,10 +64,10 @@ async fn main(spawner: Spawner) -> ! { let mac_addr = [0x00, 0x00, 0xDE, 0xAD, 0xBE, 0xEF]; - static PACKETS: StaticCell> = StaticCell::new(); + static PACKETS: StaticCell> = StaticCell::new(); let device = Ethernet::new( - PACKETS.init(PacketQueue::<16, 16>::new()), + PACKETS.init(PacketQueue::<4, 4>::new()), p.ETH, Irqs, p.PA1, diff --git a/examples/stm32h7/src/bin/eth_client_mii.rs b/examples/stm32h7/src/bin/eth_client_mii.rs index de6ea522a..9a52e8d3b 100644 --- a/examples/stm32h7/src/bin/eth_client_mii.rs +++ b/examples/stm32h7/src/bin/eth_client_mii.rs @@ -64,10 +64,10 @@ async fn main(spawner: Spawner) -> ! { let mac_addr = [0x00, 0x00, 0xDE, 0xAD, 0xBE, 0xEF]; - static PACKETS: StaticCell> = StaticCell::new(); + static PACKETS: StaticCell> = StaticCell::new(); let device = Ethernet::new_mii( - PACKETS.init(PacketQueue::<16, 16>::new()), + PACKETS.init(PacketQueue::<4, 4>::new()), p.ETH, Irqs, p.PA1, -- cgit From 66e3d4da8d6eda003666b633bb57e67f2a10e31b Mon Sep 17 00:00:00 2001 From: Dario Nieuwenhuis Date: Mon, 13 May 2024 01:01:44 +0200 Subject: examples/stm32: do not enable vbus detect by default, it doesn't work on all boards. --- examples/stm32h7/src/bin/usb_serial.rs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'examples/stm32h7/src') diff --git a/examples/stm32h7/src/bin/usb_serial.rs b/examples/stm32h7/src/bin/usb_serial.rs index 71d0c0a25..1c50fc1c8 100644 --- a/examples/stm32h7/src/bin/usb_serial.rs +++ b/examples/stm32h7/src/bin/usb_serial.rs @@ -53,13 +53,11 @@ async fn main(_spawner: Spawner) { let mut ep_out_buffer = [0u8; 256]; let mut config = embassy_stm32::usb::Config::default(); - // Enable vbus_detection - // Note: some boards don't have this wired up and might not require it, - // as they are powered through usb! - // If you hang on boot, try setting this to "false"! - // See https://embassy.dev/book/dev/faq.html#_the_usb_examples_are_not_working_on_my_board_is_there_anything_else_i_need_to_configure - // for more information - config.vbus_detection = true; + // Do not enable vbus_detection. This is a safe default that works in all boards. + // However, if your USB device is self-powered (can stay powered on if USB is unplugged), you need + // to enable vbus_detection to comply with the USB spec. If you enable it, the board + // has to support it or USB won't work at all. See docs on `vbus_detection` for details. + config.vbus_detection = false; let driver = Driver::new_fs(p.USB_OTG_FS, Irqs, p.PA12, p.PA11, &mut ep_out_buffer, config); -- cgit