DA14850 communicating with Si705 temperature sensor.

⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at https://www.dialog-semiconductor.com/support . We’ll be fixing bugs / optimising the searching and tagging over the coming days.
2 posts / 0 new
Last post
kaptajnen
Offline
Last seen: 2 years 11 months ago
Joined: 2019-09-19 08:46
DA14850 communicating with Si705 temperature sensor.

Hi, I'm trying to read the temperature from Si705. I have connectiong to the sensor, as I have tested it, when I read the firmware-version using the measurement-process described in this pdf (https://www.silabs.com/documents/public/data-sheets/Si7050-1-3-4-5-A20.pdf) page 16. However, when I try to read the temperature, my output ends up being 0, 0. As of now my code is this:

        uint8_t cmd;

        uint8_t data[2];

        uint16_t degrees;

        cmd = Temp_H;

        user_i2c_set_slave_address(Si705_I2C_ADDRESS);

        user_i2c_multi_byte_read(cmd, data, 2);

        degrees = convert_to_uint16(data);

        degrees = convert_to_celsius(degrees);

        return degrees;

 

The code I'm using to read the bytes is the following:

void user_i2c_multi_byte_read(uint32_t reg_address, uint8_t *rd_data, uint32_t num_bytes) {

    user_i2c_send_address(reg_address);

          uint32_t index = 0;

          for(uint32_t i = 0; i < num_bytes;){

       SEND_I2C_COMMAND(0x0100 & 0x3FF); // Set R/W bit to 1 (read access) MSB

                         if(!(++i % 24)){ //FIFO is 32 bits

                      WAIT_UNTIL_I2C_FIFO_IS_EMPTY();                 // Wait until Tx FIFO is empty

          WAIT_UNTIL_NO_MASTER_ACTIVITY();                // wait until no master activity

                                  for (uint8_t j = 0; j < 24; j++){

                                                //Store the FIFO contents in ram

                                                rd_data[index++] = (0xFF & GetWord16(I2C_DATA_CMD_REG)); // Get received byte

                                        }

                                        reg_address += 24/(i2c_cfg_env.register_width + 1);//Calculate the next register to read out

                                        user_i2c_send_address(reg_address);                //Restart the read

                         }

                }

    WAIT_UNTIL_I2C_FIFO_IS_EMPTY(); // Wait until I2C Tx FIFO empty

    WAIT_UNTIL_NO_MASTER_ACTIVITY();

          while(index < num_bytes){

       rd_data[index++] = (0xFF & GetWord16(I2C_DATA_CMD_REG)); // Get received byte

                }

    WAIT_UNTIL_I2C_FIFO_IS_EMPTY();  // Wait until Tx FIFO is empty

    WAIT_UNTIL_NO_MASTER_ACTIVITY(); // wait until no master activity }

Keywords: 
Device: 
PM_Dialog
Offline
Last seen: 5 months 2 weeks ago
Staff
Joined: 2018-02-08 11:03
Hi kaptajnen,

Hi kaptajnen,

Many thanks for creating your first forum thread and posting your question.  If you are starting a new design, we would recommend to start with the DA14585 – the SDK is much improved, we have a lot of software examples and more detailed documentation that it will be very helpful to getting started.  In addition, there is also software roadmap support on the DA14585 to our next generation device that is announced 5th November, Please check out DA14585/6 support port and take a look at our latest SDK6:

https://www.dialog-semiconductor.com/products/connectivity/bluetooth-low-energy/smartbond-da14585-and-da14586

There are two I2C software examples for DA14585 onto our support website:

SW Example: Reading out an I2C accelerometer and sending notification data

SW Example: DA14585/586 interface with mCube Accelerometer over I2C

Thanks, PM_Dialog