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.

MSP430FR2476: Not able to start the ACLK, XT1 is mounted

Part Number: MSP430FR2476

Hello everyone,

I was able to have our custom board running fine thanks to the help from the forum to properly configure the eUSCI in I2C mode with driverlib.

Now, we need to reduce the power consumption as much as possible, so the first thing I wanted to do is to use the ACLK instead of the SMCLK as clock

for the I2C. Well,piece of cake!.....I thought.....

It seems that for some reason my ACLK is not properly starting.....basing my code on the example I found in the Resource Explorer, this is what I do to configure the ACLK

int main(void)
{
    volatile uint32_t j;
    PMM_unlockLPM5();

    WDT_A_hold(WDT_A_BASE);

    // Configure Pins for XIN and XOUT
    //Set P2.0 and P2.1 as Module Function Input.
    GPIO_setAsPeripheralModuleFunctionInputPin(
        GPIO_PORT_P2,
        GPIO_PIN0 + GPIO_PIN1,
        GPIO_PRIMARY_MODULE_FUNCTION
    );


    PMM_unlockLPM5();
    //Initializes the XT1 crystal oscillator with no timeout
    //In case of failure, code hangs here.
    //For time-out instead of code hang use CS_turnOnXT1LFWithTimeout()
    CS_turnOnXT1LF(
        CS_XT1_DRIVE_0
        );

    CS_initClockSignal(
        CS_ACLK,
        CS_XT1CLK_SELECT,
        CS_CLOCK_DIVIDER_1
        );


    //clear all OSC fault flag
    CS_clearAllOscFlagsWithTimeout(1000);
    //Enable oscillator fault interrupt
    SFR_enableInterrupt(SFR_OSCILLATOR_FAULT_INTERRUPT);

    uint32_t clkValue = CS_getACLK();

/* The application continues with I2C readings
...
...
...
*/

And the problem is that later in the code I got stuck in I2C operations, simply because the clkValue is = 0. So, I assume the ACLK is not starting.

Assuming that the crystal is mounted correctly on the PCB (XT1 is a 32K crystal, between P2.0 and P2.1, as for instructions), do you have any suggestions on what I should check to see what is wrong here?

Thanks in advance,

Lorenzo

  • As a side problem, I can add that the eUSCI I2C is not working properly, even if I try to use the ACLK as a clock source derived from the DCO....is there any limitation in using ACLK for I2C operations?

    In this case the clkValue parameter is correctly set to the expected value (32768), but then the I2C operations are not performed.....

  • Hello,

    I2C frequencies are typically 100 or 400 kHz, so using a 32.768 kHz clock source probably won't work correctly. If you're having issues with the XT1 crystal, you may be experiencing an oscillator fault from not using the correct effective load capacitance for the crystal.

    Regards,

    James

  • Hello James,

    thanks for the hint, then the capacitors are correct because I don't get any fault....but I don't get any timer neither. As I wrote in the initial post, the clkValue I get when using

    the crystals is 0, while in the second case I get 32768......

    I am curious about your first statement though.....I didn't find anywhere on the TI documentation that the ACLK cannot be used for I2C communication; on the contrary

    on the driverlib guide and everywhere else this is listed as a possibility. Furthermore, on other chips from other producers (NRF52 for example), it is always possible to use

    the 32k clock for communications on the I2C at 400k....is this an MSP430 limitation then? Are you 100% sure of this?

  • Hello,

    Lorenzo Bergamini said:
    I am curious about your first statement though.....I didn't find anywhere on the TI documentation that the ACLK cannot be used for I2C communication; on the contrary

    ACLK can be used as the clock source for the eUSCI module. However, for I2C, the eUSCI clock source (BRCLK) gets divided by UCBRx which implies that BRCLK must be greater than the bit clock frequency (SCL). So you can't use 32 kHz for a 400 kHz SCL.

    You can learn more about the eUSCI module by referring to the user's guide.

    Regards,

    James

  • Lorenzo:

    Just to add what James said:

    • Place a loop instruction early in your program that reads the external oscillator fault flag and produces a delay until the flag is cleared. This will allow the oscillator to ramp up and stabilize before it's needed.
    • Place the port unlocking instruction (PMM_unlockLPM5) at a line in your program after all your modules have been configured.

**Attention** This is a public forum