newAM / w5500-ll-rs

Low level rust driver for the Wiznet W5500 internet offload chip
5 stars 0 forks source link

Does this work with the W5100 ? #55

Open mutantbob opened 2 years ago

mutantbob commented 2 years ago

Does this crate work for driving the W5100 chip used by the Arduino Ethernet Shield V1?

newAM commented 2 years ago

Maybe.

This was designed with only the W5500 in mind.

I know that the registers are not 100% compatible, and there are fewer sockets on the W5100, but it might be close enough for basic functionality.

mutantbob commented 2 years ago

I decided to just blindly compile something to see if it works. I added the UDP code from the README.md to my main.rs and got the error:

this `version` of Cargo is older than the `2021` edition, and only supports `2015` and `2018` editions.`

So I modified my Cargo.toml to have edition = "2021" and used ~/.cargo/bin/cargo +nightly build but then it failed with

   Compiling w5500-hl v0.7.1
LLVM ERROR: Not supported instr: <MCInst 312 <MCOperand Reg:1> <MCOperand Imm:15> <MCOperand Reg:47>>

Now this looks like a problem with the LLVM toolchain (I happen to have LLVM-13.0.0 installed). I am not finding any workarounds on google. I am curious what toolchain you are using that can successfully compile arduino apps?

I have cargo 1.50.0-nightly, and rustup show tells me

active toolchain
----------------

nightly-2021-01-07-x86_64-unknown-linux-gnu (overridden by '/home/thoth/src/rust-arduino-blink-3/rust-toolchain.toml')
rustc 1.51.0-nightly (c2de47a9a 2021-01-06)
newAM commented 2 years ago

I have not tried this with AVR yet, I have been using ARM based microcontrollers. The support for AVR in rust is still relatively new and tier 3, there is an active bug that looks similar:

It appears some AVR bugs have been fixed on the 1.58.0 nightly, maybe give that a try?

mutantbob commented 2 years ago

It does not work with the 2022-01-07 nightly (which seems to be based on 1.60.0). I fumbled around with 2021-11-01 and -07 and -12-01, but they all have the same problem. This might just take a while to get sorted out.