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.
Tool/software: Code Composer Studio
I get the following output (as expected) when I set the clocks using the attached code.
Configuring clocks ...
Verifying clocks ...
MCLK_Frequency: 8000000
SMCLK_Frequency: 8000000
If I use the commented "CS_initClockSignal" line instead of the one following it I get the following output.
Configuring clocks ...
Invalid CIO command (24) in the CIO buffer at address (0x4000) was not recognized. Please check the device and program memory maps.
Invalid CIO command (24) in the CIO buffer at address (0x4000) was not recognized. Please check the device and program memory maps.
Invalid CIO command (24) in the CIO buffer at address (0x4000) was not recognized. Please check the device and program memory maps.
I expected to get the following output.
Configuring clocks ...
Verifying clocks ...
MCLK_Frequency: 16000000
SMCLK_Frequency: 8000000
The code works properly when I run it in a different program but does not work properly in this program. Any help would be appreciated.
#include <msp430.h> #include "driverlib.h" #include "gpio.h" #include "stdio.h" #include "string.h" int main(void) { WDT_A_hold(WDT_A_BASE); // Stop watchdog timer // Configure and verify clocks. // ********** Cannot use CS_CLOCK_DIVIDER_1 for some reason for MCLK - works in another program though ******** printf("Configuring clocks ... \n"); CS_setDCOFreq(CS_DCORSEL_1,CS_DCOFSEL_4); // 16 MHz CS_initClockSignal(CS_SMCLK,CS_DCOCLK_SELECT,CS_CLOCK_DIVIDER_2); // 8 MHz // CS_initClockSignal(CS_MCLK,CS_DCOCLK_SELECT,CS_CLOCK_DIVIDER_1); // 16 MHz CS_initClockSignal(CS_MCLK,CS_DCOCLK_SELECT,CS_CLOCK_DIVIDER_2); // 8 MHz CS_turnOnSMCLK(); printf("Verifying clocks ... \n"); uint32_t MCLK_Frequency; uint32_t SMCLK_Frequency; MCLK_Frequency = CS_getMCLK(); SMCLK_Frequency = CS_getSMCLK(); printf("MCLK_Frequency: %ld \n",MCLK_Frequency); printf("SMCLK_Frequency: %ld \n",SMCLK_Frequency); while(1) {;} }
Found the problem. The FRAM was not being configured prior to setting the clocks. I just added the following line before the clock setup.
FRAMCtl_A_configureWaitStateControl(FRAMCTL_A_ACCESS_TIME_CYCLES_1); // for 16MHz sys clock
The answer was suggested in the forum here:
MSP430FR5859 ResetsWhen MCLK references DCO @ 16MHz - MSP low-power microcontroller forum - MSP low-power...
**Attention** This is a public forum