RE: CERN IPMC question

Hi Stefan,

Thank you! Trying to implement your suggestion:

unsigned char read_sensor_xcvu125(unsigned char *value, unsigned short i2c_addr){

// Command is 4 bytes as DPR Read command is 32-bit (p.62 Figure 3-10)

// [31:30] = xx (set to 00)

// [29:26] = CMD [3:0]=0001 for DPR Read (p.63 Table 3-11)

// [25:16] = DPR Address [9:0] = 0 for Temperature register

// [15:0] = DPR Data [15:0] - N/A for Read command, set to 0

// 00_0001_0000000000_0000000000000000 > 0000_0100_0000_0000 > 0x04000000

unsigned int reg = 0x04000000;

// Data Buffer

unsigned char dataBuff[2]; // 2 bytes as DPR Data is 16-bit

// char i2c_dev_read_4bytesReg(unsigned short addr, unsigned int reg, unsigned char *pdata, unsigned char size)

char i2c_dev_read_4bytesReg(i2c_addr, reg, dataBuff, 2);

// Temperature register [15:0], temperature data 10-bit → Bit15=MSB Bit6=LSB

// 8 MSB from dataBuff[1]=Data[15:8]

*value = dataBuff[1];

return 0x00; //return non-zero value in case of reading error (sensor not updated)

}

However, got the error:

→ Compile IPMC source code

make: Entering directory ‘/tmp/comp-4j5EU7HJQ1’

ipmc-sensors/sensor_xcvu125.c: In function ‘read_sensor_xcvu125’:

ipmc-sensors/sensor_xcvu125.c:106: error: expected ‘)’ before numeric constant

ipmc-sensors/sensor_xcvu125.c:100: warning: unused variable ‘reg’

make: *** [ipmc-core/NR-RULES:104: ipmc-core/.objs/ipmc-sensors/sensor_xcvu125.o] Error 1

make: Leaving directory ‘/tmp/comp-4j5EU7HJQ1’

Error: IPMC configuration failed. This issue has been automatically reported

→ Compilation error

Cheers,

Yuri

image001.jpg

Hello Yuri,

I thinks this is a simple syntax error, the following is not valid C code in side a function (the “char” does not belong there):

char i2c_dev_read_4bytesReg(i2c_addr, reg, dataBuff, 2);

image001.jpg

Hi Stefan,

Thank you, removed “char” and it compiles.

But unfortunately still reading nonsense…

clia sensordata -v 82

Pigeon Point Shelf Manager Command Line Interpreter

82: LUN: 0, Sensor # 6 (“HUB_FPGA_SYSMON”)

Type: Threshold (0x01), “Temperature” (0x01)

Belongs to entity (0xa0, 0x60): FRU # 0

Status: 0xc0

All event messages enabled from this sensor

Sensor scanning enabled

Initial update completed

Raw data: 2 (0x02)

Processed data: -269.080000 degrees C

Current State Mask: 0xc0

The data shall be something like

Raw data: 164 (0xa4)

Processed data: 47.440000 degrees C

This is what I read by the LAPP IPMC in other HUB.

May be we can sit together in front of my PC tomorrow morning and have a look?

Thank you,

Yuri

image001.jpg

Hello Yuri,

I’m afraid I don’t have time this week. But here are a few questions/suggestions:

  • Add debug output to your sensor driver (using debug_printf). For instance you need to look at the return status of the I2C function as well as the data that is returned.
  • What is the value of the i2c_addr parameter?
  • Do you have any other sensors that work on this board? BTW, what is the project/board you are working on?
  • Can you test a write command as well? Do you actually get the acknowledge in this case? You can then check the written register value via the JTAG interface.

If you want us to help you further, we need the XML file as well as all the files in the ipmc-user and ipmc-sensor directories.

cheers,

Stefan

image001.jpg

Hi Stefan.

Thank you! Will prepare…

BTW, can I have a look at this command implementation:

char i2c_dev_read_4bytesReg(unsigned short addr, unsigned int reg, unsigned char *pdata, unsigned char size)

Is it doing what I need (Fig.3-18 below)?

Cheers,

Yuri

image001.jpg

Hello Yuri,

please see the code of the function below:

char i2c_dev_read_4bytesReg(unsigned short addr, unsigned int reg,
unsigned char *pdata, unsigned char size)
{
if ((monly_i2c_io(addr | I2C_WRITE | I2C_START, (unsigned char *)&reg, sizeof(reg)) !=
sizeof(reg)) || (monly_i2c_io(addr | I2C_READ | I2C_RSTART |
I2C_STOP, pdata, size) != size)) {
debug_printf(“I2C dev read error, I2C address: %02x%02x \n”,addr >> 8,addr & 0xFF);
return -1;
}

return 0;
}

