Hello,
i am currently working on the MSP430F5437A with CCS 5.1, now I did run across something I really do not understand.
My MSP430 features an internal CPU Voltage ( Vcore ) which can be set by some bits ( PMMCOREVx ) by some routines provided in the hal_pmm.c or can be selfmade by reading the FamilyUserGuide.
I didnt implement those functions by myself and honestly I do not really see a "big" advantage of setting down the Core voltage, in my opinion the maximum gain you get form doing so are about 500 µA in active mode. And in my application I do already have 20 mA active mode current ( with external peripherals of course) so I do not really care about this extra current consumption.
What I do care about is my High frequency oscillator. I have an 25 MHz iscillator attached and in use, until now I thought my MCLK and SMCLK really do work on 25 MHz when I code it that way, but now i am beginning to struggle since I saw in the Datasheet, that my controller is not supposed to use 25 MHz while its Core-Voltage is on a minor level.
I do not really know how to meassure the frequency, to be honset. My PCB is kind of burried in a device, so its not just meassureing the pins or something. What I did I have a RTC established wich I kind of trust with counting seconds. I also have a LCD so I counted both the RTC and the 25 MHz doing a second count and giving it out on my Display. This actually works pretty nice, and I could also find my SMCLK running slightly faster!! than my RTC with some settings.
What I did forget to mention, MCLK and SMCLK are running on the attached XT2 High frequency 25 MHz oscilator. ACLK is running on the XT1 clock oscillator.
So here come the questions:
The SMCLK is supposed to run SLOWER while Vcore is not on the highest level (3 ), how can I determine that as the oscillator will alwys swing with 25 MHz, so how is the CPU suppose to slow this setting down internally???? is it switching to the DCO without telling me, I do not really get the way this should be odne.
Another strange thing is the PMMCOREVx settings, I debugged it and I realized that this value is actually saved in the MSP430, I do not know how this should work, since I power cycled the whole think and startet to debug again and again, anbd everytime I saw my last settings in this register, can that somehow be, or is the MSP430 fooling me, and some Cs didnt completly dischargeor something like that.
Has anyone of You some good idea of measuring the actual frequency of SMLCK MCLK, since I am doing some math with it, like integration time,etc. it is really important to me to get this right. As I mentioned I have a LCD attached which I currently use for showing the results to me, but i am not convinced yet. Think I should definetly meassure it with an oscilloscope somewhere, which is hard too, because of the load capacitors attached to the oscillator.
And finally, if noone know answers to this, would you suggest just putting Vcore to max and simply doing as I do right now, this would be my solution for now, since I have LPM current of 3 µA which is sufficient for me, and in active mode I simply do not care about the extra current consumption of the higher Vcore levels.
Glad you read this.
Best wishes.
Seb
sebso how is the CPU suppose to slow this setting down internally
The PMMCOREV bits control the output voltage of the interla core voltage generator. Nothing more. Having them on the lowest settign and driving MCLK with a 25MHz crystal is as fatal as having them on the highest settign and applying a 50MHz crystal. Both will crash the cpu.
It is your job to know what core voltage you program and what external clock (or DCO clock) you use. If you fail to adjust the settings so that they match, things won't work.
However, MCLK and SMCLK have dividers, so you can set MCLK (which is the only critical clock) to 1/4 of the crystal/oscillator frequency while you lower the core voltage.
seb everytime I saw my last settings in this register, can that somehow be, or is the MSP430 fooling me, and some Cs didn't completely dischargeor something like that.
Also, when you do a power cycle, the MSP will immediately start. The debugger will attach much later, when your code was perhaps already run, changing the value from default.
_____________________________________Before posting bug reports or ask for help, do at least quick scan over this article. It applies to any kind of problem reporting. On any forum. And/or look here.If you cannot discuss your problem in the public, feel free to start a private conversation: click on my name and then 'start conversation'. But please do so only if you really cannot do it in a public thread, as I usually read all threads. And I prefer to answer where others can profit from it (or contribute to it) too.
Thank You Jens for your insight. First some answers to your points:
I do not think I am working in a simulator mode ( can I proof this somehow ) since I have a MSP430 UIF USB debugger attached to my PCB and on this PCB there is a LCD running with according settings ( and I can this changes see ) , so I think it could be that the debug mode is not updating the register settings, which of course is bad for my debugging, since I have to trust those values.
Anohter point now: my biggest Vcore level is 2, this means a maximum High frequency of 20 MHz is applied to the CPU internally ( while still there is a 25 MHz oscillator applied to XT2 ) . Now it seems to me, at leats my settings say I am using XT2 with divider 1 => 25 MHz as MCLK and SMCLK source. Regarding your insight, the MSP430 should somehow trip or fail to work ( I assume this might not happen, but statistically this should happen). In my case untill now, I never say something like this, and I definetly will see a POR PUC BOR in any cases because my LCD will then restart.
So I am still confused, what you say makes completly sense to me, although I just dont see it in reality in my MSP430.
Jens-Michael Gross Having them on the lowest settign and driving MCLK with a 25MHz crystal is as fatal as having them on the highest settign and applying a 50MHz crystal. Both will crash the cpu.
I do not agree with this statement though, as the datasheet and or familyguide states that the higher Vcore levels dont affect lower frequencies but vice versa it does. So that is why I think my workaround can be to just put Vcore to the highest level and never touch it again, no matter with what frequency my CPU will run.
My next step will be to measure the frequency on one physical pin ( I thought of measuring it directly at my crystal, but I think the probe will affect the frequency, due to its capacitance ?! I will test it anyway ) , then I will update this post with the results.
What I would have expecetd was: a MCLK of 20 MHz while in lower Vcore, but settings of 25 MHz applied.
Thanks for reading.
sebI do not think I am working in a simulator mode ( can I proof this somehow ) since I have a MSP430 UIF USB debugger attached to my PCB and on this PCB there is a LCD running with according settings ( and I can this changes see )
sebmy biggest Vcore level is 2, this means a maximum High frequency of 20 MHz is applied to the CPU internally
seb( I assume this might not happen, but statistically this should happen)
seb the datasheet and or familyguide states that the higher Vcore levels dont affect lower frequencies but vice versa it does.
seb( I thought of measuring it directly at my crystal, but I think the probe will affect the frequency, due to its capacitance ?
On almost every MSP, there is a way to output SMCLK and/or ACLK and sometimes even MCLK to a port pin for measurements. Usually, just the proper PxSEL and PxDIR bits need to be set.
sebWhat I would have expecetd was: a MCLK of 20 MHz while in lower Vcore, but settings of 25 MHz applied.
Actually, if the MSP would know about absolute frequencies (for comparison/limiting), it wouldn't need the crystal at all :)
So now to come back at some points.
I did meassure the voltage of Vcore and some clock settings on my Oscilloscope. Everything seems to work pretty fine, Vcore is inbetween 1,4V and 1,9V in the levels 0 .. 3, which I guess is just right. MY CPU now really kind of trips when I set the MCLK to 25 MHz and afterwards try to adapt the Vcore level to an higher value so it fits its demands.
One thing that is bothering me, is the LPM current. Now with adaption of SetVCoreVoltage i get aroun d 5,4 µA LPM3 current, before my usage of SetVCore i got down to 2,3 µA but the code now seems more reasonable than before, so i am a little bit confused. But as long as my MSP430 is running for sure and guranteed I will take that extra current and trade it for reliability.
I will keep this up when I do additional measurment.
sebMY CPU now really kind of trips when I set the MCLK to 25 MHz and afterwards try to adapt the Vcore level to an higher value so it fits its demands.
You must first raise PMMCOREV and when the coltage has successfully risen (takes some time) then you may raise MCLK.
sebwith adaption of SetVCoreVoltage i get aroun d 5,4 µA LPM3 current, before my usage of SetVCore i got down to 2,3 µA