Odroid N2 OLED I2C / SPI driver

You maybe still have i2c enabled? I know some issues on C4 when i2c and SPI is enabled in same time. I tried your cmds and it boots up normally.

CoreELEC:~ # ls /dev/spi*
/dev/spidev0.0      /dev/spidev32766.0

Yep, SPI is active, I can still SSH into the box and ls /dev/spi* shows it’s active but CoreELEC is stuck on the boot logo.

I’ve downgraded to 20200626 and CoreELEC now boot s correctly so I’ll re-update to 20200702 and try it again.

Ok, so updating to 20200702 causes CoreELEC to hang at the boot logo, SPI isn’t active and I can still SSH into the box, so this maybe a 20200702 issue and I’ll post in the nightly thread.

journalctl -l --no-pager | paste

Argggghhh… Why are all my posts suddenly needing approval :frowning:

2 posts were merged into an existing topic: Nightly builds (NEW)

So I got one of the 2.42 inch SPI displays from China, and after connecting it to an Arduino via SPI and writing some simple test code I can confirm the display works perfectly fine in SPI mode.

However I can’t for the life of me get it to work via SPI on the N2.

I’ve enabled SPI on the N2 and confirmed it’s active.

I’ve converted my working Arduino code to python using this SPI library https://github.com/tomstokes/python-spi but I just can’t get the display to work.

I’m not sure if it’s a problem with the python SPI library I’m using or if the SPI interface on the N2 is even working.

Does anyone know of another pure python SPI library I could try? Or a simple way to test the SPI interface on the N2 actually works?

Just make a hardware loop from pin 19 (MOSI) to pin 21 (MISO) and use the spiddev_test from Hardkernel to test if the SPI works at all.

Yep, I saw that in the wiki https://wiki.odroid.com/odroid-n2/application_note/gpio/spi

How do I use spidev_test… CoreELEC has no gcc to compile it

./build.CoreELEC-Amlogic-ng.arm-9.2-devel/toolchain/bin/armv8a-libreelec-linux-gnueabi-gcc spidev_test.c -o spidev_test
in your CoreELEC clone directory

What exactly is “CoreELEC clone directory”?

Running that command from an SSH session gives

-sh: ./build.CoreELEC-Amlogic-ng.arm-9.2-devel/toolchain/bin/armv8a-libreelec-linux-gnueabi-gcc: not found

I guess you have to install git and clone the CE source first to your local directory.

Yep, I’m really confused… Even if I cloned the CE source there is no build.CoreELEC-Amlogic-ng.arm-9.2-devel directory, not that it would matter as I’m on Windows anyway :frowning:

When you have a CoreELEC build environment you easily can compile such tools.
You should be able to compile it also on windows by cross compile for aarch64. I am sure you will get some hints on Google.

Unfortunately I don’t have access to a CoreELEC build environment :frowning:

I’ve have managed to get access to a logic analyser and can confirm that valid SPI data is being sent out of the N2’s SPI interface.

Now I just need to compare it to the data being sent from my working arduino code to see if there is any difference and try to figure out why the arduino can drive the display but the N2 can’t.

These screens support a maximum SPI clock of 10MHz, IIRC. Check what the SPI clock is set to on the N2.

I’ve tried various SPI clock speeds on the N2 with no luck. The Arduino UNO has a max SPI speed of I think 8MHz and I’ve tested it between 0.5MHz and 8MHz and it works fine.

As I said I’ve gotten access to a logic analyser so once I get some free time at the weekend I’ll capture the data from both the Arduino and the N2 and compare them. I’m guessing it’s just some simple timing issue.

1 Like

It’s possible that high/low logic is inverted. But you will see it with your logic analyser.

@roidy I’m currently using my epaper (it has reset,dc,cs,dat,clk,bsy pins) display with Le Potato running on an earlier NG build using SPI and it works fine, so I’m not sure what the problem you’re experiencing is.
Do you have the 2 GPIO pins hooked up? You need reset & dc connected and mapped correctly?

Yep, I’m using 2 GPIO pins, one for reset and one for D/C. I don’t think it’s a problem with the N2’s SPI interface or the Python SPI library I’m using as after a quick test with a logic analyser I’m getting valid SPI data out of the N2.

It will be something really simple like an error with my code or maybe a timing issue but I wont be able to have a proper look until I get some free time at the weekend.

1 Like