S32k144 can not see any scope in I2c routine PTA2,PTA3.

cancel
Showing results for 
Search instead for 
Did you mean: 

S32k144 can not see any scope in I2c routine PTA2,PTA3.

Jump to solution
127 Views
郑文豪
Contributor I

Two pins always keep low level.Routine called S32K144_Project_LPI2C.I'm not connecting anything in two pins.

0 Kudos
1 Solution
112 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Would you please test it after external pull up resistor connected?
Internal pull up resistor may not work for I2C pins.

will work in open-drain mode.png

Best Regards,
Robin
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

View solution in original post

0 Kudos
3 Replies
120 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi 郑文豪,

Please refer "52.3.2.6 Pin Configuration" of S32K1xx MCU Family - Reference Manual .
External pull-up resistor are needed.

52.3.2.6 Pin Configuration.png

Best Regards,
Robin
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
116 Views
郑文豪
Contributor I

Code:

 
void PORT_init(void)
{
 
    /*!
     * Pins definitions
     * ===================================================
     *
     * Pin number        | Function
     * ----------------- |------------------
     * PTA2              | LPI2C_SDA
     * PTA3              | LPI2C_SCL
     * 
     */
 
PCC->PCCn[PCC_PORTA_INDEX ]|=PCC_PCCn_CGC_MASK;/* Enable PORTA*/
 
    PORTA->PCR[2]   |= PORT_PCR_MUX(3)      /* Port A2: MUX = ALT3, LPI2C_SDA */
                                               | PORT_PCR_PE_MASK   /* Pull resistor enable */
                                               | PORT_PCR_PS(1);    /* Pull up selected */
    PORTA->PCR[3]   |= PORT_PCR_MUX(3)      /* Port A3: MUX = ALT3, LPI2C_SCL */
                                                | PORT_PCR_PE_MASK  /* Pull resistor enable */
                                                | PORT_PCR_PS(1);   /* Pull up selected */
}
 
int main(void)
{
 
    /*!
     *
     *Initializations
     *=========================================
     */
 
SOSC_init_8MHz();      /* Initialize system oscillator for 8 MHz xtal */
SPLL_init_160MHz();    /* Initialize SPLL to 160 MHz with 8 MHz SOSC */
NormalRUNmode_80MHz(); /* Init clocks: 80 MHz sysclk & core, 40 MHz bus, 20 MHz flash */
PORT_init();           /* Configure */
LPI2C_init();          /* Initializes LPI2C ignoring NACK*/
 
    /*!
     *
     *Infinite for
     *=========================================
     */
        for(;;)
        {
        LPI2C_Transmit();/*Transmit ID*/
        }
 
    
}

 

void LPI2C_init(void)
{
    PCC->PCCn[PCC_LPI2C0_INDEX] |= PCC_PCCn_PCS(2)        /* Clk src: SIRCDIV2_CLK */
                              | PCC_PCCn_CGC_MASK;   /* Enable clock for LPI2C0 */
 
 
    LPI2C0->MCFGR1 = LPI2C_MCFGR1_PRESCALE(2) /* Prescale = 4*/
|LPI2C_MCFGR1_IGNACK_MASK;/* Ignore NACK*/
 
/* SCL_freq = Input_freq / (2^PRESCALER * (CLKLO + CLKHI + 2))*/
 
    LPI2C0->MCCR0 = LPI2C_MCCR0_CLKLO(18)
                | LPI2C_MCCR0_CLKHI(6)
                | LPI2C_MCCR0_SETHOLD(6)
                | LPI2C_MCCR0_DATAVD(3);
 
 
 
    LPI2C0->MFCR = LPI2C_MFCR_TXWATER(0) /* Transmitter Water mark set to 0*/
                  |LPI2C_MFCR_RXWATER(3); /* Receiver Water mark set to 3*/
 
    LPI2C0->MCR |= LPI2C_MCR_MEN_MASK /* Enable LPI2C as master */
            | LPI2C_MCR_DBGEN_MASK;
}
 
 
void LPI2C_Transmit (void)
{
LPI2C0->MTDR = (0x05<<8)|((0x1E<<1)|0);
}
 
 
0 Kudos
113 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Would you please test it after external pull up resistor connected?
Internal pull up resistor may not work for I2C pins.

will work in open-drain mode.png

Best Regards,
Robin
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

View solution in original post

0 Kudos