I am using the chip "EFR32MG1P132F256GM48" in a customized pcb and "EmberZNet 18.104.22.168 GA SoC".
I need to read the "Si7021" sensor through I2c communication and send the information via ZigBee. However, I couldn't find any example/document showing how to enable and test the I2c using an "AppBuilder project".
I enabled the plugins "Temperature Si7021", "Relative Humidity Si7021" and "I2C Driver". In Hardware Configurator (.hwconf file), I configured it as follows:
However, when sending the reset command to the temperature sensor through the plugin, debugging I noticed that the callback: "halI2cWriteBytes(SI_7021_ADDR, & resetMsg, SEND_COMMAND_SIZE)" is returning "0xFF" (I2C_DRIVER_ERR_UNKOWN).
Sorry for the delay. We had some severe weather which caused a lot of power outages the past week.
When you are getting 0xFF in return, are you sure the sensor is returning that value? I think the sensor is returning NACK to the address and your host is not configured to handle the ACK error. So it's reading 0xFF.
The slave address for the Si7021 is 0x40. I notice that you didnt change the the address in the configurator. Can you please try changing the address?
Hello Daniel_H, thank you very much for your reply!
I even saw the news about severe climates in some parts of the world, I hope everything is right there.
Regarding the "Slave address", it would be used if I was using the device as a "Slave", right?
I ask this because in this case "EFR32MG1Pxxx" is the Master and Si7021 is his Slave. Or am I wrong?
And when I put a value in the "Slave address", it requires a value in the "Bus frequency".
And when the sensor is returning "0xFF", I believe that this is not the case. What it seems to me is that there is not even any communication between them, because this calback that I mentioned "halI2cWriteBytes" returns if the I2C "writing" was successful or not. And not the sensor response. Am I right?
Returns can be:
Does what I said make sense, or am I mistaken in my observation?
I appreciate your attention and availability!
Yes, the master/slave makes sense. I missed that.
Have you been able to view the i2c waveform? Can you send a scope capture for the i2c address by the master?
So, I analyzed the I2C pins, both the SCL and the SDA, with an oscilloscope. Both have some signal on their pins, which made me even more intrigued. It can be seen in the image below (1: SCL, 2: SDA).
I am in doubt as to whether this is a valid signal or just a noise.
I validated the sensor with another microcontroller, and it is working correctly. (NOTE: the signal was very similar to the image).
The hardware connections I checked and are correct.
Therefore, it makes me think the error may be in:
1- I2C configuration in the application;
Commenting on the items:
1: The I2C configuration in the application was made according to the images I added in the question.
2: For the bootloader, as it is not enabled with I2C by default, I generated a "bootloader-storage-internal-single-512k" changing only the following configuration:
Daniel_H, an update:
I increased the "time/DIV" and got this result:
These "pulses" are synchronized with the moment I send a message through the I2C (Read Temp).
So, can it be concluded that there is communication?