-
• #2
Tue 2021.03.09
Hi @Ruprect99 Rob, I do not have that hardware to test, but a few ideas do come to mind:
'but info is just full of zeros.'
If the commands going out are correct, it sounds like they aren't received, so no data transfer occurs. Is it possible MISO and MOSI are wired backwards?
This was a fundamental struggle I had, with my first experience with SPI. Your snippets do not show how SPI is setup, so I'd first double check to make sure the code definitions match the actual wiring. Also, make sure of a solid ground between the uP, the e-Ink display and the power supply.
Has an attempt been made to mirror the code shown in another e-Ink example:
Using the available SPI functions:
http://www.espruino.com/Reference#SPI
http://www.espruino.com/SPIThe snippets shown in post #1 don't quite mirror the SSD1606 e-Ink example. I had a similar experience and the community helped with SPI examples and snippets:
Have you tried hard coding the register values in place of the constants, to verify that the constants are as they should be. e.g. 32bit vs 16bit, actual hex value and not a string representation, etc.
Examples snippets
http://forum.espruino.com/conversations/336724/#comment14838658
For what it's worth, after hours of struggle with SPI, I2C and UARTS, I eventually buckled and picked up a logic analyzer ~$20 that provides immediate feedback on what is on the data lines. I had a floating CS chip Select that rounded out the leading edge, so the receiving device never started the data receive, and thus nothing during the expected read was seen. Here are some sample images, but with a UART:JPG Images
http://forum.espruino.com/comments/14687689/
Note the protocol analyzer output that allows the conversion of Hi-Lo to actual ASCII we may read
Here is a full example by @urish, follow the gist link: -
• #3
Just a guess, in this code
var command = function(c,d) { SPI1.write(c, cs); if (d!==undefined) { dc.set(); SPI1.write(d, cs); } }
you are not sending command+data as one block with cs low, not sure what device protocol there is but typically cs should be low for whole piece that belongs together. When cs goes high the device state machine typically goes to beginning (even to sleep) so forgets its state. But that's just a guess, don't know this device.
EDIT:
also don't seedc.clear();
before sending the command -
• #4
Hi,
I hadn't seen that other e-ink display. I can certainly use that for some help.
I need to map out the manufacturers process in the c code they supply as I think there might be some more steps (like actually powering the display on first) that I might be missing.
I was aware of the getting the spi lines round the wrong way so did try it both ways around.
I will update on progress when I make some!
Thanks
Hi,
I've been looking at this code to try and convert to run an e-ink display (M5Paper) (https://github.com/gnzzz/IT8951/blob/89d505b26f130539644117522a0fdc128ffe44c1/lib/it8951.ts)
I'm pretty new to SPI so have been trying to figure it out.
looking through the forums I've managed to piece together 3 methods for reading, writing and sending commands
But it doesn't work. So for example in the code I'm looking at, this gets called
I've converted this to:
but info is just full of zeros.
I'm not sure if I'm totally on the wrong track or just missing some key bit of information.
Thanks,
Rob Smart