UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
311 Views
Registered: ‎04-18-2019

ZC702 Petalinux 2018.2 Power Monitoring UCD9248

Greetings,

I am trying to read 52, 53 and 54 I2C addresses ( UCD9248 ) via Petalinux user space application referred Zynq-7000 AP SoC Low Power Tech. part 4- Measuring ZC702 Power with a Linux App. I took C source file and header file there and then I integrated them into my Petlainux Project. So far, I got nothing. 

In the power_monitor.c file which is supplied by Xilinx, I've changed the line 

iic_fd = open("/dev/i2c-9", O_RDWR); as iic_fd = open("/dev/i2c-0", O_RDWR);

since I've only seen i2c-0 device on location /sys/bus/i2c/devices and the drivers ucd9000, at24, pca9541, rtc-pcf8563, ucd9200, dummy, pca954x, si570 on location /sys/bus/i2c/drivers 

I uploaded C code, but in .txt format. I got an error message : 

SMBus Write Byte data : : No such device or address
readvoltage ERROR: Unable to write page address to I2C slave at 0x34: -1

/*

if (ioctl(iic_fd, I2C_SLAVE, deviceAddress) < 0) {
printf("readvoltage ERROR: Unable to set I2C slave address 0x%02X\n", deviceAddress);
perror("Set I2C Slave : ");
exit(1);
}

status = i2c_smbus_write_byte_data(iic_fd, CMD_PAGE, pageAddress);
if (status < 0) {
perror(" SMBus Write Byte data : ");
printf(" readvoltage ERROR: Unable to write page address to I2C slave at 0x%02X: %d\n", deviceAddress, status);
exit(1);
}


where deviceAddress is defined as 52

*/

and I've also changed the line 

current = mantissa * pow(2.0, exponent); as current = mantissa * (2^exponent); 

since petalinux-build command didn't compile it. I've modified Makefile file and .bb file properly.

 

Despite of the modifications, I got nothing. I've tracked booting information messages on terminal ( connected by UART, boot from SDCard ) and realized only thing related to i2c is the info "i2c /dev entries driver" and could not find any information or initialization related to UCD9248, PCA9548 Mux, EEPROM or RTC in configuration files which are generated automatically by Xilinx ( zynq-7000.dtsi, system-top.dts, pcw.dtsi files etc. ) Should I modify system-user.dtsi file?

 

By the way, I am not able to read value through linux file at the path : /sys/bus/i2c/devices/8-003[4,5,6]/hwmon/hwmon0/

 

I need to read powers, currents and voltages on UCD9248 rails and do not know what to do. Any information you may provide me would be greately appreciated.

 

Sincerely,

Omer

0 Kudos
1 Reply
Visitor iliya
Visitor
182 Views
Registered: ‎07-25-2019

Re: ZC702 Petalinux 2018.2 Power Monitoring UCD9248

I would suggest in first place to scan the i2c buss for devices. The i2cdetect command can help you do that. It outputs a table with the list of detected devices on the specified bus.
Here is an example usage of the comand to scan the i2cbus:

i2cdetect -r -y 0

* If you do not have the i2cdetect installed on your platform you can add it like this:

petalinux-config -c rootfs

Location: Filesystem Packages  -> base  -> i2c-tools

Check the field next to i2c-tools by clicking Enter.  It should look like this i2c-tools[*].

Pres Esc to exit the menu and save the changes.

Build the project and flash the target device and  the i2cdetect command should be available.

 

From what I see in the error message you are trying to write the address 0x34 (which is actually 52 in decimal). If you want to write address 0x52 of the i2c bus try to change the value in device  from 52 to 0x52. It should look something like this.

 struct voltage_rail zc702_rails[] = {
     { name : "VccInt ",
       device : 0x52,

You should change all the device entries in the table from decimal to hexadecimal notation just by adding '0x ' in front of them

0 Kudos