I2C Init with LPC1857

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

I2C Init with LPC1857

846件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Steeef on Tue Apr 29 05:02:39 MST 2014
Hi there,
I use the eval board from Hitex with the LPC 1857 and I try to communicate via I2C with a temperature sensor. The name of this sensor is SE97B from NXP and he´s on the eval board.

I've used some I2C libraries from LPCOpen and this is the result:

void Board_I2C(void)
{
Board_I2C_Init(I2C0);
Chip_I2C_Init(I2C0);
Chip_I2C_SetClockRate(I2C0, SPEED_400KHZ);
Chip_I2C_SetMasterEventHandler(I2C0, Chip_I2C_EventHandlerPolling);
}

void Temp_Sensor_Init(void)
{
SE97B.slaveAddr = (SLAVE_ADDRESS << 1) ;   // SLAVE_ADDRESS = 0x30 --> data sheet, A2 A1 and A0 are GND
SE97B.txBuff = I2C_Tx_Buf;
SE97B.rxBuff = I2C_Rx_Buf;
SE97B.txSz = 3;
SE97B.rxSz = 0;

I2C_Tx_Buf[0] = 0x00;                                             // Low Byte
I2C_Tx_Buf[1] = 0x00;// High Byte
        I2C_Tx_Buf[2] = 0x01;// CONFIG Register Addr

Chip_I2C_MasterTransfer(I2C0, &SE97B);
}



The The Chip_I2C_MasterTransfer - function works according to this scheme:
http://www.lpcware.com/content/forum/unexpected-behavior-i2c-master-transfer-function

Unfortunately, I see on the oscilloscope no clock and no data. Have anyone some experience and can help me to find the right functions?

Thanks,
Steeef
ラベル(1)
0 件の賞賛
返信
1 返信

736件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by xianghuiwang on Fri May 16 11:49:22 MST 2014
Hi, Steeeef,

The LPCOpen has an I2C sample code that could serve as a reference for you to check through your software.
http://www.lpcware.com/content/nxpfile/lpcopen-software-development-platform-lpc18xx-packages-0
Follow the readme file to setup your Hitex hardware.
For verification of the hardware, you can set the pins to GPIO, toggle them and see if they are really the ones you intended to use.
Good luck!
0 件の賞賛
返信