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

Smart Bluetooth Forum Discussions

Anonymous
Not applicable

Hi all

I intend to use MCP9808 (i2c temperature sensor).

http://www.farnell.com/datasheets/1522173.pdf

So, I wrote codes like below.

==================in Constants========================

// Read operation to the lower level driver is 0.

#define I2C_SLAVE_OPERATION_READ         (0)

// Write operation to the lower level driver is 1.

#define I2C_SLAVE_OPERATION_WRITE        (1)

#define MCP9808_SLAVE_ADDRESS (0x18 << 1)

===================================================

==============in timer_1s()============================

UINT16 data = 0;

temperature_sensor_read_16_bit_register(0x05, &data);

===================================================

However,

cfa_bsc_Opextended in temperature_sensor_read_16_bit_register always returns CFA_BSC_STATUS_NO_ACK.

I edited a part of temperature_sensor_read_16_bit_register like following:

read_status = cfa_bsc_OpExtended(reg_bytes_to_read, sizeof(reg_bytes_to_read), reg_read_bytes_to_write,

    sizeof(reg_read_bytes_to_write), MCP9808_SLAVE_ADDRESS, I2C_SLAVE_OPERATION_READ);

Why do these code work correctly?

Is there anyone who could make temperature_sensor_read_16_bit_register work correctly?

Please tell me what to do.

Sincerely,

Ishikawa.

0 Likes
1 Solution
Anonymous
Not applicable

Hi, arvinds and j.t.

I'm sorry for my late reply.

I could confirm that i2c function which I implemented works correctly by using my self made board and the same code. However, I couldn't identify the cause of the problem....I apologize.

I'd like to express my deepest appreciation for your help and support, arvinds and j.t.

View solution in original post

0 Likes
15 Replies