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

PSoC™ 6 Forum Discussions

as234
Level 1
Level 1
10 sign-ins First reply posted 5 sign-ins

Hello,

I am supposed to interface a SGP40 VOC Sensor Waveshare 20168 SGP40 VOC Sensor, 17,90 € - Welectron with a CY8PROTO-062-4343W board via I2C. Since I have no experience with this, I copied the code snippets from here PSoC 6 Peripheral Driver Library: I2C (SCB) (infineon.github.io) into Eclipse IDE (attached). The output when running the code is only 0s. I don’t know how to modify the code to make it work or if this is even possible without writing a whole new library for the sensor?

Thanks for any advice!

0 Likes
1 Solution
Sidramesh
Moderator
Moderator
Moderator
10 solutions authored 25 replies posted 5 solutions authored

Hi @as234 ,

You must implement the code according to the below Transaction mentioned in the Communication protocol section in the SGP40 sensor datasheet. You can see the description of each API and implement it according to the below.

Sidramesh_0-1672744190006.png

Thanks and regards,
Sidramesh

View solution in original post

0 Likes
3 Replies
Sidramesh
Moderator
Moderator
Moderator
10 solutions authored 25 replies posted 5 solutions authored

Hi @as234 ,

Please elaborate on your concern in detail. So, are you facing difficulties in initiating communication with the sensor? You mentioned the output of the code is 0s only, so do you mean the I2C lines pulled low? 

Did you receive an ACK upon address match?

also please share the datasheet of the SGP40 Sensor.

Thanks and regards,

Sidramesh

0 Likes

Hi @Sidramesh ,

https://www.waveshare.com/wiki/SGP40_VOC_Sensor

I am trying to show the data from the sensor on an UART terminal. It shows only 0s.

I have no idea how to find out wether I received an ACK. That‘s basically the problem: I‘m new to programming and have never worked with I2C before, so I don‘t really know what I need to do.

Thanks,

as234


0 Likes
Sidramesh
Moderator
Moderator
Moderator
10 solutions authored 25 replies posted 5 solutions authored

Hi @as234 ,

You must implement the code according to the below Transaction mentioned in the Communication protocol section in the SGP40 sensor datasheet. You can see the description of each API and implement it according to the below.

Sidramesh_0-1672744190006.png

Thanks and regards,
Sidramesh

0 Likes