Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
en:spi_dot_matrix [2016/12/09 11:23] charles.park [How to fix device tree blob with command line] |
en:spi_dot_matrix [2017/06/16 14:05] (current) odroid [Example of Scrolling Text] |
||
---|---|---|---|
Line 10: | Line 10: | ||
</WRAP> | </WRAP> | ||
- | ==== How to enable driver (Ubuntu 16.04 only need) ==== | + | === How to enable driver (Only Ubuntu 16.04 or higher is required) === |
- | Edit /etc/modprobe.d/blacklist-odroid.conf to comment out following two lines. | + | Edit /etc/modprobe.d/blacklist-odroid.conf to comment out following two ines. |
<code> | <code> | ||
blacklist spidev | blacklist spidev | ||
Line 21: | Line 21: | ||
Check your SPI node. | Check your SPI node. | ||
ls /dev/spidev* | ls /dev/spidev* | ||
- | | + | |
- | After update, you might need a hard-boot. Reboot doesn't access the updated dtb file from time to time. | + | |
==== Compile & run SPI test example source code ==== | ==== Compile & run SPI test example source code ==== | ||
Line 123: | Line 123: | ||
struct spi_ioc_transfer tr; | struct spi_ioc_transfer tr; | ||
+ | memset((void *)&tr, 0x00, sizeof(tr)); | ||
+ | | ||
tr.tx_buf = (unsigned long)tx; | tr.tx_buf = (unsigned long)tx; | ||
tr.rx_buf = (unsigned long)rx; | tr.rx_buf = (unsigned long)rx; | ||
Line 201: | Line 203: | ||
==== Example of Scrolling Text ==== | ==== Example of Scrolling Text ==== | ||
+ | |||
+ | <WRAP round important 100%> | ||
+ | <color #00a2e8>**WiringPi SPI API**</color> 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 | ||
+ | else | ||
+ | Compile : gcc -o <create excute file name> <source file name> | ||
+ | </WRAP> | ||
+ | |||
+ | |||
<code> | <code> | ||
gcc -o dot_test dot_shift_test.c | gcc -o dot_test dot_shift_test.c | ||
Line 351: | Line 368: | ||
{ | { | ||
struct spi_ioc_transfer tr; | struct spi_ioc_transfer tr; | ||
+ | |||
+ | memset((void *)&tr, 0x00, sizeof(tr)); | ||
tr.tx_buf = (unsigned long)buf; | tr.tx_buf = (unsigned long)buf; |