Comments (10)
Hi,
I am convinced the library will run on Arduino Due. I have never tested the board but from the source (https://github.com/arduino/ArduinoCore-sam/blob/790ff2c852bf159787a9966bddee4d9f55352d15/variants/arduino_due_x/variant.h#L130), I think that the default SS is pin 10.
#define PIN_SPI_MOSI (75u)
#define PIN_SPI_MISO (74u)
#define PIN_SPI_SCK (76u)
#define BOARD_SPI_SS0 (10u)
#define BOARD_SPI_SS1 (4u)
#define BOARD_SPI_SS2 (52u)
#define BOARD_SPI_SS3 PIN_SPI_SS3
#define BOARD_SPI_DEFAULT_SS BOARD_SPI_SS3
... ... ...
static const uint8_t SS = BOARD_SPI_SS0;
static const uint8_t SS1 = BOARD_SPI_SS1;
static const uint8_t SS2 = BOARD_SPI_SS2;
static const uint8_t SS3 = BOARD_SPI_SS3;
static const uint8_t MOSI = PIN_SPI_MOSI;
static const uint8_t MISO = PIN_SPI_MISO;
static const uint8_t SCK = PIN_SPI_SCK;
However, you can always initialize the SPI explicitly and then pass the SPI object to the initialization routine of WiFiSPIClass object. The initialization routine allows you to assign any free pin to the SS signal:
Line 49 in ec4a9d4
Please let me know if the library is working for you.
from wifispi.
Thanks, will do!
One more question: Is this library only implementing the client side or is it also possible to use it as a server as well (similar to EthernetServer)? Since the Arduino is running as a webserver in my current project, I could only use it if the latter is also implemented. Or would I have to use a different library for that?
from wifispi.
The library implements server functions but you will have to use polling, no callbacks implemented.
from wifispi.
Great, I only use .available(), so that should be fine! Will let you know my experiences here, hopefully soon!
from wifispi.
Just to report back: At least the examples work fine on the Due :)!
Tested with an orignal Due and a LoLin NodeMCU v3. The Due only provides SPI signals on the 6-pin header where other shields are also plugged in, so you have to make sure that any other shield routes these pins through. Furthermore, the power pin on the SPI header of the Due exports 5V and not 3.3V as one may think since the Due runs on 3.3V. So since the LoLin only accepts either 3.3V on the designated pins or more than 7V on VIN, you have to take the 3.3V from the designated pin on the Due, not the SPI pins. If you use a Wemos D1 mini which accepts 5V, this will be easier to handle.
Other than that, it's pretty straightforward, just connect the pins accordingly:
SPI-Due NodeMCU
1 D6
(2) (for boards that accept 5V input)
3 D5
4 D7
6 GND
Finally, just connect pin 10 (or whatever pin for SS you use) to D8 on the NodeMCU and you're done :)!
Thanks a lot again for this great library!
from wifispi.
One last question: Is the D8<->SS connection always necessary? I just tried it without connecting the cable and it seems to work. In case the NodeMCU is the only SPI device, it would make designing a small adapter board much easier, as for example with the Wemos D1 mini, all necessary pins could be taken from the SPI header and one would not have to go all the way to the outer pin headers of the Arduino to connect to pin 10.
from wifispi.
Hi, thanks for the good news.
As far as I can recall, I had troubles running without SS in high speeds of the SPI bus.
from wifispi.
Ok, thanks!
One (hopefully last) question: When I call WiFiSpi.localIP() right after the connection is established, I get the DHCP-assigned IP and can print it on the Serial port. If I call it a few lines later, I get these errors:
[espspi_proxy.h:300] W: Slave rx is not ready, status 0
[espspi_proxy.h:300] W: Slave rx is not ready, status 0
[espspi_proxy.h:329] W: Slave tx is not ready, status 0
[wifispi_drv.cpp:79] W: Error waitResponse
and WiFiSpi.localIP() returns 0.0.0.0.
Despite these errors, the WiFi works fine (and fast!) afterwards.
Note: I'm using pin 13 for SS as in WiFiSpi.init(13) because I also use the Ethernet shield still for its SD card functionality. The Ethernet Shield uses pin 10 for SS and is set up between the two localIP() calls, just in case that this would make any difference.
EDIT: The behaviour is not exactly reproducible, because sometimes after resetting or unplugging power of the Arduino, it's working fine. Sometimes the error also persists during runtime and prevents connecting to the Arduino/ESP via WiFi.
from wifispi.
This may be timing problem. The ESP8266 SPI implementation has issues.
Try big delay (e.g. 40 us) here:
WiFiSpi/src/utility/espspi_proxy.h
Line 107 in ec4a9d4
from wifispi.
It seemed to be a bit better, but not fixed. I then just added some seconds of delay after the WiFiSpi.begin() sequence and now it seems to run fine. Thanks a lot again!
from wifispi.
Related Issues (20)
- Using library with Arduino Zero clone. HOT 2
- Example wifiManager HOT 1
- Problem with 3 second delay when calling WiFiSpiServer::avaliable() HOT 28
- Allow more than one connection in WiFiSPIServer HOT 3
- WiFi module not present HOT 23
- Protocol version mismatch. Please upgrade the firmware HOT 2
- Add .remoteIP() function to WiFiSpiClient HOT 1
- How to manage maximum socket connections? HOT 16
- Compiler warning when "delete"ing a client instance HOT 31
- ESP8266: change AxTLS to BearSSL HOT 1
- Deprecated boolean type HOT 1
- Problems using ArduinoMDNS with WiFiSpi HOT 13
- Possible to set MAC address of ESP? HOT 1
- Reason for limitation of 4 sockets? HOT 1
- Protocol version mismatch. Please upgrade the firmware HOT 8
- Connect fail using BearSSL branch HOT 26
- Version mismatch HOT 2
- WiFiSpi.config(...) problems with number of parameters HOT 6
- Unstable HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wifispi.