Arria 10 : max1619 temperature sensor

Hello,

I am using Arria 10 SoC in our custom board and configured all the peripherals and build the linux OS . One peripheral , max1619 need to be tested which is configured through i2c .the clock synthesizer(Si5338) is connected at 0x71. I have included max 1619 in our linux dts file under i2c as:
max@1a {
compatible = “maxim,max1619”;
reg = <0x1a>;
};
When I enter i2c commands at uboot terminal by stopping the autoboot , the below lines are printed :
SOCFPGA_ARRIA10 # i2c dev 0
i2c - I2C sub-system
SOCFPGA_ARRIA10 # i2c probe
Valid chip addresses: 1A 71

I have seen the following commands for i2c -
#Select the i2c bus
i2c dev
i2c dev 0
#Probe the device
i2c probe
i2c probe 0x60
#Read from the device
i2c read
i2c read 0x60 0x27 1 0x80200000
#Read and Display from the device
i2c md
i2c md 0x60 0x27 1
#Write to the device
i2c mw
i2c mw 0x60 0x30 0x20 1
But I am unable to understand , how to program max1619 through HPS ?
Please do help!

Thanks,
Priya

I’ll assume you are running Linux on your HPS so I’ll refer you to a post on this forum I made a while ago for using the I2C from the HPS with easy to use C routines. The post is titled " Useful I2C from the HPS on the A10 SoC Devkit board" so you should be able to find it with the search tool.
There is source code for three functions to Read, Write, and Write-Read to I2C devices. As long as you know the I2C addresses and some details about the bytes the devices need you should be up and running quickly. There are example programs if you have one of the A10 SoC Devkit boards that talk to the EEPROM and LCD installed on those boards. (they just read-write values, etc - if you don’t have that board the examples are still useful to relate to your device)
Good Luck!

Hello @PriyaJ,
could I ask if You have also compiled a driver into Your Linux kernel? The driver should do all necessary configuration of the thermometer and is able to give You a measured temperature via file.
A node in Device Tree acknowledges kernel that there is a device connected to specified controller of the I2C bus and this device could be controlled with the driver. In case there is any driver with matching “compatible” string, the node of Device Tree is skipped simply and You need to control the device manualy with I2C commands.
You could find the proper driver at these links:

Hope this could help You a bit.
Yours Jan Konečný.

Hello @JanKonecny,

I already had max1619 driver file (drivers/hwmon/max1619.c , Documentation/hwmon/max1619.rst , Documentation/devicetree/bindings/max1619.txt ,include/sensors/max1619.h) included in linux-socfpga which is used to build zImage.
I have used i2C commands at uboot level, which displayed following output:
i2c probe
valid chip addresses: 1A 71
i2c probe 0x1A
valid chip addresses: 1A
i2c md 0x1a 0x01
0001: 38 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 7…

Could you help how to access these commands at root level?
Thanks.

Hello @Jambie,

I saw the link, you have included the c-program for eeprom and lcd. I am having certain doubts as I want to access the max1619 IC to read the temperature , Do i need to write c code for this ? As i have included the drivers(max1619) in linux-socfpga , can i create a script which include the command for accessing the temperature??
I have seen commands : i2c md
But these commands work before autoboot(SOCFPGA-ARRIA10#) at uboot level.How to access these i2c commands at root level?
Thanks.

Hello @PriyaJ,
well, I am not sure what do You mean with ‘root level’. If You would like to control the thermometer manualy via I2C bus, You could use some i2c-capable programme (e.g. Busybox contain commands for i2c bus), or use driver of the thermometer. If You use the driver, You should not need to do anything at i2c bus. It is able to read and write parallely with driver and i2c-capable programme but it could mess things up.
All necessary configuration is done by the driver. You than could interract with the device (read the temperature or may set parameters) via system files of the driver at (for example) /sys/bus/iio/devices/iio:device…