This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP430FR6043: cannot write data to EEPROM

Part Number: MSP430FR6043


Hi team,

Issue: the hardware i2c interrupt is written to EEPROM data, when do not initialize the MCLK clock, the data can be written normally, while after initializing the MCLK clock, it's unable to write data.

Could you help check what's the reason for that? Thanks.

Best Regards,

Cherry

  • Hi Cherry,

    What the two waveforms mean?  Are they all the normal waveforms?  Suggest customer to check the I2C configuration for clock reference and I2C speed configuration.

  • Hi Allen,

    Sorry for the unclear description. The first image is when do not initialize the MCLK clock.

    when do not initialize the MCLK clock, the data can be written normally,

    And the second image is when initialize it.

    after initializing the MCLK clock, it's unable to write data.

    Ok and I will update to the customer. Thanks.

    Best Regards,

    Cherry

  • Hi Cherry,

    How customer initializes their MCLK? What is the difference?

  • Hi Allen,

    How customer initializes their MCLK?

    static void hal_system_ClockInit(void)
    {

    FRAMCtl_A_configureWaitStateControl(FRAMCTL_A_ACCESS_TIME_CYCLES_1);
    // Set DCO frequency to default 16MHz
    CS_setDCOFreq(CS_DCORSEL_1, CS_DCOFSEL_4);
    //Set external clock frequency to 32.768 KHz
    CS_setExternalClockSource(32768,0);
    //MCLK 16MHz
    CS_initClockSignal(CS_MCLK, CS_DCOCLK_SELECT, CS_CLOCK_DIVIDER_2);
    //SMCLK 8MHz
    CS_initClockSignal(CS_SMCLK, CS_DCOCLK_SELECT, CS_CLOCK_DIVIDER_2);

    //ACLK 32.768K
    CS_initClockSignal(CS_ACLK, CS_LFXTCLK_SELECT, CS_CLOCK_DIVIDER_1);

    // Intializes the XT1 crystal oscillator
    CS_turnOnLFXT(CS_LFXT_DRIVE_3);

    }

    void hal_I2cInit(void)
    {


    //Configuring B0 clock source SMLK, rate,
    EUSCI_B_I2C_initMasterParam param = {0};
    param.selectClockSource = EUSCI_B_I2C_CLOCKSOURCE_SMCLK;
    param.i2cClk = CS_getSMCLK();
    param.dataRate = EUSCI_B_I2C_SET_DATA_RATE_400KBPS;
    //param.byteCounterThreshold = 10;
    param.byteCounterThreshold = 0;
    param.autoSTOPGeneration = EUSCI_B_I2C_NO_AUTO_STOP;
    //param.autoSTOPGeneration = EUSCI_B_I2C_SEND_STOP_AUTOMATICALLY_ON_BYTECOUNT_THRESHOLD;
    //Sets the main mode
    EUSCI_B_I2C_initMaster(EeProm_BASE, &param);
    //Set the slave address
    EUSCI_B_I2C_setSlaveAddress(EeProm_BASE,EEPROM_ADDRESS);
    EUSCI_B_I2C_setMode(EeProm_BASE, EUSCI_B_I2C_TRANSMIT_MODE); //写入模式

    //enable B0
    EUSCI_B_I2C_enable(EeProm_BASE);

    //Clear the transmit interrupt, acknowledge the interrupt
    EUSCI_B_I2C_clearInterrupt(EeProm_BASE,
    EUSCI_B_I2C_TRANSMIT_INTERRUPT0 +
    EUSCI_B_I2C_NAK_INTERRUPT
    );


    EUSCI_B_I2C_enableInterrupt(EeProm_BASE,
    EUSCI_B_I2C_TRANSMIT_INTERRUPT0 +
    EUSCI_B_I2C_NAK_INTERRUPT
    );

    }

    Above are the configuration of the clock initialization and I2C initialization. 

    Thanks and Best Regards,

    Cherry

  • Hi Allen,

    Mau I know is there any feedback?

    Thanks and Best Regards,

    Cherry

  • Hi Cherry,

    param.dataRate = EUSCI_B_I2C_SET_DATA_RATE_400KBPS;

    Make sure this rate match the new SMCLK.

  • Hi Allen,

    yes this rate does match the new SMCLK, the customer has checked the waveform with oscilloscope.

    Thanks and Best Regards,

    Cherry

  • Hi Allen,

    May I know is there any updates about the question above?

    Thanks and Best Regards,

    Cherry

  • Hi,

    Is there a NACK on the bus? Dose EEPROM acknowledge the master? Have you compare the waveform to see the different when communicating with EEPROM?

**Attention** This is a public forum