Need help reading shift register via SPI
up vote
0
down vote
favorite
I am trying to decode the signals going to shift registers in my washing machine. The registers are STP16CPC05 which also happen to be LED drivers. I am trying to get status from my washing machine like time left, which cycle, check if its done, etc. with an ESP12. If I can read the signals going to the LED drivers, I can determine which bits are for which LED and then determine status in my program.
My first thought was to use a custom shiftin but I had no luck with that (and supposedly digitalread() is too slow anyway) and I was reading everywhere that I should "just use SPI" since it's faster. I have been able to successfully read the signals using a logic analyzer and even made a script for an arduino pro mini that emulates the register signals so that I can more easily debug my ESP12 without running the washer all day. Writing an SPI master is relatively easy but the slave is the hard part. Here is the code for the Arduino Pro mini so it can emulate the washer signals:
// SPI master code for Arduino Pro Mini "washing machine clone"
#include <SPI.h>
void setup (void)
SPI.begin ();
SPI.setClockDivider(SPI_CLOCK_DIV8);
void loop (void)
delayMicroseconds(200);
SPI.transfer(0x00); //00 00 11 01 08 01 08 02 02 00 00 0C 67 66 80
SPI.transfer(0x00);
SPI.transfer(0x11);
SPI.transfer(0x01);
SPI.transfer(0x08);
delayMicroseconds(180);
SPI.transfer(0x01);
SPI.transfer(0x08);
SPI.transfer(0x02);
SPI.transfer(0x02);
SPI.transfer(0x00);
delayMicroseconds(180);
SPI.transfer(0x00);
SPI.transfer(0x0C);
SPI.transfer(0x67);
SPI.transfer(0x66);
SPI.transfer(0x80);
delayMicroseconds(200);
Does anyone have any idea on how to make a simple SPI slave on esp? Or is there a better way to sniff this shift register bus? The clock signal is 1 MHZ so it isn't terribly fast. I only need to read 15 bytes at a time.
This was promising but it's been alot of work stripping it down to what I want: https://github.com/JiriBilek/WiFiSpi. I can get it to print out the data once but then I think it is having issues resetting the receive interrupt because it is expecting an interactive master.
arduino esp8266 arduino-esp8266
add a comment |
up vote
0
down vote
favorite
I am trying to decode the signals going to shift registers in my washing machine. The registers are STP16CPC05 which also happen to be LED drivers. I am trying to get status from my washing machine like time left, which cycle, check if its done, etc. with an ESP12. If I can read the signals going to the LED drivers, I can determine which bits are for which LED and then determine status in my program.
My first thought was to use a custom shiftin but I had no luck with that (and supposedly digitalread() is too slow anyway) and I was reading everywhere that I should "just use SPI" since it's faster. I have been able to successfully read the signals using a logic analyzer and even made a script for an arduino pro mini that emulates the register signals so that I can more easily debug my ESP12 without running the washer all day. Writing an SPI master is relatively easy but the slave is the hard part. Here is the code for the Arduino Pro mini so it can emulate the washer signals:
// SPI master code for Arduino Pro Mini "washing machine clone"
#include <SPI.h>
void setup (void)
SPI.begin ();
SPI.setClockDivider(SPI_CLOCK_DIV8);
void loop (void)
delayMicroseconds(200);
SPI.transfer(0x00); //00 00 11 01 08 01 08 02 02 00 00 0C 67 66 80
SPI.transfer(0x00);
SPI.transfer(0x11);
SPI.transfer(0x01);
SPI.transfer(0x08);
delayMicroseconds(180);
SPI.transfer(0x01);
SPI.transfer(0x08);
SPI.transfer(0x02);
SPI.transfer(0x02);
SPI.transfer(0x00);
delayMicroseconds(180);
SPI.transfer(0x00);
SPI.transfer(0x0C);
SPI.transfer(0x67);
SPI.transfer(0x66);
SPI.transfer(0x80);
delayMicroseconds(200);
Does anyone have any idea on how to make a simple SPI slave on esp? Or is there a better way to sniff this shift register bus? The clock signal is 1 MHZ so it isn't terribly fast. I only need to read 15 bytes at a time.
This was promising but it's been alot of work stripping it down to what I want: https://github.com/JiriBilek/WiFiSpi. I can get it to print out the data once but then I think it is having issues resetting the receive interrupt because it is expecting an interactive master.
arduino esp8266 arduino-esp8266
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I am trying to decode the signals going to shift registers in my washing machine. The registers are STP16CPC05 which also happen to be LED drivers. I am trying to get status from my washing machine like time left, which cycle, check if its done, etc. with an ESP12. If I can read the signals going to the LED drivers, I can determine which bits are for which LED and then determine status in my program.
My first thought was to use a custom shiftin but I had no luck with that (and supposedly digitalread() is too slow anyway) and I was reading everywhere that I should "just use SPI" since it's faster. I have been able to successfully read the signals using a logic analyzer and even made a script for an arduino pro mini that emulates the register signals so that I can more easily debug my ESP12 without running the washer all day. Writing an SPI master is relatively easy but the slave is the hard part. Here is the code for the Arduino Pro mini so it can emulate the washer signals:
// SPI master code for Arduino Pro Mini "washing machine clone"
#include <SPI.h>
void setup (void)
SPI.begin ();
SPI.setClockDivider(SPI_CLOCK_DIV8);
void loop (void)
delayMicroseconds(200);
SPI.transfer(0x00); //00 00 11 01 08 01 08 02 02 00 00 0C 67 66 80
SPI.transfer(0x00);
SPI.transfer(0x11);
SPI.transfer(0x01);
SPI.transfer(0x08);
delayMicroseconds(180);
SPI.transfer(0x01);
SPI.transfer(0x08);
SPI.transfer(0x02);
SPI.transfer(0x02);
SPI.transfer(0x00);
delayMicroseconds(180);
SPI.transfer(0x00);
SPI.transfer(0x0C);
SPI.transfer(0x67);
SPI.transfer(0x66);
SPI.transfer(0x80);
delayMicroseconds(200);
Does anyone have any idea on how to make a simple SPI slave on esp? Or is there a better way to sniff this shift register bus? The clock signal is 1 MHZ so it isn't terribly fast. I only need to read 15 bytes at a time.
This was promising but it's been alot of work stripping it down to what I want: https://github.com/JiriBilek/WiFiSpi. I can get it to print out the data once but then I think it is having issues resetting the receive interrupt because it is expecting an interactive master.
arduino esp8266 arduino-esp8266
I am trying to decode the signals going to shift registers in my washing machine. The registers are STP16CPC05 which also happen to be LED drivers. I am trying to get status from my washing machine like time left, which cycle, check if its done, etc. with an ESP12. If I can read the signals going to the LED drivers, I can determine which bits are for which LED and then determine status in my program.
My first thought was to use a custom shiftin but I had no luck with that (and supposedly digitalread() is too slow anyway) and I was reading everywhere that I should "just use SPI" since it's faster. I have been able to successfully read the signals using a logic analyzer and even made a script for an arduino pro mini that emulates the register signals so that I can more easily debug my ESP12 without running the washer all day. Writing an SPI master is relatively easy but the slave is the hard part. Here is the code for the Arduino Pro mini so it can emulate the washer signals:
// SPI master code for Arduino Pro Mini "washing machine clone"
#include <SPI.h>
void setup (void)
SPI.begin ();
SPI.setClockDivider(SPI_CLOCK_DIV8);
void loop (void)
delayMicroseconds(200);
SPI.transfer(0x00); //00 00 11 01 08 01 08 02 02 00 00 0C 67 66 80
SPI.transfer(0x00);
SPI.transfer(0x11);
SPI.transfer(0x01);
SPI.transfer(0x08);
delayMicroseconds(180);
SPI.transfer(0x01);
SPI.transfer(0x08);
SPI.transfer(0x02);
SPI.transfer(0x02);
SPI.transfer(0x00);
delayMicroseconds(180);
SPI.transfer(0x00);
SPI.transfer(0x0C);
SPI.transfer(0x67);
SPI.transfer(0x66);
SPI.transfer(0x80);
delayMicroseconds(200);
Does anyone have any idea on how to make a simple SPI slave on esp? Or is there a better way to sniff this shift register bus? The clock signal is 1 MHZ so it isn't terribly fast. I only need to read 15 bytes at a time.
This was promising but it's been alot of work stripping it down to what I want: https://github.com/JiriBilek/WiFiSpi. I can get it to print out the data once but then I think it is having issues resetting the receive interrupt because it is expecting an interactive master.
arduino esp8266 arduino-esp8266
arduino esp8266 arduino-esp8266
edited Nov 10 at 20:43
asked Nov 10 at 18:50
dreed75
5819
5819
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
There is a SPISlave library in the esp8266 Arduino package. With examples. (Jiri Bilek's firmware has only a modified copy of it.)
Right, I tried that one before I found Jiri's and I had a similar problem. With that one, some of the bytes would end up in a status register and some would end up in the data register and I couldn't figure out how to retrieve them consistently. If the IDE had a debugger, I could probably figure it out but I'm too much of a noob. I need to see what is happening in the memory.
– dreed75
Nov 10 at 21:30
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
There is a SPISlave library in the esp8266 Arduino package. With examples. (Jiri Bilek's firmware has only a modified copy of it.)
Right, I tried that one before I found Jiri's and I had a similar problem. With that one, some of the bytes would end up in a status register and some would end up in the data register and I couldn't figure out how to retrieve them consistently. If the IDE had a debugger, I could probably figure it out but I'm too much of a noob. I need to see what is happening in the memory.
– dreed75
Nov 10 at 21:30
add a comment |
up vote
0
down vote
There is a SPISlave library in the esp8266 Arduino package. With examples. (Jiri Bilek's firmware has only a modified copy of it.)
Right, I tried that one before I found Jiri's and I had a similar problem. With that one, some of the bytes would end up in a status register and some would end up in the data register and I couldn't figure out how to retrieve them consistently. If the IDE had a debugger, I could probably figure it out but I'm too much of a noob. I need to see what is happening in the memory.
– dreed75
Nov 10 at 21:30
add a comment |
up vote
0
down vote
up vote
0
down vote
There is a SPISlave library in the esp8266 Arduino package. With examples. (Jiri Bilek's firmware has only a modified copy of it.)
There is a SPISlave library in the esp8266 Arduino package. With examples. (Jiri Bilek's firmware has only a modified copy of it.)
answered Nov 10 at 21:04
Juraj
298110
298110
Right, I tried that one before I found Jiri's and I had a similar problem. With that one, some of the bytes would end up in a status register and some would end up in the data register and I couldn't figure out how to retrieve them consistently. If the IDE had a debugger, I could probably figure it out but I'm too much of a noob. I need to see what is happening in the memory.
– dreed75
Nov 10 at 21:30
add a comment |
Right, I tried that one before I found Jiri's and I had a similar problem. With that one, some of the bytes would end up in a status register and some would end up in the data register and I couldn't figure out how to retrieve them consistently. If the IDE had a debugger, I could probably figure it out but I'm too much of a noob. I need to see what is happening in the memory.
– dreed75
Nov 10 at 21:30
Right, I tried that one before I found Jiri's and I had a similar problem. With that one, some of the bytes would end up in a status register and some would end up in the data register and I couldn't figure out how to retrieve them consistently. If the IDE had a debugger, I could probably figure it out but I'm too much of a noob. I need to see what is happening in the memory.
– dreed75
Nov 10 at 21:30
Right, I tried that one before I found Jiri's and I had a similar problem. With that one, some of the bytes would end up in a status register and some would end up in the data register and I couldn't figure out how to retrieve them consistently. If the IDE had a debugger, I could probably figure it out but I'm too much of a noob. I need to see what is happening in the memory.
– dreed75
Nov 10 at 21:30
add a comment |
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53242313%2fneed-help-reading-shift-register-via-spi%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown