atsamd-rs / atsamd

Target atsamd microcontrollers using Rust

Home Page:https://matrix.to/#/#atsamd-rs:matrix.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

wio-terminal Wi-Fi examples broken by #542

pabigot opened this issue · comments

As noted in #604 (comment) the Wi-Fi examples for this target don't work; bisect narrows it down to 34ad122. Observable behavior is that as soon as interrupts are re-enabled after wifi.enable() everything goes dark.

Between the board not supporting debugging without hardware modifications, and Rust blocking my normal dirty tricks to toggle LEDs without regard to safety, I don't expect to be able to solve this, but if somebody has suggestions I can test them.

Hello @pabigot,
I encounter the same thing.
Did you succeed to make it work ?

@lokiodin I haven't had a chance to get back to this yet.

@pabigot Ok thanks. I will try to do something but as I a new in the embedded world ...

I encountered the same bug. I used the debugger, and found that the reason was SERCOM0_2 interrupt handler was crashed due to FrameError in Wifi::_handle_rx (

Err(nb::Error::Other(e)) => {
).
But I'm not sure why this error happened since I don't know much knowledge about how this module works.

@garasubo Awesome; thanks! That inspired me to try again, and I found a fix that's in #644.

Could you point me to any information you can cite or provide on how to use a debugger on these boards? Ideally without having to modify the hardware to enable SWD, but if that's necessary I might be able to find somebody to do it.

The SWD connector is available inside Wio Terminal case. I connected my Wio Terminal to Seeduino Xiao using FPC cable.
Here is the detail (JP): https://github.com/tomoyuki-nakabayashi/Embedded-Rust-from-Basics/tree/main/debug

You also need DAPLink for Xiao and openocd from here: https://github.com/ciniml/debug-tools-builder/releases

@pabigot Hmm, I tried your fix, but it didn't work for me. I tried wifi_scan example in the latest master (2aef0d1), and it still got panic in the same place.

@garasubo There are a couple things that might be going wrong. First, the wifi_scan sample requires the patch from #647 otherwise the display doesn't work.

Second, have you applied the Wi-Fi core firmware update? I happen to have some in-the-box Wio Terminals; if I take a fresh one and with the #647 branch run:

cargo hf2 --vid 0x2886 --pid 0x002d --release --example=wifi_scan

nothing happens. But if I go through the ambd_flash_tool erase and flash steps and install it again, it works.

FWIW I'm using 2.1.2, which is the HEAD^ version of the tool repository, but you might want the HEAD version. My notes for that are:

  2022-03-13 Cloned ambd_flash_tool repo in /mnt/devel/external/Seeed needed its
  url updated from `git://github.com/` to `git@github.com:` but the
  content hasn't been changed since 2021-03-23 and it still provides
  2.1.2.  AFAICT 2.1.3, if it has any differences from 2.1.2 at all,
  changes something to do with channel selection in Japan.  So leave it
  be.

The SWD connector is available inside Wio Terminal case. I connected my Wio Terminal to Seeduino Xiao using FPC cable. Here is the detail (JP): https://github.com/tomoyuki-nakabayashi/Embedded-Rust-from-Basics/tree/main/debug

Thanks. The FPC+various converters approach looks a little too fragile for me. I already have multiple SWD/JTAG-capable debuggers; the problem is accessing the signals. I'm going to try to find somebody who can short the jumpers as described here to bring the signals out to the Grove port.

There are a couple things that might be going wrong. First, the wifi_scan sample requires the patch from #647 otherwise the display doesn't work.

That was the reason. Thanks.
I've already updated the firmware to the latest, and tested with official Arduino libraries. So, my hardware and firmware were fine. After switching #647 branch, it started to show wifi information on the display. Thanks. Hope #647 get merged and the new version is published with these change soon!

The FPC+various converters approach looks a little too fragile for me.

I agree with this, but it is relatively inexpensive and not super hard. Using SWD/J-TAG-capable debbuggers will be ideal if possible.

Hmm, it seems still broken in debug build. Is it better to open a new issue for it?

I think so, yes.

@garasubo I don't think this is a bug. The connection to the RTL8720 has no flow control, so the Overflow error that causes a panic is legitimate. The example works if opt-level = 1 is added to profile.dev.