SPI Dot-Matrix



ODROID-XU4 with shifter shield
ODROID-XU4 with shifter shield

Prepare SPI


To use the SPI, you first need to update the kernel version to “3.10.82” or higher.

  sudo apt update && sudo apt dist-upgrade

To use spidev on your ODROID-XU4 you should fix the device tree source.

Edit /etc/modprobe.d/blacklist-odroid.conf to comment out following two ines. This method requires Ubuntu 16.04 or higher.

blacklist spidev
blacklist spi_s3c64xx




  • Since the C2 doesn't support Hardware SPI. This Example is using the GPIO-based bitbanging SPI Master. In this case, the maximum clock is about 390KHz.
  • Update the Kernel first. These module drivers are available on 3.14.29-32 or higher.

Load required modules.

sudo modprobe spi-bitbang
sudo modprobe spi-gpio
sudo modprobe spidev

Then you can check using lsmod command.

odroid@odroid64:~$ lsmod
Module                  Size  Used by
spidev                  5785  0
spi_gpio                5978  0
spi_bitbang             3637  1 spi_gpio
fuse                   77425  3
autofs4                24813  2


Load required modules.

sudo modprobe spicc    

Then you can check using lsmod command.

root@odroid:~# lsmod                                                            
Module                  Size  Used by                                           
ads7846                13766  0                                                 
spidev                  5465  0                                                 
spicc                   7846  0                                                 
uinput                  6669  1                                                 
ir_lirc_codec           4243  3                                                 
lirc_dev               10110  1 ir_lirc_codec                                   
ir_mce_kbd_decoder      3092  0                                                 
ir_sanyo_decoder        1638  0                                                 
ir_sony_decoder         1667  0                                                 
ir_jvc_decoder          1664  0                                                 
ir_rc6_decoder          2024  0                                                 
ir_rc5_decoder          1552  0                                                 
ir_nec_decoder          1776  0                                                 
meson_ir                2902  0                                                 
joydev                  8607  0                                                 
hid_logitech_dj        11642  0                                                 
fuse                   70879  2                                                 
nls_cp437               5125  1 

Check if the SPI works


odroid@odroid:~$ ls /dev/spidev*


odroid@odroid64:~$ ls /dev/spidev0.0

Example code : dot_test.c

odroid@odroid64:~$ wget https://dn.odroid.com/Accessory/examples/Dot-Matrix/dot_test.c
odroid@odroid64:~$ gcc -o dot_test dot_test.c
odroid@odroid64:~$ sudo ./dot_test
spi mode: 0
bits per word: 8
max speed: 500000 Hz (500 KHz)
  • ODROID-C2 - Set to 500 KHz, but it is actually operating at 390KHz.

Example of Scrolling Text

Example code : dot_shift_test.c dotfont.h

WiringPi SPI API use case :

Uncomment this line first. #define USE_WIRING_PI_LIB

Build the example with proper library option. if defined USE_WIRING_PI_LIB

    Compile : gcc -o <create excute file name> <source file name> -lwiringPi -lwiringPiDev -lpthread


    Compile : gcc -o <create excute file name> <source file name>

spidev node : dot_shift_test.c line 68-69 (Uncomment each model)

  #define SPIDEV_NODE_NAME    "/dev/spidev0.0"    // ODROID-C1/C1+/C2
  //#define SPIDEV_NODE_NAME    "/dev/spidev1.0"    // ODROID-XU3/XU4
odroid@odroid64:~$ wget https://dn.odroid.com/Accessory/examples/Dot-Matrix/dot_shift_test.c
odroid@odroid64:~$ wget https://dn.odroid.com/Accessory/examples/Dot-Matrix/dotfont.h
odroid@odroid64:~$ gcc -o dot_shift_test dot_shift_test.c
odroid@odroid64:~$ sudo ./dot_shift_test
max speed: 1000000 Hz (1000 KHz)