Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to using Arduino SPI library #335

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Switch to using Arduino SPI library #335

wants to merge 2 commits into from

Conversation

njh
Copy link
Owner

@njh njh commented Aug 23, 2018

Switch from manipulating the AVR registers directly to using the Arduino SPI library.

  • Should allows EtherCard to work on other architectures
  • Compile size is a little bit smaller
  • Cleaner code

Note there is a little bit more work to do on this, please don't merge yet.

Before merging, it would be really good if people were able to test out this branch and see if it works for them on a variety of Arduino boards.

@njh njh added the dont merge Not ready for merging yet label Aug 23, 2018
@njh njh mentioned this pull request Jan 10, 2019
@njh njh mentioned this pull request Feb 10, 2019
@SomeshDaga
Copy link

SomeshDaga commented Mar 22, 2019

@njh It's still seems to be looking for avr/eeprom.h library that is not found for non-avr microcontrollers.

Tested it on a Arduino Due where compilation failed when it couldn't find the above.

@jamesfowkes
Copy link
Contributor

jamesfowkes commented Jul 5, 2019

I have tried this pull request with the new Arduino Nano Every.

The SPI works fine though I had to add support for checking if the SPI peripheral was enabled:

if ((SPI0.CTRLA & SPI_ENABLE_bm) == 0)
    initSPI();

In addition, the library seems to be processing each HTTP request three times. If I use curl to make a request, e.g.:

curl -i http://192.168.0.25/tare

my application code sees and handles three of them. This is three consecutive log lines from my application's HTTP handler, which calls ether.packetReceive() and ether.packetLoop()

APP: Handling URL /tare
APP: Handling URL /tare
APP: Handling URL /tare

So the handler is getting a positive value from ether.packetLoop() three times per actual request. This is consistent behaviour over multiple requests. I haven't determined if this is related to the SPI changes or something else.

@jamesfowkes
Copy link
Contributor

I can also confirm that the behaviour I described above occurs under certain conditions with a normal Arduino Nano - I haven't worked out what those conditions are yet.

@njh njh mentioned this pull request Dec 1, 2020
@mirh
Copy link

mirh commented Apr 17, 2023

I did also try on a Nano Every, but even with the extra tweak above I'm hitting a wall with

while ((d = eeprom_read_byte(s++)) != 0)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dont merge Not ready for merging yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants