Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
en:spi_dot_matrix [2016/05/18 15:30] charles.park [How to fix device tree blob with command line] |
en:spi_dot_matrix [2017/01/18 17:13] charles.park [Example of Scrolling Text] |
||
---|---|---|---|
Line 10: | Line 10: | ||
</WRAP> | </WRAP> | ||
- | ==== How to fix device tree blob with command line ==== | + | === How to enable driver (Only Ubuntu 16.04 or higher is required) === |
- | Install device tree compiler package. | + | Edit /etc/modprobe.d/blacklist-odroid.conf to comment out following two ines. |
- | sudo apt-get install device-tree-compiler | + | |
- | + | ||
- | Create exynos5422-odroidxu3.dts file. | + | |
<code> | <code> | ||
- | sudo -s | + | blacklist spidev |
- | cd /media/boot | + | blacklist spi_s3c64xx |
- | dtc -I dtb -O dts ./exynos5422-odroidxu3.dtb > ./exynos5422-odroidxu3.dts | + | |
- | </code> | + | |
- | + | ||
- | Edit dts file to use vi editor. | + | |
- | <code> | + | |
- | vi ./exynos5422-odroidxu3.dts | + | |
- | </code> | + | |
- | + | ||
- | Find string "spi@12d3" & add spi control data. | + | |
- | + | ||
- | <code> | + | |
- | ... | + | |
- | spi@12d30000 { | + | |
- | compatible = "samsung,exynos5410-spi"; | + | |
- | reg = <0x12d30000 0x100>; | + | |
- | interrupts = <0x0 0x45 0x0>; | + | |
- | dma-mode; | + | |
- | dmas = <0x43 0x5 0x43 0x4>; | + | |
- | dma-names = "tx", "rx"; | + | |
- | swap-mode; | + | |
- | #address-cells = <0x1>; | + | |
- | #size-cells = <0x0>; | + | |
- | clocks = <0x2 0x5cb 0x2 0x1027>; | + | |
- | clock-names = "spi", "spi_busclk0"; | + | |
- | pinctrl-names = "default"; | + | |
- | pinctrl-0 = <0x44>; | + | |
- | status = "okay"; | + | |
- | **cs-gpios = <0x45 0x5 0x0>;** | + | |
- | + | ||
- | /* ADD Line Start(spi control data) */ | + | |
- | samsung,spi-src-slk = <0>; | + | |
- | num-cs = <0>; | + | |
- | + | ||
- | spidev { | + | |
- | compatible = "spidev"; | + | |
- | reg = <0>; | + | |
- | spi-max-frequency = <20000000>; | + | |
- | + | ||
- | controller-data { | + | |
- | **cs-gpio = <0x45 0x5 0x0>;** | + | |
- | samsung,spi-feedback-delay = <0>; | + | |
- | }; | + | |
- | }; | + | |
- | /* ADD Line Ebd */ | + | |
- | }; | + | |
- | ... | + | |
- | </code> | + | |
- | + | ||
- | <WRAP center round important 100%> | + | |
- | controller-data 안의 **cs-gpio**값은 **cs-gpios** 와 동일하게 설정되어야 합니다. | + | |
- | </WRAP> | + | |
- | + | ||
- | Compile dts file & update | + | |
- | <code> | + | |
- | dtc -O dtb -o ./exynos5422-odroidxu3.dtb ./exynos5422-odroidxu3.dts | + | |
</code> | </code> | ||
Line 79: | Line 21: | ||
Check your SPI node. | Check your SPI node. | ||
ls /dev/spidev* | ls /dev/spidev* | ||
- | | + | |
==== Compile & run SPI test example source code ==== | ==== Compile & run SPI test example source code ==== | ||
Line 180: | 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 408: | Line 353: | ||
{ | { | ||
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; |