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.
Part Number: MSP432P401R
Tool/software: Code Composer Studio
hi all:
I need me to get the exact time of the program.So the method of using COUNT clock cycle in CCS DEBUG . I use the __delay_cycles () precise delay program for 1000 clock cycles.
Then read the value of count to see if it matches.The breakpoint of the program and the settings of the CCS debug breakpoint count are shown in the following picture.
After the program is run, the clock cycle is not 1000, but 2987, between the two measuring breakpoints of the program.As shown in the following picture
This is my doubt, I accurately delay 1000 clock cycles, why the CCS breakpoint count calculates the clock cycle is 2987?
Alex824,
Can you try the following code?
/* DriverLib Includes */ #include <ti/devices/msp432p4xx/driverlib/driverlib.h> /* Standard Includes */ #include <stdint.h> #include <stdbool.h> int main(void) { /* Stop Watchdog */ MAP_WDT_A_holdTimer(); int mclk; while(1) { __delay_cycles(1000); mclk = CS_getMCLK(); } }
I set a breakpoint at __delay_cycles(1000); and a breakpoint at mclk = CS_getMCLK(); made a count event, set reset count on run. Ran to __delay_cycles(1000); ran it again, and received the following count.
If this does work, let me know.
Thank you very much for your reply.
1. I've tried three programs, and the first program is exactly the same as yours. The result is the same as you, the delay of 1000 clock cycles, the count is also 999.
2. In the second program, I used DCO and raised MCLK to 48M. After 1000 clock cycles, the count is 1996. program and the results are as follows.
/* DriverLib Includes */ #include <ti/devices/msp432p4xx/driverlib/driverlib.h> /* Standard Includes */ #include <stdint.h> #include <stdbool.h> int main(void) { int mclk; /* Stop Watchdog */ MAP_WDT_A_holdTimer(); MAP_Interrupt_disableMaster(); //![Simple FPU Config] // Enabling FPU for DCO Frequency calculation MAP_FPU_enableModule(); MAP_PCM_setCoreVoltageLevel(PCM_VCORE1); MAP_FlashCtl_setWaitState(FLASH_BANK0, 2); MAP_FlashCtl_setWaitState(FLASH_BANK1, 2); // Setting the DCO Frequency to a standard 48MHz // Initializes Clock System MAP_CS_setDCOCenteredFrequency(CS_DCO_FREQUENCY_48); MAP_CS_initClockSignal(CS_MCLK, CS_DCOCLK_SELECT, CS_CLOCK_DIVIDER_1 ); while(1) { __delay_cycles(1000); mclk = CS_getMCLK(); } }
3. In the third program, I added the SMCLK, and the count after 1000 clock cycles is the 2987. program and the results are as follows
/* DriverLib Includes */ #include <ti/devices/msp432p4xx/driverlib/driverlib.h> /* Standard Includes */ #include <stdint.h> #include <stdbool.h> int main(void) { int mclk; /* Stop Watchdog */ MAP_WDT_A_holdTimer(); MAP_Interrupt_disableMaster(); //![Simple FPU Config] // Enabling FPU for DCO Frequency calculation MAP_FPU_enableModule(); MAP_PCM_setCoreVoltageLevel(PCM_VCORE1); MAP_FlashCtl_setWaitState(FLASH_BANK0, 2); MAP_FlashCtl_setWaitState(FLASH_BANK1, 2); // Setting the DCO Frequency to a standard 48MHz // Initializes Clock System MAP_CS_setDCOCenteredFrequency(CS_DCO_FREQUENCY_48); MAP_CS_initClockSignal(CS_MCLK, CS_DCOCLK_SELECT, CS_CLOCK_DIVIDER_1 ); MAP_CS_initClockSignal(CS_SMCLK, CS_DCOCLK_SELECT, CS_CLOCK_DIVIDER_2); while(1) { __delay_cycles(1000); mclk = CS_getMCLK(); } }
**Attention** This is a public forum