LPI2C glitch filter width discrepancy 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 Communication & Control(I3C | I2C | SPI | FlexCAN | Ethernet | FlexIO) Re: LPI2C glitch filter width discrepancy Correction, the slave code updates SCFGR2.FILTSDA and SCFGR2.FILTSCL. Although, in the code, the masks and offsets for MCFGR2 and SCFGR2 appear to be the same. #define LPI2C_MCFGR2_FILTSCL_MASK (0xF0000U) #define LPI2C_MCFGR2_FILTSCL_SHIFT (16U) /*! FILTSCL - Glitch Filter SCL */ #define LPI2C_MCFGR2_FILTSCL(x) (((uint32_t)(((uint32_t)(x)) << LPI2C_MCFGR2_FILTSCL_SHIFT)) & LPI2C_MCFGR2_FILTSCL_MASK) #define LPI2C_SCFGR2_FILTSCL_MASK (0xF0000U) #define LPI2C_SCFGR2_FILTSCL_SHIFT (16U) /*! FILTSCL - Glitch Filter SCL */ #define LPI2C_SCFGR2_FILTSCL(x) (((uint32_t)(((uint32_t)(x)) << LPI2C_SCFGR2_FILTSCL_SHIFT)) & LPI2C_SCFGR2_FILTSCL_MASK) 回复: LPI2C glitch filter width discrepancy Hi @jcallon
Thank you for reporting this. After reviewing the LPI2C register definitions and driver implementation, this appears to be an SDK driver issue.
The FILTSDA and FILTSCL fields are 4 bits wide for both controller and target configurations, and LPI2C_GetCyclesForWidth() already accepts a uint32_t nanosecond value and limits the resulting cycle count to the supported register range. Therefore, using uint8_t for the glitch filter width in lpi2c_master_config_t unnecessarily limits the input to 255 ns, whereas lpi2c_slave_config_t uses uint32_t.
I will report this inconsistency to the SDK team for confirmation and correction. Thank you for bringing it to our attention.
BR
Harry
View full article