EVAL_PASCO2_MINIBOARD I2C

Announcements

Measure CO2 When It Matters - Infineon’s XENSIV™ PAS CO2 now comes in SparkFun Red. Check it now!

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
kbs
Level 1
Level 1
5 sign-ins First like received First reply posted

Hi, I am trying to interface an external MCU with EVAL_PASCO2_MINIBOARD using i2c at bus speed of 100 kHz. I tried reading several registers 0x00, 0x01, 0x0F, etc. But with all read attempts I am only getting the return data value 74 (0x4A).  Irrespective of the register address the return data is always 74, when the board is powered-up. I don't have any issue in communicating with other i2c peripherals on the same board. Any idea what this might be happening? 

I am programming in LUA on a NODEMCU board interface to MINIBOARD, with the following code:

co2_address = 0x28

i2c.setup(self.id, sda, scl, i2c.SLOW);  \\SLOW=100kHz

----------------------------------------------------------------------

//Read Function

read_reg = function(self, reg_addr)
i2c.start(self.id)
i2c.address(self.id, co2_address, i2c.TRANSMITTER)
i2c.write(self.id, reg_addr)
i2c.stop(self.id)
i2c.start(self.id)
i2c.address(self.id, co2_address, i2c.RECEIVER)
c=i2c.read(self.id,1)
i2c.stop(self.id)
return c
end

------------------------------------------------------------------------

reg = co2_sensor:read_reg(0, 0x01)
print(string.byte(reg))

-------------------------------------

Console Print = 74

 

Thanks for any advise.

0 Likes
1 Solution
YashM
Moderator
Moderator
Moderator
50 solutions authored First question asked 250 sign-ins

Hi

You seem to be reading the register at address 0x00 always and hence you're receiving the return value of 0x4A.

I suggest you to check the following API "reg = co2_sensor:read_reg(0, 0x01)" as it might be reading the register at 0x00 instead of 0x01.

Also, you can follow the application notes Programming_guide_PAS_CO2_evaluationkit and Registermap_description_PASCO2 for more information.

Do let me know your observations.

Thanks

View solution in original post

0 Likes
2 Replies
YashM
Moderator
Moderator
Moderator
50 solutions authored First question asked 250 sign-ins

Hi

You seem to be reading the register at address 0x00 always and hence you're receiving the return value of 0x4A.

I suggest you to check the following API "reg = co2_sensor:read_reg(0, 0x01)" as it might be reading the register at 0x00 instead of 0x01.

Also, you can follow the application notes Programming_guide_PAS_CO2_evaluationkit and Registermap_description_PASCO2 for more information.

Do let me know your observations.

Thanks

0 Likes
kbs
Level 1
Level 1
5 sign-ins First like received First reply posted

Hi YashM,

Thanks for your reply. I solved the problem. It was a trivial programming error on my end, not related to the CO2 sensor. Just for your reference, following is my original code and the fixed code. 

//reg = co2_sensor:read_reg(0, 0x01); (the first 0 was supposed to be the i2c channel #)
reg = co2_sensor:read_reg(0x01); \\apparently, I don't have to specify the i2c channel #

Thanks