Other Parts Discussed in Thread: MSP430F2132, ,
Hello,
I'm porting over software from an MSP430F2132 to an MSP430FR2476. I'm unable to get the UARTs working (I can't send any data and the interrupts aren't triggering when I receive data). I found this article and started going through it:
https://www.ti.com/lit/an/slaa734a/slaa734a.pdf?ts=1612820504636&ref_url=https%253A%252F%252Fwww.google.com%252F
I got to the point where it suggests checking clock frequencies and I discovered a problem...
Here's what was in the 2132 code for initializing the clock:
// Memory Segment A is valid so initialize DCO with calibrated values
// DCOCTL: Pull DCOx and MODx from CALDCO_1MHZ
// BCSCTL1: Pull RSELx from CALBC1_1MHZ (Also sets XT2OFF=1, XTS=0,
// DIVA=00, XT5V=0)
// BCSCTL2: SELMx=00 (DCOCLK), DIVMx=00 (div1), SELS=0 (DCOCLK),
// DIVXS=00 (div1), DCOR=0 (internal)
DCOCTL = CALDCO_8MHZ;
BCSCTL1 = CALBC1_8MHZ;
BCSCTL2 = 0;
The 2476 has a very different clock structure, based on my understanding of the documentation, so I ended up copying over the CS_init from the OutOfBox_LP-MSP430FR2476 software example and tried adjusting the values to set MCLK and SMCLK to 8MHz. I viewed the clocks with a logic analyzer and they were actually 1.667 to 2.5 MHz. I tried changing the settings back to the example, so now I have:
#define CS_MCLK_DESIRED_FREQUENCY_IN_KHZ 16000 // Target frequency for MCLK in kHz
#define CS_MCLK_FLLREF_RATIO 488 // MCLK/FLLRef Ratio
...
static bool CS_init(void)
{
bool retVal = true;
// Configure one FRAM waitstate as required by the device datasheet for MCLK
// operation beyond 8MHz _before_ configuring the clock system.
FRAMCtl_configureWaitStateControl(FRAMCTL_ACCESS_TIME_CYCLES_1);
//Set DCO FLL reference = REFO
CS_initClockSignal(
CS_FLLREF,
CS_REFOCLK_SELECT,
CS_CLOCK_DIVIDER_1
);
//Set ACLK = REFO
CS_initClockSignal(
CS_ACLK,
CS_REFOCLK_SELECT,
CS_CLOCK_DIVIDER_1
);
CS_initFLLParam param = {0};
//Set Ratio/Desired MCLK Frequency, initialize DCO, save trim values
retVal = CS_initFLLCalculateTrim(
CS_MCLK_DESIRED_FREQUENCY_IN_KHZ,
CS_MCLK_FLLREF_RATIO,
¶m
);
//Clear all OSC fault flag
CS_clearAllOscFlagsWithTimeout(1000);
return retVal;
}
I'm expecting 16MHz, but the logic analyzer is showing 1MHz:
When I change the two #defines above, the frequencies change but not to what I expect them...
Is there something else I should be setting? Am I even taking the correct approach based on what was in the original 2132 code?
Thanks in advance for any and all help!