Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
en:xu3_hardware_spi [2016/05/26 11:12] odroid [Reading the SPI Flash device ID on Expansion-Board] |
en:xu3_hardware_spi [2016/12/24 12:15] (current) odroid [Reading the SPI Flash device ID on Expansion-Board] |
||
---|---|---|---|
Line 7: | Line 7: | ||
To use the SPI, you first need to update the kernel version to "3.10.82" or higher. | To use the SPI, you first need to update the kernel version to "3.10.82" or higher. | ||
sudo apt-get update && sudo apt-get dist-upgrade | sudo apt-get update && sudo apt-get dist-upgrade | ||
+ | </WRAP> | ||
+ | <WRAP center round important 100%> | ||
SPI MODE 3 doesn't work by unknown reason. Please try to use the SPI MODE 0. | SPI MODE 3 doesn't work by unknown reason. Please try to use the SPI MODE 0. | ||
</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 | + | |
- | + | ||
- | Edit dtb file. | + | |
<code> | <code> | ||
- | sudo -s | + | blacklist spidev |
- | fdtput -t x /media/boot/exynos5422-odroidxu3.dtb /spi@12d30000 samsung,spi-src-clk 0 | + | blacklist spi_s3c64xx |
- | fdtput -t x /media/boot/exynos5422-odroidxu3.dtb /spi@12d30000 num-cs 0 | + | |
- | fdtput -c /media/boot/exynos5422-odroidxu3.dtb /spi@12d30000/spidev | + | |
- | fdtput -t s /media/boot/exynos5422-odroidxu3.dtb /spi@12d30000/spidev compatible "spidev" | + | |
- | fdtput -t x /media/boot/exynos5422-odroidxu3.dtb /spi@12d30000/spidev reg 0 | + | |
- | fdtput -t i /media/boot/exynos5422-odroidxu3.dtb /spi@12d30000/spidev spi-max-frequency 20000000 | + | |
- | fdtput -c /media/boot/exynos5422-odroidxu3.dtb /spi@12d30000/spidev/controller-data | + | |
- | fdtput -t x /media/boot/exynos5422-odroidxu3.dtb /spi@12d30000/spidev/controller-data cs-gpio 0x46, 0x5, 0x0 | + | |
- | fdtput -t x /media/boot/exynos5422-odroidxu3.dtb /spi@12d30000/spidev/controller-data samsung,spi-feedback-delay 0 | + | |
</code> | </code> | ||
Line 44: | Line 35: | ||
34 34 34 34 | 34 34 34 34 | ||
</code> | </code> | ||
+ | |||
+ | If you tie the MOSI and MISO pins, the output is "AB 00 00 00".\\ | ||
+ | We call it loopback test. | ||
+ | |||
<file c spidev_test.c> | <file c spidev_test.c> | ||
/* | /* | ||
Line 168: | Line 163: | ||
} | } | ||
</file> | </file> | ||
+ | |||
+ | |||
+ | **If you want to use 16bit/32bit length protocol with different SPI speed on XU4, refer this [[en:c1_hardware_spidev|c1_hardware_spidev]].** | ||
+ |