Jump to content
43oh

AnthonyKl

Members
  • Content Count

    0
  • Joined

  • Last visited

Reputation Activity

  1. Like
    AnthonyKl reacted to sirri in Real-Time Clock (RTC) Library for the MSP430/LaunchPad   
    Hi Yan,
    Your library is awesome and i am getting closer to my own Light Alarm : ) thanks to you. Is there a way to set up the time? (For example current pc time > msp430 or at least a method to set it up manually?)
    Thanks,
    Sirri
  2. Like
    AnthonyKl reacted to xv4y in Real-Time Clock (RTC) Library for the MSP430/LaunchPad   
    Hi Sirri,
     
    Your workaround should work but the problem is not here.
    The problem is that by default, Energia is sourcing the ACLK from the VLO 12 KHz instead of the 32KHz crystal.
    This make the RTC around 2-3 times slower.
    We should be able to change this by settings in the sRTC lib code but unfortunately it does not work as expected.
    Rob is currently working on this issue :
    http://forum.43oh.com/topic/2993-new-energia-release-0101e0009-12062012/page-2
     
    For now, the right solution is to go inside Energia files to edit the hardware/msp430/cores/msp430/wiring.c file and comment out the line BCSCTL3 |= LFXT1S.
     
    Regards,
    Yan.
  3. Like
    AnthonyKl reacted to sirri in Real-Time Clock (RTC) Library for the MSP430/LaunchPad   
    it is working,thanks xv4y. But it is (seconds) around 2 times slower. How can we fix that? I am using the latest Energia and soldered the crystal to my launchpad rev 1.4 (2553 chip) thanks.
     
    edit: after some trial and errors i have noticed if i change below on sRTC.cpp the seconds are almost accurate (maybe one second error in one minute) i believe that accuracy can be improved.
     
    here is the change it worked for me, in case some beginner like me uses:
    TA1CCTL0 = CCIE; // CCR0 interupt activated // TA1CCR0 = 4096-1; // 4096 ticks of 32KHz XTal = 1 second => CCR0 counts N+1 TA1CCR0 = 1568-1; TA1CTL = TASSEL_1 | ID_3 | MC_1; // Clock for TIMER 1 = ACLK, By 8 division, up front
  4. Like
    AnthonyKl reacted to xv4y in Real-Time Clock (RTC) Library for the MSP430/LaunchPad   
    Hi,
     
    I have updated the library to be a little bit cleaner :
    http://xv4y.radioclub.asia/2012/12/19/bibliotheque-rtc-pour-energia-version-1-02/
    Here's the downloads page :
    http://xv4y.radioclub.asia/boutique/docs/
     
    And, well, guys, I am sorry but I don't think I will put much more work on it.
    It works for my purpose, so...
    I have a DS1307 in my hands but will hook it to an Arduino for a "weather station" project I have. The Arduino having the EEPROM embedded is more suited for this project as it allows to save measurements and compute statistics...
     
    Yan.
  5. Like
    AnthonyKl reacted to Rei Vilo in Real-Time Clock (RTC) Library for the MSP430/LaunchPad   
    A solution would be to use the Unix time  
     
    from http://en.wikipedia.org/wiki/Unix_time   Unix time to year-month-day hour-minute-second converting functions and libraries are widely available.
  6. Like
    AnthonyKl reacted to roadrunner84 in Real-Time Clock (RTC) Library for the MSP430/LaunchPad   
    Sure, using unix time internally would be a fine option. But it's not necessary for the current application.
    Using unix time would force you to implement leap year calculation and full date mode as well.
  7. Like
    AnthonyKl reacted to roadrunner84 in Real-Time Clock (RTC) Library for the MSP430/LaunchPad   
    The RTC library does not (or should not) "support" any chip; instead, the user needs to provide a call to the IncSec() method once per second.
    It would be nice ofcourse to derive RTC classes from this one that set up clock sourcing themselves. Then a derived RTC could be made for the DS1307 is wanted. At least, that's the way C++ is supposed to work.
  8. Like
    AnthonyKl reacted to sirri in Real-Time Clock (RTC) Library for the MSP430/LaunchPad   
    Thanks. I will work on it..
  9. Like
    AnthonyKl reacted to xv4y in Real-Time Clock (RTC) Library for the MSP430/LaunchPad   
    Hi,
     
    This is for using "inboard" RTC capabilities of the LaunchPad.
    If you solder the provided 32KHz Xtal to the LaunchPad board and using the MSP430G2553 internal clocks/timer, you can have a really accurate RTC clock. However, you have to the time calculation yourself. This library only implements time. A little bit more work would allow you to compute days, months, years... The real difficulty is that the UTC calendar is a little bit more complex than just adding numbers, since the Earth rotation is not exactly 365 days, you have bissextiles years, leap seconds...
     
    Yan.
  10. Like
    AnthonyKl reacted to sirri in Real-Time Clock (RTC) Library for the MSP430/LaunchPad   
    Thanks. Is it possible to use Launchpad 3.3 V for DS1307, instead of coin cell (3V) Anyone tried that?
  11. Like
    AnthonyKl reacted to Rei Vilo in Real-Time Clock (RTC) Library for the MSP430/LaunchPad   
    I tried two RTCs with the MPS430G2553: the DS1307 and the even more integrated PCD2129A (no quartz needed).
     
    Both work fine and the Arduino libraries require no special adaptation to run on Energia.
  12. Like
    AnthonyKl reacted to xv4y in Real-Time Clock (RTC) Library for the MSP430/LaunchPad   
    Thanks for the suggestion.
    As for low-level init you are right I should do it in another routine as I have done in the AD9850 lib following the structure I saw in Rei Vilo 3110 library.
     
    I will try to do this tomorrow, it is a bit late for coding right now...
     
    Yan.
  13. Like
    AnthonyKl reacted to sirri in Real-Time Clock (RTC) Library for the MSP430/LaunchPad   
    I guess this is the only Energia RTC Library? Am i right?
    My other question is;  Does it work with DS1307 IC just like it works in Arduino? Anyone tried?
    Thanks.
  14. Like
    AnthonyKl reacted to roadrunner84 in Real-Time Clock (RTC) Library for the MSP430/LaunchPad   
    You're doing low-level setup in the constructor of your RTC, and you do not even depend on it. I suggest you change your constructor from
    RealTimeClockSec::RealTimeClockSec(void) { RTC_sec = 0; RTC_min = 0; RTC_hr = 0; WDTCTL = WDTPW | WDTHOLD; // Kill watch-dog BCSCTL1 = DIVA_3; // Clock = ACLK / 8 BCSCTL3 |= (LFXT1S_0 | XCAP_3); // Internal 12.5pF cap for 32KHz crystal TA1CCTL0 = CCIE; // CCR0 interupt activated TA1CCR0 = 4096-1; // 4096 ticks of 32KHz XTal = 1 second => CCR0 counts N+1 TA1CTL = TASSEL_1 | ID_3 | MC_1; // Clock for TIMER 1 = ACLK, By 8 division, up front }; to
    RealTimeClockSec::RealTimeClockSec(void) { RTC_sec = 0; RTC_min = 0; RTC_hr = 0; }; And let the library's user place code similar to
    WDTCTL = WDTPW | WDTHOLD; // Kill watch-dog BCSCTL1 = DIVA_3; // Clock = ACLK / 8 BCSCTL3 |= (LFXT1S_0 | XCAP_3); // Internal 12.5pF cap for 32KHz crystal TA1CCTL0 = CCIE; // CCR0 interupt activated TA1CCR0 = 4096-1; // 4096 ticks of 32KHz XTal = 1 second => CCR0 counts N+1 TA1CTL = TASSEL_1 | ID_3 | MC_1; // Clock for TIMER 1 = ACLK, By 8 division, up front in their setup() themselves.
     
    Also, you could implement operator++() to let a user call the RTC like
    myRTC++; to increment the time.
  15. Like
    AnthonyKl reacted to xv4y in Real-Time Clock (RTC) Library for the MSP430/LaunchPad   
    Huh... well... the truth is that I don't know.
    You need to divide by 8 because if not the Timer will overflow. Why I have written is divided by 8 twice ???
     
    I guess the comments are not accurate. I have two versions of the library one with a better precision than one second.
    I have uploaded updated libs here, but I still need to correct the comments I think :
    http://xv4y.radioclub.asia/boutique/docs/
     
    Yan.
  16. Like
    AnthonyKl reacted to xiaodoudou172 in Real-Time Clock (RTC) Library for the MSP430/LaunchPad   
    Hallo I have download your library and it was working fine. But I have a question: why you set the ACLK divided by 8 while the timer clock is also divided by 8? I don't get it.
  17. Like
    AnthonyKl reacted to energia in Real-Time Clock (RTC) Library for the MSP430/LaunchPad   
    Energia 0101E0006 sets the ACLK to internal VLO which is about 12KHz typical. The following patch should fix it:
     

    --- a/hardware/msp430/cores/msp430/wiring.c +++ b/hardware/msp430/cores/msp430/wiring.c @@ -78,7 +78,7 @@ void initClocks(void) /* SMCLK = DCO / DIVS = nMHz */ BCSCTL2 &= ~(DIVS_0); /* ACLK = VLO = ~ 12 KHz */ - BCSCTL3 |= LFXT1S_2; + //BCSCTL3 |= LFXT1S_2; } #define SMCLK_FREQUENCY F_CPU
  18. Like
    AnthonyKl reacted to HannesBK in Real-Time Clock (RTC) Library for the MSP430/LaunchPad   
    Hello Yannick,
     
    thank you for the RTC library. It's very useful for me.
    Is works fine with Energia 0005a.
    But with 0006 the clock is slow (~2 seconds per "Tick_Tac").
     
    Is it possible to fix that for 0006?
     
    Thank you
    Hannes
  19. Like
    AnthonyKl reacted to xv4y in Real-Time Clock (RTC) Library for the MSP430/LaunchPad   
    Hi,
     
    On this page you can find the code for a simple C library using the RTC capabilities included in the MSP430g2553 shipped with the LaunchPad.
    I know TI already offer a nice RTC lib but it is in assembler and not easy to compile outisde of the given IDE.
    This one has been designed to work under Energia and should be easier to port.
     
    http://xv4y.radioclub.asia/2012/05/22/bibliotheque-rtc-pour-le-msp430/
     
    Regards,
    Yannick.
  20. Like
    AnthonyKl reacted to bluehash in Real-Time Clock (RTC) Library for the MSP430/LaunchPad   
    Hello Yannick,
    Thanks for sharing your code. Keep them coming.
×
×
  • Create New...