RE: CERN IPMC question

Hi Stefan,

Let me explain, what I mean.

To add my sensor I use the generated templates from you:

https://cern-ipmc.web.cern.ch/sensors

The Config file (XML) I filled in as I know the sensor parameters etc.

The Header file I didn’t modify at all.

In the C file, there is a part where I describe the sensor reading command:

/* ------------------------------------------------------------------ */

/* This section contains functions specific to the device. */

/* ------------------------------------------------------------------ */

unsigned char initialize_sensor_dcdc(unsigned short i2c_addr, unsigned short reg){

return 0x00;

}

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

*value = 0x00;

unsigned char data[2]; // 2 bytes Data Buffer as READ_VIN is 16-bit

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

if (i2c_dev_read_reg(i2c_addr, reg, data, 2)) return I2C_ERROR;

*value = ((data[1] << 6) + (data[0] >> 2)); // 8-bit READ_VIN mantissa [9:2]

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

}

Then the C file, there is a part, not specific for my sensor,

/* ------------------------------------------------------------------ */

/* This section contains Template sensor methods. */

/* ------------------------------------------------------------------ */

/* Fill the Get Sensor Reading reply */

static char sensor_dcdc_fill_rd(sensor_t *sensor, unsigned char *msg){

/* Get instance index using the pointer address */

unsigned char i, sval, error;

i = ((sensor_dcdc_t *) sensor) - sensor_dcdc;

if (sensor_dcdc_initialized[i]) {

sensor_dcdc_initialized[i] = initialize_sensor_dcdc(sensor_dcdc_ro[i].i2c_addr, sensor_dcdc_ro[i].reg);

}

error = read_sensor_dcdc(&sval, sensor_dcdc_ro[i].i2c_addr, sensor_dcdc_ro[i].reg);

/* Update sensor value */

if (error == 0){

sensor_threshold_update_s(&sensor_dcdc[i].sensor, sval, 0);

}

return sensor_threshold_fill_reading(sensor, msg);

}

My understanding that part is related to the internal IPMC functionality and I’m not supposed to modify it.

You suggest to look at the example the sensor driver code of the temperature sensor on the IPMC here:

https://gitlab.cern.ch/ep-ese-be-xtca/ipmc-project/-/blob/master/ipmc-sensors/sensor_mcp9801.c#L112

The function here is:

static void sensor_mcp9801_update_reading(unsigned char num, unsigned char flags)

is quite different from my:

static char sensor_dcdc_fill_rd(sensor_t *sensor, unsigned char *msg)

It uses the function

monly_i2c_is_ready(addr)

where

addr = PRG_RD(sensor_mcp9801_ro[num].i2c_addr);

I understand, that I have to use this function - monly_i2c_is_ready(addr) in my code, around

error = read_sensor_dcdc(&sval, sensor_dcdc_ro[i].i2c_addr, sensor_dcdc_ro[i].reg);

But I ‘m not sure how to get the (addr) for the monly_i2c_is_ready(addr) as I don’t have the “num”.

So, will be grateful if you can tell me the implementation.

Please, let me know if my question is not clear.

Thank you,

Yuri

image001.jpg

Hi Stefan,

Thank you for your explanations and suggestions - now all looks good.

Will look into the payload power off.

Cheers,

Yuri

image001.jpg

Hi Stefan,

It looks like CERN IPMC compilation doesn’t work.

When I try to compile, I got the message:

CERN Username: ermoline

CERN Password:

NetworkError: HTTP status code 500

Can you, please, have a look?

Thank you,

Yuri

image001.jpg

Hi Yuri,

I’ll have a look at what is going on with the remote compilation.

Cheers,

Ralf.

image001.jpg

Hi Ralf,

Thank you!

Yuri

image001.jpg

Hi Yuri,

Could you give a try please?

Cheers,

Ralf.

image001.jpg

Hi Ralf,

Now it works.

Thank you,

Yuri

image001.jpg

Hi Yuri,

Thanks for your feedback. Happy compiling :wink:

Cheers,

Ralf.

image001.jpg

Hi Ralf,

Thank you for helping!

Cheers,

Yuri

image001.jpg

Hello,

I have a question regarding the sensor numbering in the CERN IPMC FW.

(Just for my curiosity).

During compilation I got the message with sensor numbers:

Sensor configuration:

DONE: SDR file initialized

DONE: Device locator ID “L1Calo_Hub” [SDR #0]

DONE: ATCA Hotswap sensor [SDR #1]

DONE: IPMB Sensor [SDR #2]

DONE: Version change Sensor [SDR #3]

DONE: Sensor “Internal temp.” added [SDR #4]

DONE: Sensor “HUB_IQ65033_CURR” added [SDR #5]

DONE: Sensor “HUB_IQ65033_TEMP” added [SDR #6]

DONE: Sensor “HUB_SYSMON_TEMP” added [SDR #7]

DONE: Sensor “HUB_DCDC1_VIN” added [SDR #8]

DONE: Sensor “ROD_LM82_LOCAL” added [SDR #9]

DONE: Sensor “ROD_LM82_FPGA” added [SDR #10]

---------------------> There are no auto-enable sensors

After loading the FW and reading sensors, the numbers are different:

clia sensordata 84

84: LUN: 0, Sensor # 0 (“Hot Swap”)

84: LUN: 0, Sensor # 2 (“IPMB Physical”)

84: LUN: 0, Sensor # 1 (“Version change”)

84: LUN: 0, Sensor # 3 (“Internal temp.”)

84: LUN: 0, Sensor # 8 (“HUB_IQ65033_CURR”)

84: LUN: 0, Sensor # 9 (“HUB_IQ65033_TEMP”)

84: LUN: 0, Sensor # 5 (“HUB_SYSMON_TEMP”)

84: LUN: 0, Sensor # 4 (“HUB_DCDC1_VIN”)

84: LUN: 0, Sensor # 6 (“ROD_LM82_LOCAL”)

84: LUN: 0, Sensor # 7 (“ROD_LM82_FPGA”)

Is it OK?

Thank you,

Yuri

image001.jpg