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.

MSP430FR6989: A question about the device library

Part Number: MSP430FR6989

About MSP430FR6989ESI Driver,

Initialize esiConfig ();When stuck on ESI_CalibrateInternalOSCFREQ (ESIOSC_DEFAULT);The 2.91.13.01 device library is used on theA device library with 2.00.00.16 does not.Found behind the "static uint16_t measureESIOSC (void)" is not the same。Is this a library problem or a device problem.

This is in 2.91.13.01

static uint16_t measureESIOSC(void)

{

uint16_t temp;

// This and next instruction realizes a clear->set ESICLKGON bit.
ESIOSC &= ~(ESICLKGON);

// This starts measurement.
ESIOSC |= ESICLKGON + ESIHFSEL;

// Get counter value, when measurement has not finished yet, ESICNT3
// value is 0x01
do
{
temp = ESICNT3;
} while(temp == 0x01);

// Stop ESIOSC oscillator
ESIOSC &= ~(ESICLKGON);

// returns counter value ESICNT3
return temp;
}

This is in  2.00.00.16

static uint16_t measureESIOSC(void){

//uint16_t temp;

// This and next instruction realizes a clear->set ESICLKGON bit.
ESIOSC &= ~(ESICLKGON);

// This starts measurement.
ESIOSC |= ESICLKGON + ESIHFSEL;

// Get counter value, when measurement has not finished yet, ESICNT3
// value is 0x01
while(ESICNT3==1);

// Stop ESIOSC oscillator
ESIOSC &= ~(ESICLKGON);

// returns counter value ESICNT3
return (ESICNT3);
}

  • Hi,

    Let me look into this.

  • Waiting for your reply,thanks

  • I apologize for taking some time to try to locate an explanation for this behavior.  Unfortunately, I couldn't track down anyone who knows the history of changes to the driverlib as far back as 2.00.00.16.  I did mange to find in the release notes one comment about fixing a "return value of 0". 

    I compiled the two versions of the function and took a look at the disassembly.  Functionally, it would appear they do the same (wait until ESICNT3 does not equal 1.

    So when the code appears to hang and you pause the debugger, what assembly line is the PC?  Maybe take a screen shot?  Can you open the register view to examine the ESICNT3 register and see what the value is?

  • This is how to upload pictures, using 2.91.13.01 ESICNT3= 0x00DE.Unable to exit the loop.

    2.00.00.16 ESICNT3 x0093 = 0.It can exit the loop

    2.91.13.01 returns "temp". "temp" is only assigned by ESICNT3 in the "do while".     2.00.00.16 is a direct output of ESICNT3

    You can burn the program on the development board and debug it。

  • I did in fact test both versions and both did not hang.  Here is the code I used.

    #include "driverlib.h"
    #include <stdint.h>
    
        uint16_t measureESIOSC(void);
        uint16_t measureESIOSC_OLD(void);
    int main(void) {
    
        WDT_A_hold(WDT_A_BASE);
    
        PM5CTL0 &= ~LOCKLPM5;
        P1DIR = BIT0;
        P1OUT = 0; // OFF LED
    
        measureESIOSC();
        measureESIOSC_OLD();
    
        P1OUT |= BIT0; // TURN ON LED TO SHOW CODE MADE IT ALL THE WAY
        while(1);
    }
    
    // This is in 2.91.13.01 (Latest version)
     uint16_t measureESIOSC(void)
    
     {
    
         uint16_t temp;
    
         // This and next instruction realizes a clear->set ESICLKGON bit.
         ESIOSC &= ~(ESICLKGON);
    
         // This starts measurement.
         ESIOSC |= ESICLKGON + ESIHFSEL;
    
         _no_operation();
    
         // Get counter value, when measurement has not finished yet, ESICNT3
         // value is 0x01
         do
         {
             temp = ESICNT3;
         } while(temp == 0x01);
    
         // Stop ESIOSC oscillator
         ESIOSC &= ~(ESICLKGON);
    
         // returns counter value ESICNT3
         return temp;
     }
    
    
     //This is in  2.00.00.16
     uint16_t measureESIOSC_OLD(void){
    
         //uint16_t temp;
    
         // This and next instruction realizes a clear->set ESICLKGON bit.
         ESIOSC &= ~(ESICLKGON);
    
         // This starts measurement.
         ESIOSC |= ESICLKGON + ESIHFSEL;
    
         // Get counter value, when measurement has not finished yet, ESICNT3
         // value is 0x01
         while(ESICNT3==1);
    
         // Stop ESIOSC oscillator
         ESIOSC &= ~(ESICLKGON);
    
         // returns counter value ESICNT3
         return (ESICNT3);
     }
    

**Attention** This is a public forum