metalphreak / esp8266_spi_driver Goto Github PK
View Code? Open in Web Editor NEWDriver code to interface with ESP8266 built-in hardware SPI functions.
Driver code to interface with ESP8266 built-in hardware SPI functions.
I wonder if you or anyone else can help.
I'm trying to get this code working with a simple example of an Arduino slave...
https://forum.arduino.cc/index.php?topic=184527.0
I have the SLAVE demo running - as far as I can tell it should at least toggle the light on and off when it gets a byte with 1.
So I tried - I am SURE the wiring is right - the light on the Arduino is on and the serial says it is ready...
But nothing... when I tried
spi_init(1); // HSPI mode
spi_tx8(1,arg1);
with various values for arg1 including of course - 1..
Then I noted you have a function called spi_mode - which does not seem to be used in any of your examples and is not called in your c code.. I added that into the init and tried all 4 variations of args 2 and 3 in spi_mode....
Am I missing something? any pointers?
Pete.
Hi
ESP8266_SPI_Driver is a great project
I use your driver for communication between Arduino vs Esp8266
But i don't understand why you choice pin GPIO15 for CS / SS, because GPIO15 need keep to LOW for boot Normal: https://github.com/esp8266/esp8266-wiki/wiki/Boot-Process
How to Float GPIO15 out of LOW after boot for Use it for CS / SS ?
I'm having a heck of a time trying to figure out the documentation for SPI Slave mode on the ESP8266. All I have to go on is this post http://bbs.espressif.com/viewtopic.php?t=77
As somebody with experience diving into SPI registers, any way you can point me in the right direction, or any plans to add slave mode support to this driver library?
Thanks!
In spi_clock I can see the following line (107)
if((prediv==0)|(cntdiv==0)){
To my understanding that should be changed to a logical OR, correct?
In the README.md
the pins are documented:
I think this may be an error and might be:
This SPI lib really looks great and exposing a neat and simple API.
I'm searching for a solution for the communication between a ESP8266 and a Mega2560. The ESP will be the master, communicating with the Mega to retrieve certain sensor values or send commands to it.
I'm especially interested in how to implement the SPI communication getting out of phase between the two.
Is there an example of such a setup that I can use a base for my own code or just to learn from?
I am using the Olimex ESP8266 and am wanting to use your device driver can you speak in greater detail abou which pins you are using, and how you prevent colliding with the flash file access?
This may be useful to someone who needs to shift out data low significant bit first. Note that this is not about LSB/MSB byte order, which is already supported.
ICACHE_FLASH_ATTR
void spi_tx_bit_order(uint8 spi_no, uint8 msb)
{
if (spi_no > 1) return;
if (msb) {
CLEAR_PERI_REG_MASK(SPI_CTRL(spi_no), SPI_WR_BIT_ORDER);
}
else {
SET_PERI_REG_MASK(SPI_CTRL(spi_no), SPI_WR_BIT_ORDER);
}
}
ICACHE_FLASH_ATTR
void spi_rx_bit_order(uint8 spi_no, uint8 msb)
{
if (spi_no > 1) return;
if (msb) {
CLEAR_PERI_REG_MASK(SPI_CTRL(spi_no), SPI_RD_BIT_ORDER);
}
else {
SET_PERI_REG_MASK(SPI_CTRL(spi_no), SPI_RD_BIT_ORDER);
}
}
Hi,
I noticed in the README that you reference both SPI and HSPI (spi_no: SPI or HSPI) but in your blog you recommended against SPI use and indicated no further information would be forthcoming due to the complexities of SPI usage. I was wondering if the existence of options for spi_no indicates that your library works without issue with SPI given the constraint that it is shared?
I ask because my use case for SPI requires very infrequent use and PWM usage so I would like to free up the GPIO12-GPIO15 pins on an ESP-12F module.
Thanks,
Jason
Your library looks to be exactly what we need for the Espruino port to ESP8266 project (see www.espruino.com). I'm hoping that we can have your permission to use your library in our project?
As we study your library, we are a little confused on the initialization functions. Specifically the semantics and relationships between:
spi_init
spi_init_gpio
spi_clock
Some additional documentation and/or examples of these would be fantastic.
I am wondering if we can also work together on a recipe or algorithm that would convert a desired SPI clock rate into the correct set of parameters to be passed into spi_clock
?
@MetalPhreak thanks for developing the driver, looks great.
I am starting a project where the idea is to use the esp8266 (I'm using a nodemcu-devkit-v1.0) to read data from an SPI sensor, save it to an SD card and send it out to a remote server. Do you think it would be possible to use your driver to read the data from the sensor and write it (using different CS pins) to an SD card? It's just a quick question to know if I am on the right track.
Regards,
Martin
It is possible to send carefully timed, but arbitrary data, using this module? I'm looking to send 433MHz data that consists of high/low periods where each 'period' is a multiple of 400us. So I wondered could I clock the HSPI at 2500Hz and get it to stream '1s' and '0s' representing each needed high/low.
Your driver seems like a nice fit for my project but I will have more than one SPI device leading to the need for GPIO chip selects. Of course the pin toggling could be made outside of the SPI driver but imho it would be nicer to have it inside the driver as it belongs to "the SPI domain". What do you think?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.