Content originally posted in LPCWare by hoiyin00 on Tue Apr 29 07:32:56 MST 2014
Hi,
I am trying to a test on I2C on LPC1758 MCB1750 board.
I connect the oscilloscope to SDA2 P0.10 on the board with the GND with VIN- on the board.
With the write signal 0x55, it should genearate a square wave on the oscilloscope.
Anyone know why it does not work?
Code
/****************************************************************************
i2cmst.c
/****************************************************************************
#include "lpc17xx.h"
#include "type.h"
#include "i2c.h"
#include "driver.h"
extern volatile uint8_t I2CMasterBuffer[I2C_PORT_NUM][BUFSIZE];
extern volatile uint8_t I2CSlaveBuffer[I2C_PORT_NUM][BUFSIZE];
extern volatile uint32_t I2CReadLength[I2C_PORT_NUM];
extern volatile uint32_t I2CWriteLength[I2C_PORT_NUM];
#define PORT_USED2
/*******************************************************************************
** Main Function main()
*******************************************************************************/
int main (void)
{
SystemClockUpdate();
I2C2Init();/* initialize I2c2 */
while (1)
{
/* Write SLA(W), address and one data byte */
I2CWriteLength[PORT_USED] = 1;
I2CReadLength[PORT_USED] = 0;
I2CMasterBuffer[PORT_USED][0] = 0x55;
I2CEngine( PORT_USED );
}
}
/******************************************************************************
** End Of File
******************************************************************************/