Menu

Enabling the SOSC on PIC16F19156 RTC and running on back-up battery.

Help
ashimotok0
2018-06-13
2018-09-27
<< < 1 2 3 > >> (Page 2 of 3)
  • Chris Roper

    Chris Roper - 2018-07-12

    Excerpts from the datasheet for Microchip to consider before withdrawing there excuse and issuing an apology:

    Description
    They are especially suited for battery-powered LCD applications due to an integrated charge pump, high current I/O drive for backlighting, and battery backup of the Real-Time Clock/Calendar (RTCC).

    8.1 VBAT
    This device is equipped with a VBAT pin that allows the user to connect an external battery or an external supply. In the event of the VDD supply failing, the power source connected to the VBAT pin will keep the SOSC and RTCC modules running.

    8.17 VBAT System
    The VBAT subsystem allows the RTCC and SOSC to run from a battery connected to the VBAT pin in the
    event of a VDD failure. Typically, the battery is a 3V coin cell, however the system is designed to operate over the entire VDD voltage range. If VDD is greater than VBAT, the RTCC and SOSC will be powered by VDD. If VDD is less than VBAT, the RTCC and SOSC will switch over to VBAT. See Table 4-5 and Table 4-8 for more information on the VBAT registers.

    FIGURE 9-1: SIMPLIFIED PIC® MCU CLOCK SOURCE BLOCK DIAGRAM
    Secondary Oscillator (SOSC)

    Let em have it.....................

     
    • Anobium

      Anobium - 2018-07-13

      Just fired another broadside at them!

       
  • Anobium

    Anobium - 2018-07-14

    News from Microchump Support.

    From datasheet DS40001923A-page 144 diagram, my understanding is that CLKOUT is not part of SOSC.
    The datasheet said that during VBAT operation only SOSC and RTCC will work.

    This could explain the device behavior.

    My response.

    To clear.

    The clock should continue when VBAT is operating. With the clock maintaining real time during VBAT. Go and ask product support how to do this.

    and, please, please, please do not use your understanding. Escalate. As the RTCC that stops and restarts with same time is not what is expected from the description.

    No other [RTCC]product does this.

    Please escalate. I need to sort this out. This microcontroller and the RTCC has been an issue for many months.

    No response as yet.

     

    Last edit: Anobium 2018-07-14
  • ashimotok0

    ashimotok0 - 2018-07-18

    I really appreciate your efforts chaps. I only just picked up on this as I only work 3 days/week here and consequently missed the latest posts.

     
  • Anobium

    Anobium - 2018-07-29

    Current status

    Support tickets with Microchip are #00308634 and #00258560 are still unresolved.

    Nagged on 19th July 2018 for progress update.

    Summary

    Microchip have provided lots of source code, guidance and MPLAB-X projects. However, all efforts have failed to maintain the RTCC operating as expected. Either the clock does not start or the clock does not maintain time when operating with VBAT (essentially SOCS stops operating).

     
  • ashimotok0

    ashimotok0 - 2018-07-29

    I really appreciate your efforts Evan.

     
    • Anobium

      Anobium - 2018-07-29

      Pleasure.   We may   be able to sort. Clint has a16f19176 and he is now experiencing similar issues but with more brains looking at the issue we may resolve ourselves.

      But, when I nagged today. I was very forceful as we now have three projects with similar RTCC issues.

       
  • Clint Koehn

    Clint Koehn - 2018-07-31

    One more thing to add. On my chip it looks like when you have a battery hooked up (mine is 3 AA which is 4.5v) and disconnect power, it back feeds to the power lines which read around 1.9v. My Timer keeps running blinking my LED though it is very faint. Unplug the battery and everything goes dead.

     
    • Anobium

      Anobium - 2018-07-31

      @Clint. Agree. I have already  reported   parasitic usage   of VBAT.

      No   news. Time   to  nag .

       
      • Anobium

        Anobium - 2018-07-31

        Short update. Microchip called to tell me than the engineer assigned has gone on holiday! He will be back soon.

        I will nag daily.

         
        • Anobium

          Anobium - 2018-08-01

          News

          Nagged. Got a call!! Amazing. New engineer allocated.

          Transcript of conversation. This has been added to the case notes.


          Susmitha Galla (Microchip)

          Thank you for calling in. I’ve just read through your case and have some questions.

          Please explain what are your expectations from the PIC. Can you please give me more details regarding your application? Also, what are you trying to do during Vbat operation?

          From my understanding you are trying to blink an LED during VBAT usage. What is the frequency you are blinking the LED at?


          Me (Evan),

          To be sure of no misunderstanding.

          TheMPLAB-X project posted by Daniel (of Microchip) stops the RTCC and SOSC when VCC is removed. This is NOT the expected operation.

          Serial output (in theMPLAB-X project) is ok. But, when VCC is removed then the RTCC and SOSC should maintain real time not loose time!

          If engineering or the product team confirm this cannot be done then I will need confirmation as this will be a real issue for the users.

          I am not going to repeat all the issues, as these are well documented in this case notes.

          But, to
          keep things simple. Using the project attached, created by Daniel. All we need to do initially is to keep the RTCC and SOSC running during main VCC lost therefore we are using VBAT. Currently, the RTCC clock stops.

          So, resolve this issue to show how this can be done. Then, we can resolve any other issues.


          So, we may get some action soon.

           

          Last edit: Anobium 2018-08-01
  • Anobium

    Anobium - 2018-08-04

    News

    Another engineer has been allocated. This time he knows his stuff. So, we need to send him information as he thinks he has the solution.

    Please send me your circuit schematic, the layout of the PCB, the BOM file, a photo of the microcontroller with the markings visible (so that he can check the date code) and also an invoice for the PIC that shows the supplier. (required to check the lot code. A photo of the anti-static bag label that the parts came in may also work) and the capacitors used with the SOSC crystal.

    @ashimotok0 and @Clint Koehn. PleasegGather up this information and send to me directly via email.

     
    • Anobium

      Anobium - 2018-08-04
       

      Last edit: Anobium 2018-08-04
    • ashimotok0

      ashimotok0 - 2018-08-04

      Hi Evan,

      I can do that but it will take couple of days as I not back in the office until Wednesday.

      Thanks for your efforts ....much appreciated

       
  • Clint Koehn

    Clint Koehn - 2018-08-06

    I just looked at the video but it doesn't really show what he did, or did I miss something. It would be nice to have some written down instructions to follow.

     
  • stan cartwright

    stan cartwright - 2018-08-06

    @Clint...et moi

     
  • stan cartwright

    stan cartwright - 2018-08-06

    Looks like serial through ttl converter and power from pickit and removing pickit stops serial but reconnecting restarts serial.
    2 wires to ttl converter..IT gets power via usb
    or does it drag all down when pwr removed.
    this is guessing.
    whatever was shown was consistant.

     

    Last edit: stan cartwright 2018-08-06
  • stan cartwright

    stan cartwright - 2018-08-06

    How many microchip pics have been found to be faulty and who found the fault?
    There should be an incentive to report faults.
    Can't they help towards pickitplus certification if you have discovered a problem for them?

     
  • Clint Koehn

    Clint Koehn - 2018-08-06

    I did the same thing he did, only when I plugged my power back in, my time was like it was when I unplugged it. So what did he do different? How are his settngs? How can I duplicate what he did?

     

    Last edit: Clint Koehn 2018-08-09
  • Clint Koehn

    Clint Koehn - 2018-08-11

    OK.. This sort of works with the MicrochipRTCC.h file included. I had to extend some time durations in it. I'll explain what I mean by sort of. I start it, set the time, and let it run a little. Turned off the power for 30 sec. Turned the power back on. It by-passed my startup routine and started counting time again. The clock was right! It worked! But... it looks like it also stores the program pointer and it picks up where the power was removed from. I can live with that. So I shut it off before I went to bed. Turned it on this morning. The chip fired up and displayed a time that was about 2 minutes after I shut it off, and it continued to display that same time every second. The program pointer worked but the clock didn't get re-enabled. This morning I'm working on seeing how long I can leave it off before it quits working. The last I tried was 5 min. It still worked. Here is the code and file I'm using. I also think that it uses Timer0 because I can't seem to get both of them working at the same time.

    #chip 16F19176, 16
    #option Explicit
    #config BODEN = Off, VBATEN = Off, CLKOUTEN = On, CSWEN = On, FCMEN = On, FEXTOSC = Off, LCDPEN = On,  RSTOSC = HFINT1
    
    ; ----- Include library
    #include <SoftSerial.h>
    #include <MicroChipRTCC.h>
    
    '---------- Emulate HSerReceive with SoftSerial using Interrupt -------------
    #startup InitPPS, 85
    
    Sub InitPPS
        UNLOCKPPS
    
            'Module: EXT_INT
            INTPPS = 0x0008    'RB0 > INT
    
        LOCKPPS
    End Sub
    
    #define LED PORTB.5
    dir LED out
    
    '=========== Interrupt Handler 3 for communications ===================
    #define SER1_TXPORT PORTB
    #define SER1_TXPIN 1
    #define SER1_RXPORT PORTB
    #define SER1_RXPIN 0
    #define SER1_BAUD 9600
    
    'Set pin directions
    dir PORTB.1 Out
    dir PORTB.0 In
    
    #define SOFTWARE_BUFFER1 60
    
    dim rxbuf3 as string * SOFTWARE_BUFFER1
    dim rxflag3 as Integer
    dim rxbuf3len as byte
    
    rxflag3 = 0
    rxbuf3 = ""
    
    INTEDG = 0 'Interrupt on falling edge
    
    On Interrupt ExtInt0 Call RxInt3
    
    '===== SETUP THE RTCC ===============================
    #define rtcc_TimeDelay 200  'this is in us
    
    rtcc_Initialize
    
    set LED on
    wait 2 s    'a little delay for things to stabalize
    
    'print something to terminal
    Ser1Print "+---------------------+" + Chr(13)
    Ser1Print "|      Test RTCC      |" + Chr(13)
    Ser1Print "+---------------------+" + Chr(13)
    
    dim scnt as Word
    scnt = 0
    
    do
      scnt ++ 'count hundreths of a second
      if scnt > 9 Then
        scnt = 0
        rtcc_ReadTime(tm_hour, tm_min, tm_sec)
    
        Ser1Print right("00" + Str(tm_hour),2) + ":"
        Ser1Print right("00" + Str(tm_min), 2)+ ":"
        Ser1Print right("00" + Str(tm_sec), 2) + Chr(13)
      end if
    
      '------- communications ----------
      if rxflag3 = 1 Then 'currently goes to terminal
        rxflag3 = 0
        Set LED On
    
        if (rxbuf3(1) = "?") then
          rxbuf3len = rxbuf3(0)
          if rxbuf3(rxbuf3len) = 13 Then
            Ser1Print rxbuf3
    
            tm_hour = val(mid(rxbuf3,2,2))
            tm_min = val(mid(rxbuf3,5,2))
            tm_sec = val(mid(rxbuf3,8,2))
    
            rtcc_SetTime(tm_Hour, tm_Min, tm_Sec)
    
            Ser1Print "----< "
            Ser1Print right("00" + Str(tm_hour),2) + ":"
            Ser1Print right("00" + Str(tm_min), 2)+ ":"
            Ser1Print right("00" + Str(tm_sec), 2)
            Ser1Print " >-----" + Chr(13)
    
            rxbuf3len ++
            rxbuf3 = mid(rxbuf3, rxbuf3len)
          end if
        Else
          rxflag3 = 1
          rxbuf3 = mid(rxbuf3, 2)
        end if
      end if
      wait 100 ms
    loop
    
    sub RxInt3
        rxbuf3(0)++
        if rxbuf3(0) > SOFTWARE_BUFFER1 then
           rxbuf3(0) = 1
        end if
        rxbuf3(rxbuf3(0)) = Ser1Receive
        rxflag3=1
        set LED Off
    End Sub
    

    Later,
    Clint

     
  • Clint Koehn

    Clint Koehn - 2018-08-11

    So far I'm up to:
    09:39:04 - stopped
    10:50:55 - restarted

    10:51:45 - stopped
    12:51:45 - restarted

    Later,
    Clint

     

    Last edit: Clint Koehn 2018-08-11
    • Anobium

      Anobium - 2018-08-11

      Not sure I am following.

      Timer0 is independent of the RTCC surely?

      09:39:04 - stopped
      10:50:55 - restarted

      Not sure whether the stop and restart is good. Is it?

       
  • Clint Koehn

    Clint Koehn - 2018-08-11

    I cannot seem to use Timer0 with the RTCC. I will try to set it up again a little later to be sure.

    Yes, it seems to keep time. The thing that supprised me was that the program counter was also saved, and restarted at the point where the power was turned off. It did not go through my init routine. I didn't see that in the data sheet at all.

    Later,
    Clint

     
  • Clint Koehn

    Clint Koehn - 2018-08-12

    OK... here is the latest
    12:52:10 - turned off the power
    15:59:12 - turned the power back on FAILED should have read 19:22:40

    Looks like it worked for a little over 3 hrs. I'm using 3 AAA batteries and the voltage is still at 4v.

    I'm going to reset the time and see what happens overnignt.

    Later,
    Clint

     
  • Clint Koehn

    Clint Koehn - 2018-08-12

    I am running this off of a breadboard and I think I may need a better setup. My on/off power switch appears to have a bounce and it locks the processor up when I turn the switch on (at least I think that is what is happening). It'll start when I turn it back off then on but then it doesn't read right after that. The setup and program posted above is the closest I've come to making this work.

    Later,
    Clint

     

    Last edit: Clint Koehn 2018-08-13
<< < 1 2 3 > >> (Page 2 of 3)

Log in to post a comment.