LPC4357 I2C Problems when APB is clock via IRC

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPC4357 I2C Problems when APB is clock via IRC

607 Views
ronny_friedrich
Contributor I

I´m using the I2C driver for LPC4357 provided by Keil until now without any problems until now.
The driver re-configures the APB clock source to use PLL1 when the peripheral is enabled:

 /* Connect base clock */
    *i2c->base_clk_reg = (1    << 11) |     /* Autoblock En               */
                         (0x09 << 24) ;     /* PLL1 is APB  clock source  */

However, for my current project I need to clock both APB1 and APB3 from the internal IRC oscillator

running at 12 MHz. When I change the driver to use IRC for APB:

 /* Connect base clock */
 *i2c->base_clk_reg = (1    << 11) |     /* Autoblock En               */
                      (0x01 << 24) ;     /* IRC is APB  clock source  */

the I2C data register seems to be frozen at 0x00. The signals at SDA/SCL are still OK, it seems sending is still working as expected and after each transfer a "NACK" status is set, only the receiver seems to be dead.

When I comment out the above code completly to use the previous APB clock settings (which are IRC + Autoblock=Enabled) the behaviour is exactly the same.

When the APB clock source is changed to use one of the IDIVx integer dividers I2C seems to work for higher input frequencies above approx. 40 MHz. Below that the data register seems to receive random values and below ~25 MHz the register freezes to 0x00.

The M4 core is clocked via XTAL/PLL1 running at 204MHz, M0 core is not in use. Also, I do not use any power saving modes or dynamic clock changes. The i2c problems do not depend on SCL frequency, I tried 10kHz, 100kHz and 400kHz with exactly the same results.

Neither the datasheet nor the LPC4357 errata mention some issues related to low I2C peripheral clocks. 

-> Is there any (not yet documented) constraint about the I2C peripheral clock I missed?

-> Has anybody else experienced problems with I2C on LPC4357 when clocking APB via IRC?

Labels (1)
0 Kudos
2 Replies

439 Views
isaacavila
NXP Employee
NXP Employee

Hello Rony,

Have you tried to use LPCOpen example to valide this issue? I've test the I2C example for LPC4367 and select IRC as input source for BASE_APB3_CLK (10) and then use I2C1 to send data to Port expander (PCA9532) IC.

It ran without problems when I used I2C1 on polling mode. Could you please try by using LPCOpen example and/or also tell me if there is another special setting besides using IRC to feed BASE_APB3_CLK?

Regards,

Isaac

0 Kudos

439 Views
ronny_friedrich
Contributor I

Hello Isaac,

thanks for your reply.

I experienced the problems when using I2C0. I did not try I2C1 with the slow clock since I will need to use all available interfaces later, including I2C0s high speed capabilities.

Maybe there is something special with I2C0 since it is the only interface supporting higher SCL clock rates.

However, the code did work perfectly with higher APB clock rates. As soon APB is driven by 12 MHz IRC the register is stuck at zero. Same happens when PLL1 clock is divided  down to 12 MHz or slightly above. Once the APB is driven with ~40-50MHz everything works as expected.

0 Kudos