SPI Dot-Matrix

Post Reply
additude
Posts: 73
Joined: Sat Dec 02, 2017 8:02 pm
languages_spoken: english
ODROIDs: .
8-XU4's
11-MC1's
6 - N2's
Has thanked: 10 times
Been thanked: 1 time
Contact:

SPI Dot-Matrix

Unread post by additude » Fri Nov 29, 2019 8:25 pm

Is the SPI Dot-Matrix https://wiki.odroid.com/accessory/displ ... rix_shield compatible with the N2 ?

Do I need to start with installing spidev on the 18.04 image?

Any help appreciated.

User avatar
tobetter
Posts: 4260
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: X, X2, U2, U3, XU3, C1
Location: Paju, South Korea
Has thanked: 58 times
Been thanked: 234 times
Contact:

Re: SPI Dot-Matrix

Unread post by tobetter » Fri Nov 29, 2019 8:53 pm

additude wrote:Is the SPI Dot-Matrix https://wiki.odroid.com/accessory/displ ... rix_shield compatible with the N2 ?

Do I need to start with installing spidev on the 18.04 image?

Any help appreciated.
I think it would work if you success to enable SPI bus on ODROID-N2, here is the Wiki for it.
https://wiki.odroid.com/odroid-n2/appli ... _odroid-n2

Since I have not tested it yet, you would need to change the original code to give the SPI bus and channel.

"Tapatalk wishes you to have fun with ODROID"

These users thanked the author tobetter for the post:
additude (Sat Nov 30, 2019 9:47 pm)

additude
Posts: 73
Joined: Sat Dec 02, 2017 8:02 pm
languages_spoken: english
ODROIDs: .
8-XU4's
11-MC1's
6 - N2's
Has thanked: 10 times
Been thanked: 1 time
Contact:

Re: SPI Dot-Matrix

Unread post by additude » Fri Nov 29, 2019 10:22 pm

Thanks. I'll give it a try..

additude
Posts: 73
Joined: Sat Dec 02, 2017 8:02 pm
languages_spoken: english
ODROIDs: .
8-XU4's
11-MC1's
6 - N2's
Has thanked: 10 times
Been thanked: 1 time
Contact:

Re: SPI Dot-Matrix

Unread post by additude » Sat Nov 30, 2019 3:12 am

I already have the SPI Dot Matrix working on an XU4 after making a few changes to the original code like using spidev1.0 so I am novicely kind of aware of how it works.

For the N2, I installed all the requirements except spidev in this case ended up being spidev0.0 and after getting everything installed I was able to have success running the spidev_test.c which in lieu of reporting FF FF FF FF it would also light one single LED on the array.

Now seeing as I can have a working model with spidev1.0 I'm kind of thinking this is the issue.

One other thing I noticed was that when I compiled the original code it gave errors for shift_len on the N2 but the exact same code compiled just fine on the XU4
In this case, my START_STR is 124 Characters preceded by " and trailed by ". The XU4 compiles it just fine but as you can see the N2 compains about the " " as legitimate bytes saying it should be 124 + 1 + 1 for a total of 126.
The XU4 is fine with

Code: Select all

#define MAX_SHIFT_CHAR_COUNT    124 
But the N2 needs

Code: Select all

#define MAX_SHIFT_CHAR_COUNT    126 
gcc versions for both were the same and the N2 is current 18.04 and so is the XU4 (18.04)
So that puzzels me as well...
Here is the output of gcc

Code: Select all

dot_shift_test.c: In function 'main':
dot_shift_test.c:578:47: warning: ' ' directive writing 1 byte into a region of size 0 [-Wformat-overflow=]
         shift_len  = sprintf(&disp_str[0], "%s ", START_STR);
                                               ^
dot_shift_test.c:578:20: note: 'sprintf' output 126 bytes into a destination of size 124
         shift_len  = sprintf(&disp_str[0], "%s ", START_STR);
         ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
So I feel that something is missing or not working correctly.

additude
Posts: 73
Joined: Sat Dec 02, 2017 8:02 pm
languages_spoken: english
ODROIDs: .
8-XU4's
11-MC1's
6 - N2's
Has thanked: 10 times
Been thanked: 1 time
Contact:

Re: SPI Dot-Matrix

Unread post by additude » Sat Nov 30, 2019 8:26 pm

So I swapped out the SPI Dot Matrix that I have and I wired in an 8 x 32 (4 - 8x8 matrices in tandem) and I was able to get a scrolling display.
I guess I must have a broken SPI Dot Matrix.... I'll have to plug it into an XU4 Shifter Shield later and see if it's broke.
I'm still trying to understand why the compiler see's the " " as a byte character when those quote marks are just defining for the variable START_STR.
The displayed scroll on the matrices does not have quotes " " in the scroll and compiling the exact same code on the XU4 has no complaints.

User avatar
tobetter
Posts: 4260
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: X, X2, U2, U3, XU3, C1
Location: Paju, South Korea
Has thanked: 58 times
Been thanked: 234 times
Contact:

Re: SPI Dot-Matrix

Unread post by tobetter » Sat Nov 30, 2019 11:37 pm

additude wrote:
Sat Nov 30, 2019 8:26 pm
So I swapped out the SPI Dot Matrix that I have and I wired in an 8 x 32 (4 - 8x8 matrices in tandem) and I was able to get a scrolling display.
I guess I must have a broken SPI Dot Matrix.... I'll have to plug it into an XU4 Shifter Shield later and see if it's broke.
I'm still trying to understand why the compiler see's the " " as a byte character when those quote marks are just defining for the variable START_STR.
The displayed scroll on the matrices does not have quotes " " in the scroll and compiling the exact same code on the XU4 has no complaints.
Isn't sizeof(START_STR) is 124 and sizeof(&disp_str[0])? Then "%s ", START_STR becomes 126 bytes which exceeds 2 bytes more than sizeof(&disp_str[0]) if my understanding of your code is correct.

additude
Posts: 73
Joined: Sat Dec 02, 2017 8:02 pm
languages_spoken: english
ODROIDs: .
8-XU4's
11-MC1's
6 - N2's
Has thanked: 10 times
Been thanked: 1 time
Contact:

Re: SPI Dot-Matrix

Unread post by additude » Sun Dec 01, 2019 10:25 pm

So I ended up changing the code to:

Code: Select all

#define MAX_SHIFT_CHAR_COUNT    sizeof(START_STR)
and then I changed:

Code: Select all

shift_len = sprintf(&disp_str[0], "%s ", START_STR);
To:

Code: Select all

shift_len = sprintf(&disp_str[0], "%s", START_STR);
Removing the space out of "%s " and now dot_shift_test.c original code compiles no errors on both the XU4 and the N2.

I'm not sure that I fixed anything, maybe I just covered up some underlying issue instead.

So, for the time being... it's happy and working with my 8x32 matrix and I have it running an 8x64 matrix as well. With modifications of course.

Next I'll fix my hardware issue on my 8x96 matrix and it should work fine there as well.
These users thanked the author additude for the post:
odroid (Mon Dec 02, 2019 10:23 am)

Post Reply

Return to “Projects”

Who is online

Users browsing this forum: No registered users and 1 guest