Hi
I would like to use both of the I2C and the SPI on LPC54101.
However, happen an error on use SPI when I2C was initialized.
Do you know the measures?
When you use this code
ROM_I2CS_Init(devMemI2C, &i2csInit);
mXfer.status is ERR_SPI_BASE on endress.
ROM_SPIM_Transfer(spimHandle, &mXfer);
while (mXfer.status == ERR_SPI_BUSY) {}
This is code
SystemCoreClockUpdate();
Init_SPI_PinMux();
Init_I2C_PinMux();
Chip_Clock_EnablePeriphClock(LPC_SPIM_CLOCK);
Chip_SYSCON_PeriphReset(LPC_SPIM_RESET);
Chip_Clock_EnablePeriphClock(LPC_I2CS_CLOCK);
Chip_SYSCON_PeriphReset(LPC_I2CS_RESET);
Board_Init();
...
spimHandle = ROM_SPIM_Init(devMem, &spimInit);
if (ROM_SPIM_SetupTransfer(spimHandle, &spimConfig) != LPC_OK) {
}
NVIC_EnableIRQ(LPC_SPIIRQNUM);
...
i2csHandle = ROM_I2CS_Init(devMemI2C, &i2csInit); // If this line does not exists, program will not happen error.
ROM_I2CS_SetupSlave(i2csHandle, &slaveSetup); // If does not exists it, you should comment out of this line
...
optimalDevI2C = Chip_Clock_GetAsyncSyscon_ClockRate() / 4000000;
LPC_I2C_PORT->CLKDIV = optimalDevI2C;
...
NVIC_EnableIRQ(LPC_I2CS_INT);
Hi Takafumi,
I Would recommend you to replace the functionality provided by ROM drivers with the LPCOpen API's, this is due to complications associated with ROM based peripheral drivers:
http://cache.nxp.com/files/microcontrollers/doc/support_info/lpc5410x-ROM-Deprecation_1.pdf
You can download the latest LPCOpen package for the LPC5410x devices on the following link:
LPCOpen Software for LPC5410X|NXP
Hope it helps!
Best Regards,
Carlos Mendoza
Technical Support Engineer
Hi Carlos,
Thanks!
I was used the Legacy LPCOpen 2.xx software package.
Best Regards,
Takafumi Sugimoto