Home

Up: Smart Plug

Previous: Rust on Arduino

W5500 Driver for Rust Embedded-HAL on AVR

Edit: this post is kind of hopeless, so skip to the next one in which I figure out the problem!

In the last post, I was optimistic that implementing a SPI library for my AVR chip would get the currently-available W5500 Embedded-HAL driver crate working. Alas, after much testing and experimentation, I have not been successful in making it do… well, anything. Even the simple task of writing to a single register and reading it back out does not behave as expected. The value read back is just zeros. Serial output:

https://github.com/avr-rust/rust/issues/149

Hello from Arduino!
initialized
activated
IP: 0.0.0.0

In addition to these troubles, writing up a more complete program (one that responds to UDP packets) can’t even compile. I believe this is because this driver crate was not written to work on an 8-bit AVR platform. As mentioned in previous posts, support is immature and unofficial. I’ve tried tweaking a lot of things in the library, but nothing has had any desirable outcomes.

Enough bad news. The good news is that I’ve succeeded in writing/reading the W5500’s registers by interacting with the SPI library directly. This means that 1) what I want to accomplish is possible, and 2) my SPI implementatation is working. This means that I should be able to re-implement the driver myself in a way that’s compatible with an AVR platform. Ideally, it would also work on officially supported 32-bit/64-bit platforms. That will be my next task.

Next: Working UDP Listener in Rust (finally)

Creative Commons License