This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux/TMP401: tmp401 driver function question

Part Number: TMP401

Tool/software: Linux

Hello FAE,

I am using tmp401 for my project, I found linux kernel already had the driver,so checked it and Recompiled the kernel.It worked,and already entered probe function,but ,when I using command "cat " to read the temperture,The return value has always been 85000,whatever i heat the sensor,the value will not change.Is there any documents to describe the driver function and how to use it,or can you tell me how does 85000 means?

Thank you

Jesse

  • Dear user 4744899 - 

    is it possible you are cat'ing a different file? can you double check that and that you have connected the device correctly, etc (are there other sensors in the system?)

  • I double checked the device connect  was correctly,and there were only 1 sensor in i2c-0 bus.

    under this folder:/sys/devices/platform/sopc@0/ffc02200.i2c/i2c-0/0-004c/hwmon/hwmon0/
    there are some tmp401 nodes:

    temp1_crit        temp1_max         temp2_crit        temp2_input       temp2_min_alarm
    temp1_crit_alarm  temp1_max_alarm   temp2_crit_alarm  temp2_max
    temp1_crit_hyst   temp1_min         temp2_crit_hyst   temp2_max_alarm
    temp1_input       temp1_min_alarm   temp2_fault       temp2_min


    I tried to use cat /sys/devices/platform/sopc@0/ffc02200.i2c/i2c-0/0-004c/hwmon/hwmon0/te
    mp1_crit ,but the answer was 85000,should I use another way to get temperature?

  • Perhaps use the one here? https://github.com/torvalds/linux/blob/master/drivers/hwmon/tmp401.c

    Are you not reading the register 0x00? can you check the I2C line to see what you are sending? i wonder if you are getting back what the limit is set for - as those registers are default 85C and it would makes sense for you to read that value, if that is the register you are actually reading (would be register 0x19 or 0x20, versus 0x00)

  • Thanks for your help,I solved the problem by cating temp1_input .now I can read temperature.Many thanks