Hello,
I am using an MCXN947 on the latest released SDK (version 26.09).
When I was configuring the LPI2C peripheral in MCUxpresso, I noticed lpi2c_master_config_t and lpi2c_slave_config_t had different data type widths to store their glitch filter length.
This meant the same length I was using on my slave configuration was being truncated for my master configuration of the same peripheral.
fsl_lpi2c.h
typedef struct _lpi2c_master_config
{
...
uint8_t sdaGlitchFilterWidth_ns; /*!< Width in nanoseconds of glitch filter on SDA pin. Set to 0 to disable. */
uint8_t sclGlitchFilterWidth_ns; /*!< Width in nanoseconds of glitch filter on SCL pin. Set to 0 to disable. */
...
} lpi2c_master_config_t;
...
typedef struct _lpi2c_slave_config
{
...
uint32_t sdaGlitchFilterWidth_ns; /*!< Width in nanoseconds of the digital filter on the SDA signal. Set to 0 to
disable. */
uint32_t sclGlitchFilterWidth_ns; /*!< Width in nanoseconds of the digital filter on the SCL signal. Set to 0 to
disable. */
...
} lpi2c_slave_config_t;
MCFGR2.FILDSDA and MCFGR2.FILTSDL, the registers that pull from these values, appear to be fixed 4 bits in the reference manual.
My reference manual is MCXNX4XRM Rev. 6, 2025-03-05, so it may be a bit outdated. I was having trouble finding any new releases of it. If there is a new release, I'd be very happy to be pointed to it.
fsl_lpi2c.cc
void LPI2C_MasterInit(...) {
...
cycles = LPI2C_GetCyclesForWidth(sourceClock_Hz, masterConfig->sdaGlitchFilterWidth_ns, 0U,
(LPI2C_MCFGR2_FILTSDA_MASK >> LPI2C_MCFGR2_FILTSDA_SHIFT), 0U);
...
cycles = LPI2C_GetCyclesForWidth(sourceClock_Hz, masterConfig->sclGlitchFilterWidth_ns, 0U,
(LPI2C_MCFGR2_FILTSCL_MASK >> LPI2C_MCFGR2_FILTSCL_SHIFT), 0U);
...
}
I was wondering, why is there this discrepancy between the master and slave configuration?
Thank you for your time,
JC