tapasxplore 1 Posted July 17, 2017 Share Posted July 17, 2017 Hi, I am using MSP430 launchpad with G2553 controller. When I am using sleep(5000), and varying the voltage on the controller from 3v to 4v the timing is varying based on the voltage, but the timing in not changing when I am using delay(5000) when I am varying voltage. Any help will be appreciated. Regards, Quote Link to post Share on other sites
Clavier 34 Posted July 17, 2017 Share Posted July 17, 2017 The delay() function is part of the official Arduino API. It is implemented with a busy loop, based on the CPU clock. The sleep() function is not part of the official Arduino API. It powers down the CPU, and measures time based on the VLO, which doesn't have a accurately specified frequency to begin with and has much higher temperature and voltage coefficients than other clock sources. dubnet, Fmilburn, tripwire and 1 other 4 Quote Link to post Share on other sites
energia 485 Posted July 17, 2017 Share Posted July 17, 2017 Thanks @Clavier for the explanation.To add to this. The VLO is only used if the startup code does not detect an external crystal to source ACLK from. @tapasxplore Note that the MSP430 max VCC is rated @ 3.6. Robert Fmilburn and tripwire 2 Quote Link to post Share on other sites
energia 485 Posted July 18, 2017 Share Posted July 18, 2017 Please also see the comment here I posted here on github here: https://github.com/energia/Energia/issues/569#issuecomment-316120507 Copy of that post: "VLO has a typical frequency of 12kHz hence this is the value used in the code for vlo_freq. With that said, VLO, as per datasheet, has a minimal value of 4kHz and a maximum value of 20kHz. The frequency it settles on varies by part, temperature, power supply, etc. Hence it can end up anywhere between 4 kHz and 20 kHz. Unfortunately there is no way to measure the VLO Freq. on startup. If you would like accurate sleep times then I suggest that you install the 32kHz watch crystal that came with the LaunchPad in the box. Also see this thread for additional information about the sleep() and sleepSeconds() implementation: http://forum.43oh.com/topic/4571-building-low-power-into-energia/?page=2#comment-46495" Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.