Post Go back to editing

How to handle ADT7302 from the user space C application? I'm currently developing the SPI application for Linux to read the temp. reading

Currently myself working with ADT7302 SPI sensor for monitoring temperature.

 

For that I have connect the sensor to Galileo board or Minnowboard MAX which are running Linux OS.

I'm not getting any kind of reading from the MISO line instead I got 0xFF always.

 

Now my question is how can I access through standard SPI ioctl syscall and SPI_IOC_MESSAGE macro.

Is the ADT7302 is partially read only sensor ? because from the data sheet I don't understand the how the sensor is perform communication to master. there are no any internal register like control register are provided at all.

 

I didn't found any kind of documents or code from the Google. So I think you are the only one person to giving me an answer because after all you were develop the driver for the same.

  • Hi,

    Did you have a look at the Linux driver, did you try to reproduce what it does? It seems to simply issue a 16 bit read. You can do the same with spidev by simply doing a read(fd, buf, 2).

    Also as always double check you cables and connections and pinmux setups.

    - Lars

  • Hi bhoomil,

    As per table 2, the maximum clock frequency that can be input to the ADT7302 is 20MHz, what's your serial clock frequency?

    No, there is no internal registers to be accessed through the SPI actually. Just follow figure 14, and the timing constraints stated, so you will be able to get data from the sensor. A bit of code is also shown in page 13 as a guideline. How often are you pulling the CS low? could you share scope shots of the interface pins (CS, SCLK, DOUT, DIN) so we could have a look at how are you operating the part and advice?

    Regards,

    Lluis.

  • Hi ,

    Would it be possible for you please to share a scope shot of the interface that capture both the first (correct) and second (wrong) SPI transactions along with your schematic?

    I will like to have a look and see if we can find out what may be going on.

    Regards,

    Lluis.

  • I want to know at which serial clock (in Hz) THE ADT7302 sensor operating.

    hello can you  clarify more on this.

    Linux user space is so far but right now I'm unable to read the data with Arduino Uno even.

  • I got the temp. values on MOSI line.

    Yup it is 20MHz I have seen that timing diagram.

    the while loop will only print 1st reading correct which is 24-27 degree Celsius,  the subsequent are 85-100 in between.

    I have already put the delay for setup time 10 microsecond and conversion delay as 10 minisecond in side the code as per the data sheet.

    I have operate the sensor with 1MHz 4MHz, 10MHz and 20 MHz all have same issue.

  • Helloww....

    I got the correct value after doing some trail and error with usec delay in the spi_trasfer struct on MinnowboardMax