So I tried to run following code to read SPI registers.
I could get pointer of SPI register but my Jetson NANO topped when reading CMD1 register.
Is there an expert to know why Jetson stopped?
I already tried user space SPI interfacing method. It worked well.
But my application has a real time issue. So I use RT preempt patched kernel.
In this case when thread go into kernel space, I can’t be sure when it come out.
The performance of user space SPI interfacing was not time deterministic.
So, I would like to develop simple user space SPI driver.
In the case of GPIO, I could developed user space GPIO driver using mmap.
When I used ioctl call to use spi. the maximum time to be consumed to call ioctl was over than 50ms. (SPI configuration: 16bits, 2MHz speed)
In this case, RT-patched timer accuracy was under 1ms and the priority of spi thread was higher than the priority of timer thread.
I don’t know the reason to consume 50ms.
I could not expect deterministic performance if I use ioctl.
So I tired to use mmap.
//code using ioctl
clock_gettime(0,&t);
t1 = t.tv_sec*1000000000+t.tv_nsec; // struct timespec t
ret = ioctl(fd,SPI_IOC_MESSAGE(1), &tr); // tr.len = 3
clock_gettime(0,&t);
t2 = t.tv_sec*1000000000+t.tv_nsec; // struct timespec t
From Tegra X1 Technical Reference Manual, address map of SPI and its functions are well explained.
And I will use polling method not interrupt method in future my simple SPI user-space driver.
My hardware was already verified by the test of ioctl SPI interface.
If I could access registers of SPI, it is possible to develop simple user-space driver.
For this , I need to be able to access registers of SPI.
for the case of GPIO, it was possible to access registers. but when I apply similar way to SPI, Jetson hang.