Ioctl spi read issue

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Ioctl spi read issue

1,222 次查看
Dhevan
Contributor IV

Hi,

  I am using imx8m mini board.

  We are trying to read two different spi data at a same time. but whenever we are reading two ioctl in two different thread. We are unable to read proper data.

  In one spi we need to read 13000 data per second and another spi we are reading 1000 data per second at a one second interval.

  If we stop one thread and another thread is running means we can able to read proper spi data. If both are running unable to read this much data and data mismatch also is there.

SPI Dts Configuration:

&ecspi2 {
        #address-cells = <1>;
        #size-cells = <0>;
        fsl,spi-num-chipselects = <1>;
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_ecspi2 &pinctrl_ecspi2_cs>;    
        cs-gpios = <&gpio5 13 GPIO_ACTIVE_LOW>;
        status = "okay";

        spidev0: spi@0 {
          reg = <0>;
          compatible = "rohm,dh2228fv";
          spi-max-frequency = <5000000>;
        };
};

&ecspi1 {
        #address-cells = <1>;
        #size-cells = <0>;
        fsl,spi-num-chipselects = <1>;
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_ecspi1 &pinctrl_ecspi1_cs>;    
        cs-gpios = <&gpio5 9 GPIO_ACTIVE_LOW>;
        status = "okay";

        spidev1: spi@0 {
          reg = <0>;
          compatible = "dh,dhcom-board";
          spi-max-frequency = <8000000>;
        };
};

 

User Space Code Thread 1:

	ioctl(g_adc_fd, SPI_IOC_MESSAGE(1), &pt_g_current_ltrans);

User Space Code Thread 2:

		ioctl(g_acc_fd, SPI_IOC_MESSAGE(1), &pt_accltrans);   // Kx134

 

We had tried thread synchronization also but this will reducing the data read speed.

Our solution if we write own device driver for particular sensor this issue will be resolve ?

Please help us to solve this issue.

Thanks & Regards,

       Vasu

 

标签 (1)
0 项奖励
回复
0 回复数