Skip to content

Switch to using Arduino SPI library - #335

Open
njh wants to merge 2 commits into
mainfrom
spi-library
Open

Switch to using Arduino SPI library#335
njh wants to merge 2 commits into
mainfrom
spi-library

Conversation

@njh

@njh njh commented Aug 23, 2018

Copy link
Copy Markdown
Owner

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

SomeshDaga commented Mar 22, 2019

Copy link
Copy Markdown

@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

jamesfowkes commented Jul 5, 2019

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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

mirh commented Apr 17, 2023

Copy link
Copy Markdown

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