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.
Environment: IAR for MSP430 (full version) - debugging code on Launchpad MSP-EXP430FR5969
Hardware configuration: DCO = 16MHz, 0 wait states on FRAM (also experimented changing this to no effect)
Simple task: Toggle a GPIO pin as fast as possible
Emitted assembler from IAR:
??tleReadFactory_0:
XOR.B #0x80, &0x202
JMP ??tleReadFactory_0
This should take 8 instruction cycles - 5 for the xor and 3 for the jmp - verified with the cycle counter on the EEM
When I look at the pin with a scope, the pin toggles every 1usec - exactly twice the expected interval of (1/16MHz)*8 = 500usec
It isn't FRAM wait states as I tried changing them which confirms that I am probably at 100% on the cache hits which makes sense given it is just a tiny little loop
Verified the DCO via SMCLK with 2 prescale and output to a pin. changing the DCO changes the interval as expected with the factor of 2 conserved.
Looking for ideas of where else to look for the timing leak. Does the embedded emulation add that much overhead?
Hi Edwin,
First, I'd strongly recommend using wait states if your SMCLK or MCLK is above 8 MHz, as pointed out in Table 5.3 in the datasheet. Perhaps, you're dividing (DIVS) the 16 MHz DCO by 2, which would make SMCLK or MCLK equal to 8 MHz and which could be why the wait states don't change anything. Can you confirm if this is the case?
Also, the MSP430FR5xx/6xx devices have a hardware cycle counter. However, the measured cycles can be slightly off due to releasing/reclaiming the device from/back under debug control. This is mentioned on page 8 in the Advanced Debugging Using the Enhanced Emulation Module (EEM) With Code Composer Studio Version 6 app note.
In case you're not aware of this, the FRAM accesses are only subject to the 8 MHz access limitation. Using wait states and a higher frequency system clock like 16 MHz can boost performance. However, the 16 MHz system clock frequency doesn't result in a FRAM write speed that's twice as fast (not proportional increase). This is because the accesses to the RAM and the instruction fetches in the cache are executed more quickly. Strategies such as leveraging DMA and increasing the system clock frequency can be found in the Maximizing Write Speed on the MSP430™ FRAM app note.
Lastly, if your application requires a PWM output, check out the PWM modes of the Timer_A and Timer_B modules. These modes require no CPU intervention. See Section 19.1 in the User's Guide.
Regards,
James
MSP Customer Applications
**Attention** This is a public forum