Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 6 of 6

Thread: Teensy v3.6: need help after wrong battery connection!

  1. #1

    Teensy v3.6: need help with RTC

    Hi guys,
    I've connected the 3.3V coin battery to my Teensy v3.6 and I've also added on the setup() function the setSyncProvider(getTeensy3Time); call.

    I'v added these 2 new function to my sketch:
    time_t getTeensy3Time()
    {
    return Teensy3Clock.get();
    }

    void rtc_seconds_isr() {
    // do nothing
    }

    Is that all I need?
    It seems to work fine but if I don;t use the board for some days the time is not correct.
    I've checked the connection and the battery Voltage...


    PS: I've also added this lines on my setup fotm MTP but not sure if could cause the isse:

    RTC_IER |= 0x10; // Enable seconds IRQ from RTC peripheral
    NVIC_ENABLE_IRQ(IRQ_RTC_SECOND); // Enable seconds IRS function in NVIC
    Last edited by Bullone; 07-08-2019 at 08:58 AM.

  2. #2
    Junior Member
    Join Date
    Jul 2019
    Posts
    2
    Quote Originally Posted by Bullone View Post
    Hi guys,
    I've connected the 3.3V coin battery to my Teensy v3.6 and I've also added on the setup() function the setSyncProvider(getTeensy3Time); call.

    I'v added these 2 new function to my sketch:
    time_t getTeensy3Time()
    {
    return Teensy3Clock.get();
    }

    void rtc_seconds_isr() {
    // do nothing
    }

    Is that all I need?
    It seems to work fine but if I don;t use the board for some days the time is not correct.
    I've checked the connection and the battery Voltage...


    PS: I've also added this lines on my setup fotm MTP but not sure if could cause the isse:

    RTC_IER |= 0x10; // Enable seconds IRQ from RTC peripheral
    NVIC_ENABLE_IRQ(IRQ_RTC_SECOND); // Enable seconds IRS function in NVIC
    Can you please elaborate your problem?

    Because i did not understand below code:

    time_t getTeensy3Time()
    {
    return Teensy3Clock.get();
    }

    void rtc_seconds_isr() {
    // do nothing
    }

  3. #3
    Thanks for response!
    My problem is that Iíve connected the 3.3v coin battery b cause I need the time to be correctly keep by the system but it seems not working fine: when I upload my sketch the time is set but after couple of days the time is not correct.

    Can you please help me with the needed code for that?
    I saw the example that sync the time when the serial is connected but is not what I need because Iím using USB MTP instead of serial

  4. #4
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,175
    Quote Originally Posted by Bullone View Post
    My problem is that I’ve connected the 3.3v coin battery b cause I need the time to be correctly keep by the system but it seems not working fine: when I upload my sketch the time is set but after couple of days the time is not correct.
    Can you tell us anything more specific than "is not correct"?

    Those 3 words could mean almost anything. Maybe the time is slowly drifting from correct? Maybe it suddenly jumps to something wrong? Maybe a sudden jump happens while power is on? Or maybe the time is correct when you turn off the main power, then incorrect when you later power up?

    Can you understand how you're giving us pretty much zero useful info about the problem? We can help much more when you actually show us the problem....

    I saw the example that sync the time when the serial is connected but is not what I need because I’m using USB MTP instead of serial
    Maybe you're looking at File > Examples > Time > TimeSerial ?

    In that example, hopefully you can see in processSyncMessage(), the time is actually set by setTime(pctime).

    Obviously if you're not using serial communication, and you want to set the RTC to a known correct time, you'll need to find some other way to get the correct time. I believe the library also has examples to get the correct time from a GPS module and over a network using NTP.

    If you're using MTP, perhaps you could craft code on the PC side which writes a specific file with the current time. Then you'd create code on the Teensy side to parse the contents of that file. Maybe the TimeSerial example has code you can reuse, if you create the file with a similar text format.

    Whatever approach you decide to use, when you ask us for help on this forum, please try to follow the "forum rule" which is written in red text at the top of every page. When you ask a question without sharing key details and without showing the code that isn't working, we can't help you much. Solving technical problems over the internet isn't easy, though we often do manage to figure things out here. But if you keep us in the dark so we can't even see what code and what error you're facing, odds of helping by blind guessing aren't so good. Let us try to help, by sharing details and code, so we can actually see the problem.

  5. #5
    Sorry, youíre totally right and I have to apologize!

    I was supposed that just adding a coin battery to the Teensy 3.6 and setup the time (uploading the code) itís all I need to do to have always the correct time just like a common battery watch... am I wrong?
    If Thatís not enough please can you help me understand? Sorry but Iím not so expert

    PS after couple of days the time is not ok and it is in the past

  6. #6
    Junior Member
    Join Date
    Jul 2019
    Posts
    2
    Quote Originally Posted by Bullone View Post
    Sorry, you’re totally right and I have to apologize!

    I was supposed that just adding a coin battery to the Teensy 3.6 and setup the time (uploading the code) it’s all I need to do to have always the correct time just like a common battery watch... am I wrong?
    If That’s not enough please can you help me understand? Sorry but I’m not so expert

    PS after couple of days the time is not ok and it is in the past
    Sorry for the late reply, after reading PaulStoffregen response I want to say may it will be some hardware kind issue. As i work in hardware section and TelltheBell section most, their i found out that sometime bios cell is responsible about the date and time issue in PCs, just because of this we can face timing issue in browser also.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •