1 Problem:I finished all operations needed to enable my SPI, but I can’t see spidev0.0 but spidev0.1 .
2 Problem:The speed of clk can’t be changed by programming or the seting in device tree;
in my dts:(when i set all spi-max-frequency = <0x100>, it didn’t work;)
spi@7000d400 {
compatible = "nvidia,tegra114-spi";
reg = <0x0 0x7000d400 0x0 0x200>;
interrupts = <0x0 0x3b 0x4>;
nvidia,dma-request-selector = <0x7 0xf>;
nvidia,memory-clients = <0xe>;
#address-cells = <0x1>;
#size-cells = <0x0>;
clocks = <0xc 0x29>;
status = "okay";
dmas = <0x7 0xf 0x7 0xf>;
dma-names = "rx", "tx";
spi-max-frequency = <0x17d7840>;
spi0_0 {
#address-cells = <0x1>;
#size-cells = <0x0>;
compatible = "spidev";
reg = <0x0>;
spi-max-frequency = <0x17d4870>;
controller-data{
nvidia,enable-hw-based-cs;
nvidia,cs-inactive-cycles=<0x1>;
nvidia,cs-setup-clk-count = <0x0>;
nvidia,cs-hold-clk-count = <0x0>;
nvidia,rx-clk-tap-delay = <0x0>;
nvidia,tx-clk-tap-delay = <0x0>;
};
};
spi0_1 {
#address-cells = <0x1>;
#size-cells = <0x0>;
compatible = "spidev";
reg = <0x1>;
spi-max-frequency = <0x17d4870>;
controller-data{
nvidia,enable-hw-based-cs;
nvidia,cs-inactive-cycles=<0x1>;
nvidia,cs-setup-clk-count = <0x0>;
nvidia,cs-hold-clk-count = <0x0>;
nvidia,rx-clk-tap-delay = <0x0>;
nvidia,tx-clk-tap-delay = <0x0>;
};
};
};
in my program :
__u32 speed=1000000;
if (ioctl(fd, SPI_IOC_WR_MAX_SPEED_HZ, &speed) > 0) {
perror("SPI write max_speed_hz");
return;
}
if (ioctl(fd, SPI_IOC_RD_MAX_SPEED_HZ, &speed) < 0) {
perror("SPI max_speed_hz");
return;
}
printf("%s: spi mode %d, %d bitsr, %d bitsw, %sper word, %d Hz max\n",
name, mode, bitsr, bitsw, lsb ? "(lsb first) " : "", speed);
when I print, it shows 1000000Hz max. However, the speed of clk in oscilloscope is 24MHz.
3 Problem: When the speed of clk is 24MHz, I transfer 16 bit when the CS is low using ioctl(). Also I choosed nvidia, enable-hw-based-cs.But the maxmium speed ia about 14KHz. How can I get higer speed? I found the same problem using the way in http://neurorobotictech.com/Community/Blog/tabid/184/ID/13/Using-the-Jetson-TK1-SPI--Part-3-Configuring-SPI-in-the-device-tree.aspx.
4 Reference: I referenced this paper http://neurorobotictech.com/Community/Blog/tabid/184/ID/13/Using-the-Jetson-TK1-SPI--Part-3-Configuring-SPI-in-the-device-tree.aspx. I finished all operation without using Grinch but the default kernel.