Spark + eInk/ePaper?

I agree. Before debugging with the actual SD library I wanted to make sure that I am using the right library for that. That was basically the main reason to start from scratch. But right now I’m not able to take care of this because of the memory issue.

Regarding the .cpp files: I thought I committed them but that wasn’t the case. Sorry. Now the repo should be up to date.

As far as I know the Vin can act as a Vout supplying 5V. It is supposed to work automatically but I wasn’t lucky so far. That’s why I used an external Power supply. I am going to have a second look at this.

Once again: I am very happy that you have a look at this. Thank you! :blush:

I got the ‘8 red flashes’ when running your code. And the memory is on the high side, around 18-19KB for uninitialized data (bss memory). If I uncommented the ‘define AVR_ATmega1280’ I got the bss memory down to 12KB. Putting ‘AVR_ATmega1280’ to ‘0’ doesn’t undefine the variable for the ‘#ifndef’ to work.

Then I could display the image from the ‘picture.h’ file on the epaper board. I deleted the PROGMEM in the ‘const static unsigned char image_270[]’ declaration.

I couldnt make the draw-functions to work though. only ‘EPAPER.image_flash(IMAGEFILE);’

The SD card was not initialized correctly. But when I defined ‘AVR_ATmega328P’ the code was working! Here is the epaperFrame example for spark dev.

OK, it works – partially. Whoopee! :slight_smile: Thank you!

I still get an SD card init error though. It comes from Sd2Card.cpp:

Error: CMD8
Error: Sd2Card::init()

When I comment out eSD.begin(EPD_SIZE); in the .ino file the error disappears (of course) and the file “picture_1.h” is displayed on the panel. That proofs: the panel works with the core. And I got the power connection between spark and the panel working. At last!

That said, it doesn’t show the graphical elements coming after the image in the .ino / setup. They are just ignored. And I don’t get what is wrong with the SD card initialization. Checked different SD cards, formated in FAT16 and FAT32, checked the wiring – no changes. I reversed the #define to AVR_ATmega1280 in EPD.h – but that triggers a C++ error: "'class EPD_Class' has no member named 'image_sd'".

I still have the feeling that I am using the wrong set of SD libraries. I’ll have a look at the Spark SD card library in the web IDE as you proposed to see if accessing the SD card works in general.

Almost there! :slight_smile:

To change the avr_atmega1280 define both the epd.h and epaperdfs.h needs to be changed. (sorry if I putted the defines all over the place)

One thing you can try Is to reduce the clock speed of the sd card in the Sd2Card.cpp file. The speed is 18MHz (72MHz/4) because of arduino clock div is put to div4. I did putt SPI_CLOCK_DIV32 in the sd2card.cpp file to get 2.25MHz for trouble shooting.

Ah, thanks for the hint. :smile:

In the meantime I kind of hardwaredebugged this SD card thing. I built this badass SD card adapter shown on @mumblepins git repo and the card initialized just fine. Then I tried to hook up the SD card reader of an Arduino ethernet shield. Worked perfect. Finally I ripped out all connections between Spark core and the Seeedstudio ePaper shield and reconnected ONLY the pins needed for the SD card reader. IT WORKED! I then reconnected all remaining pins: INIT ERROR. How is that possible!? Perhaps I should give reducing the clock speed a shot, as you suggested…

The only pins, I think, that shoud be able to interrupt the sd-card initialization are the word_stock_cs and the epd_cs. Thoose are active ‘low’. If any of thoose pins are low during the sd card init there might be an error. If you disconnect thoose pins the cs signals will be high by on-board pull-up resistors on the panel.

Good to know. I also have the feeling that the connections via breadboard are not very reliable and lead to a lot of errors, too. I made different tests and had different outcomes only by reconnecting pins or moving the board. It’s the first time I have issues with that but assuming that SD card reading is a sensitive matter, I think I have to find a way to build proper connections before I continue debugging.

This weekend I soldered sort of a custom Shield Shield to get rid of the unstable breadboard connections and now the image and the graphics in the example code appear. That’s really an improvement. Although mumblepins’ sd-card example for me only works with his custom built adapter. Using his example with the onboard sd-card reader still leads to the same init error. When I want to use mumblepins’ adapter together with the epaper shield (instead of the onboard sd-card reader), the panel doesn’t show anything.

But now – with the soldered connections – “eSD.begin(EPD_SIZE);” does no longer produce init errors when using the onboard sd-card reader with the seeed code, so I can pass on mumblepins’ solution I suppose.

I will continue to play with the code, now the hardware problems seem to be (hopefully) solved. Thanks once again for your help, @androw72 – I’ll keep you updated how things are working out.

Hey there,

I have followed these amazing instructions and came up with the same layout (except I soldered a micro SD card adapter).

The program runs well and reads the SD card OK but all I get on the display is garbage, with an few vertical lines on the right and left, and a blacker line of a few pixels on top.

I’m using a Particle Photon and not a Core, maybe that’s the issue? I tried to lower the clock to SPI_CLOCK_DIV64 but no cigar.

I noticed this line was commented out in EPD.cpp:
// this->line(line, &image[line * this->bytes_per_line], 0, true, stage);

Should I use true on the Photon instead of false, which seems specific to the Core, at least compared to the Arduino?

Please excuse my ignorance as this is my very first project :smile:

Thanks in advance!

After some more digging, I think I’ve found the issue… I’ve got this display:
http://www.pervasivedisplays.com/LiteratureRetrieve.aspx?ID=222072

I think it’s a COG v2 and the driver @androw72 adapted for the Spark only works with COG V1.

I’ll look around and try to find either a COG V2 driver, or a V1 Display… Not sure these old displays are still available tho.

All good now, the loop() is not working yet and get stucks after displaying the first image but this is a minor issue. I ended up hacking this lib: https://github.com/repaper/gratis/tree/master/Sketches/libraries/EPD_V231_G2

Replicated the classes structure from the V1 one and it works like a charm!

I’ll publish the full fork in GIT once it’s 100% working.

Thanks again @androw72, I’d still be nowhere without your initial code, good work!

1 Like