I believe this is doing what you want: write 4 bytes followed by a repeated start and a read. If you have access to the source code of the LAPP function, it may be interesting to compare, in particular concerning the byte order.

However you should first establish that the SYSMON actually replies to bus cycles at the address that you specified. You can test this easier with a write, since you don’t have the complication of the repeated start.

cheers,

Stefan

image001.jpg

Hi Stefan,

Our project is the HUB module in the L1Calo trigger shelf.

There are many sensors that I read with the LAPP IPMC:

https://docs.google.com/spreadsheets/d/1BFNOw8KDbbPJE9ph76xQlZD-13EiVrK25Ypcw2KsjuY/edit#gid=436367815

OK, for now I put aside the SysMon reading and tried with the Power Entry module.

(IQ65033 datasheet attached for your eventual reference).

This is the only I2C device on the MGT I2C bus:

https://web.pa.msu.edu/hep/atlas/l1calo/hub/hardware/drawings/Circuit_Diagrams/14_ipmc_mgt_i2c_alarm_enb_leds.pdf

(there is no eeprom).

I generated files for this device (current and temperature sensor) and added necessary modifications (files attached).

According to the datasheet, I have to write a data pointer first and then read the data.

So, implementation shall be rather simple and use two commands:

unsigned char read_sensor_iq65033(unsigned char *value, unsigned short i2c_addr, unsigned char reg){

// Write Data_Pointer

// char i2c_dev_write(unsigned short addr, unsigned char *pdata, unsigned char size)

i2c_dev_write(i2c_addr, &reg, 1);

// Read Data

// char i2c_dev_read(unsigned short addr, unsigned char *pdata, unsigned char size)

i2c_dev_read(i2c_addr, value, 1);

return 0x00; //return non-zero value in case of reading error (sensor not updated)

}

However, when I read the sensors, I got:

82: LUN: 0, Sensor # 4 (“HUB_IQ65033_CURR”)

Type: Threshold (0x01), “Current” (0x03)

Belongs to entity (0xa0, 0x60): FRU # 0

Status: 0xc0

All event messages enabled from this sensor

Sensor scanning enabled

Initial update completed

Raw data: 32 (0x20)

Processed data: 3.008000 Amps

Current State Mask: 0xc0

82: LUN: 0, Sensor # 5 (“HUB_IQ65033_TEMP”)

Type: Threshold (0x01), “Temperature” (0x01)

Belongs to entity (0xa0, 0x60): FRU # 0

Status: 0xc0

All event messages enabled from this sensor

Sensor scanning enabled

Initial update completed

Raw data: 32 (0x20)

Processed data: 12.720000 degrees C

Current State Mask: 0xc0

Processed data are not correct (I compared with other HUBs read by LAPP IPMC).

And both sensors returned the same raw value (0x20).

This may be a sign of something wrong.

Do you have any idea?

Thank you,

Yuri

image001.jpg

(Attachment IQ65033QGA12.pdf is missing)

(Attachment sensor_iq65033.xml is missing)

(Attachment sensor_iq65033.c is missing)

(Attachment sensor_iq65033.h is missing)

Hello Yuri,

I’m afraid that without having access to the sources of the project (XML file, sensor drivers, user files) I cannot really help you much. I don’t even know which I2C address you are using. If this device is on the MGT I2C bus, you also need to set the upper 8 bits of the address to 0x01, see here:

https://gitlab.cern.ch/ep-ese-be-xtca/ipmc-project/-/blob/master/ipmc-user/user_oem.c#L60

You also need to check the return status of the I2C access functions and add debug printouts to your sensor driver code.

I also see that you have an LM82 sensor on-board. The IPMC for the eFEX has a sensor driver for this I believe, Paul will know.

cheers,

Stefan

image001.jpg

Hi Stefan,

Thank you for your kind refusal.

In fact all these files were attached to the previous email, but as I see you didn’t even look.

Cheers,

Yuri

image001.jpg

Dear Yuri,

The culprit might have been Discourse, which removed all attachments. I am trying to find out how to fix that.

Cheers,
Ralf.

Dear Yuri,

The culprit might have been Discourse, which removed all attachments. I am trying to find out how to fix that.

Cheers,
Ralf

image001.jpg