guild icon
Toit
#SPI help (for epaper driver)
Thread channel in help
Kris Jenkins
Kris Jenkins 07/29/2024 02:55 PM
I'm trying to create a driver for an epaper display (an GDEW0154M09), and I'm having trouble getting anything working. So I've stripped it right back to basics and I'm attempting to read the chip's version data, just to check comms are working. (Command table in the attached image.)

Based on that, I'd expect this program to print something useful, but it just prints #[0x00, 0x00, 0x00]. Could someone take a look and see if I've misunderstood something, please?

import spi import gpio main: bus := spi.Bus --mosi=(gpio.Pin 23) --clock=(gpio.Pin 18) // For many boards GPIO9 is a restricted pin because it acesses the flash // memory. That's not the case for this device. device := bus.device --cs=(gpio.Pin 9 --allow-restricted) --dc=(gpio.Pin 15) --frequency=4_000_000 device.write #[0x70] revision := device.read 3 print "Read $revision" device.write #[0x71] status := device.read 1 print "Read $status"

(Yes, I've checked and checked and checked the pin numbers again. :๐Ÿ˜…:)
Kris Jenkins
Kris Jenkins 07/29/2024 02:55 PM
floitsch
floitsch 07/30/2024 11:07 AM
Is the display directly connected?
If I remember correctly you mentioned that it was an m5 device.
Some of these devices need to power on the peripherals first.
floitsch
floitsch 07/30/2024 11:11 AM
Oh. And I just noticed: it looks like the miso pin isn't connected.
floitsch
floitsch 07/30/2024 11:12 AM
So you can only write to the display, but not read anything from it.
Kris Jenkins
Kris Jenkins 07/30/2024 11:12 AM
It is, yeah. It's hard-wired in the package.
floitsch
floitsch 07/30/2024 11:12 AM
that's unfortunately quite common with displays...
Kris Jenkins
Kris Jenkins 07/30/2024 11:12 AM
Flip, you're right. How did I miss that? :๐Ÿคฆโ€โ™‚๏ธ:
Kris Jenkins
Kris Jenkins 07/30/2024 11:13 AM
Since I posted that, I've been able to confirm that I'm definitely talking to the display. I can make it signal busy to me, at least. I'll add in the miso pin and see if it gets any further. Thanks!
floitsch
floitsch 07/30/2024 11:13 AM
Let's hope you can have access to it.
Kris Jenkins
Kris Jenkins 07/30/2024 11:14 AM
I swear I'm going to get this working. I really want to stop writing C++ just to program it. :๐Ÿ˜…:
floitsch
floitsch 07/30/2024 11:14 AM
:๐Ÿ˜„:
floitsch
floitsch 07/30/2024 11:23 AM
Just googled a bit, and the following library looks quite readable: https://github.com/ZinggJM/GxEPD/blob/master/src/GxGDEW0154M09/GxGDEW0154M09.cpp
A simple E-Paper display library with common base class and separate IO class for Arduino. - ZinggJM/GxEPD
Kris Jenkins
Kris Jenkins 07/30/2024 11:46 AM
Thanks! I've been basing mine off of https://github.com/ZinggJM/GxEPD2/blob/master/src/epd/GxEPD2_154_M09.cpp. I'll compare the two. :๐Ÿ™‚:
floitsch
floitsch 07/30/2024 11:49 AM
Looks like it's the same author. so probably not much of a difference.
floitsch
floitsch 07/30/2024 11:49 AM
The one from m5 was much harder to read.
Kris Jenkins
Kris Jenkins 07/30/2024 11:52 AM
I thought so, but I wasn't sure if that was me not being used to 'idoimatic' C++. I'm glad to hear things aren't usually that bad. :๐Ÿ˜…:(edited)
17 messages in total