This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Real time clock for timestamp in datalogger

Hi forum,

I want to impement a data logger device in order to collect data from 16 ADCs. I want to use the real-time clock of the hibernate module in order to timestamp each row of ADC data and write them in a .csv file in a microSD card. In the real-time clock interrupt handler a use the ADCProcessorTrigger() function in order to create an interrupt and collect the ADC data. I think that set up the hibernate module properly but it seems that an interrupt on RTC match doesn't occur, so the program doesn't call the interrupt handler function in order to generate an ADC interrupt and collect tha data. Is there something in my code that I can't see. I attach the whole project below.art-logger_final.zip

  • Would it not make sense to (spectacularly) shorten & clarify your code by (temporarily) limiting it to ONE ADC? It's likely that the size/scope of your project will prove too demanding for most here to read & properly review.

    In addition - you complicate w/the addition of: Hibernate, microSDcard & RTC.   Again - wouldn't it (better) serve you to test/verify, "ONE small program feature at a time" - rather than this unwieldy grouping?

    KISS argues for the smallest, simplest implementation - which confirms your "basics" - and then serves as a proper foundation for "onward/upward."   All at once - as you've noted (and suffered) has little chance of success...

  • Vaggelis,

    To take cb's comments one step further, I would eliminate the ADC portion of your code altogether. In other words, minimize your code to just the RTC matching function. When a match occurs, trigger an interrupt and use the ISR for your break point or to toggle an IO. Once you have the RTC portion working, try hooking up to a single ADC trigger and go from there. In the meantime, try looking for other posts in the TM4C forum related to RTC matching to see if this reveals any possible issues with RTC matching for the device you are using (which you haven't elaborated as to which device it is).

    With that said, if you are using an RTC match to trigger the ADC conversion, why do you need to timestamp? Just log the start time and you would already know the interval so simple math would work. You could use the system clock+prescaler with a periodic interrupt for this purpose and eliminate the need for the RTC as long as you only need relative time. If, however, you need absolute time, you could simply time stamp the start or first conversion with the RTC time and use math from there on out to add the interval time to each conversion.
  • Chuck,

    May I call, "Inspired" for your direction to "toss" the "timestamp?"   That "eats" memory - does it not - and surely extracts added MCU cycles.

    As always - no rocket (now or past) would launch successfully by assembling (untested/unverified) the multitude of components - and then (praying) & pressing "Launch!"    And yet that always is reported here.   (most often by, "Unguided Posters" - had I mentioned that?)

    KISS is short, sweet, memorable and UNIVERSAL!   Conveys what should be done - most always!   And is (extremely) noticeable by its total absence here...

  • Hello guys,
    Sorry for the short delay!
    I followed your advice and tested my code "one feature at time". And guess what... Everything works fine!
    For the timestamp feature I wanted I used SysTick instead of RTC, because I found it simpler to implement and understand.
    Thank you for your time and for your valuable advice!

    Regards, Vaggelis
  • While we're glad for you - if you achieved correct operation & data exchange between: "Hibernate, MicroSDcard & RTC" - our hats raise in your honor.

    Small, highly focused, program objectives - executed "One at a time" most always prove, "Best, Fastest, Most Robust." And that's long been (well) described as "KISS" - even if - and especially if - the KISS term is banned here.