Sign in

username:

password:



Not a member?

Search lpc2000



Search tips

Subscribe to lpc2000



lpc2000 by Keywords

2106 | ADC | ARM7 | Atmel | Bootloader | CAN | CrossStudio | CrossWorks | DDS | ECos | Ethernet | ETM | FIFO | FLASH | FPGA | GCC | GDB | GNU | GNUARM | GPIO | I2C | IAP | IAR | JTAG | Kickstart | LCD | Linux | LPC | LPC-E2294 | LPC2000 | LPC2100 | LPC2104 | Lpc2106 | Lpc210x | LPC2114 | LPC2119 | LPC2124 | LPC2129 | Lpc2138 | LPC213x | LPC21xx | LPC2210 | LPC2212 | LPC2214 | LPC2292 | LPC2294 | LPC2xxx | LPC3128 | MCB2100 | Olimex | Philips | PWM | Rowley | RTC | RTOS | SPI | SSP | UART | UART0 | UART1 | ULINK | USB | Watchdog | Wiggler

Ads

Discussion Groups

See Also

DSPFPGAElectronics

Discussion Groups | LPC2000 | LPC 2144 I2C Slave


Advertise Here

Discussion group dedicated to the Philips LPC2000 family of ARM MCUs

LPC 2144 I2C Slave - Patrick - Nov 13 8:55:23 2009

Hi,
I wrote this function to inizialize the i2c0 devices but i think that is not correct init function because the i2c interrupt is not activeted.

_BOOL init_i2c_0(void)
{
I2CSlaveState = I2C_IDLE;
I2CS_ReadLength = 0;
I2CS_RdIndex = 0;

//--- set pins ---
PINSEL0 = 0x50;

//--- set i2c pll ---
I2C0SCLL = 0xD;
I2C0SCLH = 0xC;

//--- set i2c slave ---
I2C0ADR = 0x20 << 1;

//--- clear flags ---
I2C0CONCLR = I2CONCLR_AAC | I2CONCLR_SIC | I2CONCLR_STAC | I2CONCLR_I2ENC;

//--- set flags ---
//I2C0CONSET = I2CONSET_AA;

//--- Install interrupt handler ---
if ( install_irq( I2C0_INT, (void *)I2C_0_SlaveHandler ) == FALSE )
{
return FALSE;
}

I2C0CONSET = I2CONSET_I2EN | I2CONSET_AA ;
return TRUE;
}

Please help me...thanks to all.

PS place even my function to inizialize the interrupt...

Uint32 install_irq( Uint32 IntNumber, void *HandlerAddr )
{
Uint32 i;
Uint32 *vect_addr;
Uint32 *vect_cntl;

VICIntEnClr = 1 << IntNumber; /* Disable Interrupt */

for ( i = 0; i < VIC_SIZE; i++ )
{
vect_addr = (Uint32 *)(VIC_BASE_ADDR + VECT_ADDR_INDEX + i*4);
vect_cntl = (Uint32 *)(VIC_BASE_ADDR + VECT_CNTL_INDEX + i*4);
if ( *vect_addr == (Uint32)NULL )
{
*vect_addr = (Uint32)HandlerAddr; /* set interrupt vector */
*vect_cntl = (Uint32)(IRQ_SLOT_EN | IntNumber);
break;
}
}

if ( i == VIC_SIZE )
{
return( FALSE ); /* fatal error, can't find empty vector slot */
}

VICIntEnable = 1 << IntNumber; /* Enable Interrupt */
return( TRUE );
}
I have copy this function to NXP Philips example...

------------------------------------



(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )