LPC54018 customized board I2C interface issue

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

LPC54018 customized board I2C interface issue

539 Views
Renuga_AKAS
Contributor I

Hi,

    We're trying to communicate with 24LC512 EEPROM IC through I2C with our customized (208 PINs) board. But we're not even getting the I2C clock signal. Eventhough we have changed the Pin configuration to 208 Pin package through MCUXpresso config tool (.mex file). Still we cannot get the clock signal. Is anything we're still missing in the configuration?. But we did the same thing and it worked well LPC54018 EVK board (180 PINs).

 

Here I have attached the code for your reference.

CLOCK_AttachClk(kFRO12M_to_FLEXCOMM1);

RESET_PeripheralReset(kFC1_RST_SHIFT_RSTn);

IOCON->PIO[0][13] = ((IOCON->PIO[0][13] &
/* Mask bits to zero which are setting */
(~(IOCON_PIO_FUNC_MASK | IOCON_PIO_DIGIMODE_MASK)))

/* Selects pin function.
* : PORT013 (pin 141) is configured as FC1_CTS_SDA_SSEL0. */
| IOCON_PIO_FUNC(PIO013_FUNC_ALT1)

/* Select Analog/Digital mode.
* : Digital mode. */
| IOCON_PIO_DIGIMODE(PIO013_DIGIMODE_DIGITAL));

IOCON->PIO[0][14] = ((IOCON->PIO[0][14] &
/* Mask bits to zero which are setting */
(~(IOCON_PIO_FUNC_MASK | IOCON_PIO_DIGIMODE_MASK)))

/* Selects pin function.
* : PORT014 (pin 144) is configured as FC1_RTS_SCL_SSEL1. */
| IOCON_PIO_FUNC(PIO014_FUNC_ALT1)

/* Select Analog/Digital mode.
* : Digital mode. */
| IOCON_PIO_DIGIMODE(PIO014_DIGIMODE_DIGITAL));

SYSCON->AHBCLKCTRLSET[1] = 1 << 12;

RESET_PeripheralReset(kFC1_RST_SHIFT_RSTn);

FLEXCOMM1->PSELID = 0x101073;

I2C1->CFG = 1;

I2C1->CLKDIV = 7; //100kbps - standard mode

I2C1->MSTTIME = 86; //100kbps - standard mode

 

I2C SCL PIN always remains low. We need a quick response. Thanks in advance.

0 Kudos
Reply
3 Replies

490 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello,

How about refer to the I2C demo under SDK to initialize I2C and pins config:

 

Alice_Yang_0-1665393989195.png

 

BR

Alice

 

0 Kudos
Reply

479 Views
Renuga_AKAS
Contributor I

Hi @Alice_Yang,

    Thanks for the reply. We tried the SDK I2C example on our customized board (208 PINs). Even after enabling the open drain (IOCON_PIO_OPENDRAIN_EN), still we're not getting the clock signal. Hereby I have attached the code and screenshots of debug results for your reference.

We're using a pull-up resistor (1.8kohm) in EEPROM IC (24LC512). Is there any suggestion for using the pull-up resistor?

 

SDK example code:

/* attach 12 MHz clock to FLEXCOMM8 (I2C master) */
CLOCK_AttachClk(kFRO12M_to_FLEXCOMM8);

/* reset FLEXCOMM for I2C */
RESET_PeripheralReset(kFC8_RST_SHIFT_RSTn);

BOARD_InitPins();
BOARD_BootClockPLL180M();

 

PIN configurations:

const uint32_t port1_pin17_config = (/* Pin is configured as FC8_RXD_SDA_MOSI */
IOCON_PIO_FUNC2 |
/* Selects pull-up function */
IOCON_PIO_MODE_PULLUP |
/* Input function is not inverted */
IOCON_PIO_INV_DI |
/* Enables digital function */
IOCON_PIO_DIGITAL_EN |
/* Input filter disabled */
IOCON_PIO_INPFILT_OFF |
/* Standard mode, output slew rate control is enabled */
IOCON_PIO_SLEW_STANDARD |
/* Open drain is enabled */
IOCON_PIO_OPENDRAIN_EN);
/* PORT1 PIN17 (coords: 98) is configured as FC8_RXD_SDA_MOSI */
IOCON_PinMuxSet(IOCON, 1U, 17U, port1_pin17_config);

const uint32_t port1_pin18_config = (/* Pin is configured as FC8_TXD_SCL_MISO */
IOCON_PIO_FUNC2 |
/* Selects pull-up function */
IOCON_PIO_MODE_PULLUP |
/* Input function is not inverted */
IOCON_PIO_INV_DI |
/* Enables digital function */
IOCON_PIO_DIGITAL_EN |
/* Input filter disabled */
IOCON_PIO_INPFILT_OFF |
/* Standard mode, output slew rate control is enabled */
IOCON_PIO_SLEW_STANDARD |
/* Open drain is enabled */
IOCON_PIO_OPENDRAIN_EN);
/* PORT1 PIN18 (coords: 15) is configured as FC8_TXD_SCL_MISO */
IOCON_PinMuxSet(IOCON, 1U, 18U, port1_pin18_config);

 

Screenshots of debug results

Renuga_AKAS_0-1665465906165.png

 

Renuga_AKAS_1-1665465917802.png

 

0 Kudos
Reply

518 Views
Renuga_AKAS
Contributor I

Hi,

    In our LPC54018 customized (208 Pins) board, we checked the IO pins port0 13th PIN and port0 14th PIN by configuring the PINs as GPIO and toggled it. We cannot even toggle the PINs. Even after setting the pin it remains 0 (GPIO->B[0][13] = 1). Is it due to the port0 12th pin configured for SWDIO for ULINK2 communication.

 

Here I have attached the GPIO PIN configuration

CLOCK_EnableClock(kCLOCK_Iocon);

CLOCK_EnableClock(kCLOCK_Gpio0);
GPIO->CLR[0] = 1 << 13;
GPIO->CLR[0] = 1 << 14;

GPIO->DIR[0] |= 1 << 13;
GPIO->CLR[0] = 1 << 14;

GPIO->B[0][13] = 1;

GPIO->B[0][14] = 1;

IOCON->PIO[0][13] = ((IOCON->PIO[0][13] &
/* Mask bits to zero which are setting */
(~(IOCON_PIO_FUNC_MASK | 0x30 | IOCON_PIO_DIGIMODE_MASK)))

/* Selects pin function.
* : PORT013 (pin 141) is configured as PIO0_13. */
| IOCON_PIO_FUNC(PIO013_FUNC_ALT0)
|0x00

/* Select Analog/Digital mode.
* : Digital mode. */
| IOCON_PIO_DIGIMODE(PIO013_DIGIMODE_DIGITAL));

IOCON->PIO[0][14] = ((IOCON->PIO[0][14] &
/* Mask bits to zero which are setting */
(~(IOCON_PIO_FUNC_MASK | 0x30 | IOCON_PIO_DIGIMODE_MASK)))

/* Selects pin function.
* : PORT014 (pin 144) is configured as PIO0_14. */
| IOCON_PIO_FUNC(PIO014_FUNC_ALT0)
|0x00

/* Select Analog/Digital mode.
* : Digital mode. */
| IOCON_PIO_DIGIMODE(PIO014_DIGIMODE_DIGITAL));

 

while(1)

{

 GPIO_PortToggle(GPIO, 0, (1 << 13));
GPIO_PortToggle(GPIO, 0, (1 << 14));
}

 

After changing the flexcomm 0 to 4, there we checked the SDA and SCL pins by configuring it as GPIO, it gets toggled. And then we used it for I2C communication. Still we didn't got the clock signal.

 

 

How can we confirm that the clock configured for the specified flexcomm. Is there any way for that?

While debugging the code, we're the flexcomm shows the master idle after sending the slave address and start condition, it becomes master busy.

We need an immediate response from you.

0 Kudos
Reply