Hi everyone, I've just started messing with I2C and i seem to have run into a little problem, For some reason I cannot write to the I2DR register. I've used the driver example given by Dr Seuss with a change in I2C pins to :
/* I2C pins configuration */
MCF_GPIO_PASPAR |= ( MCF_GPIO_PASPAR_PASPAR0(0x01)
| MCF_GPIO_PASPAR_PASPAR1(0x01));
My next step was setting up the I2C for transmit because I needed to transmitt the id of the device like so:
uint8 I2CreceivedByte(uint8 address, uint8 id)
{
int i;
uint8 data;
MCF_I2C_I2CR = 0xB0 ; //enable I2C set to master transmit mode
MCF_I2C_I2DR = 0xC0; //set the id to the I/O register
I was watching the registers while running the program in debug mode. From what I observed the I2DR register never gets the id. I'm not exactly sure what is wrong however I feel like i'm missing something. The following is what my registers look like up to this line of code.
/*I2C Registers*/
I2ADR 0x00
I2FDR 0x32
I2CR 0xB0
I2SR 0x81
I2DR 0x00
/*General Purpose I/O Port AS Registers*/
PORTAS 0x03
DDRAS 0x00
SETAS 0x03
CLRAS 0x00
PASPAR 0x05
Thanks in advance for any helps or hints anyone can give me