Set.Clock - FEDs' time/date problem

70 views
Skip to first unread message

Hamid Taghipourbibalan

unread,
Jan 16, 2023, 4:24:48 AM1/16/23
to FEDforum
Hello!

I recently noticed two problems with the Set.Clock program and the date/ time on FEDs; 1) once I run the program on FEDs, the time is not always identical(synced) on all of the boards some of them are some seconds ahead or behind. 2) When I restart a device, the clock also returns to the date and time I had run the Set.Clock program!

The batteries are relatively new (not older than 1 year and of course, the devices have not been running all the time throughout the year).
I also have the latest version of the FED library installed on my computer.


Has anybody experienced the same issue? Or am I doing something wrong?!



Thanks.


Hamid Taghipourbibalan
Ph.D. fellow (Stipendiat) in Behavioural Neuroscience @ Mccutcheonlab

Lex

unread,
Jan 16, 2023, 1:00:30 PM1/16/23
to Hamid Taghipourbibalan, FEDforum
Hi Hamid! 
Thanks for the question - this is an important issue so I want to give some background on how the FED3 keeps time.  FED3 has a real-time clock (RTC) inside keeping time with a quartz crystal, just like a digital watch. And just like a digital watch, this RTC can get out of sync.  The RTC we use is the PCF8523 which can drift up to ~8 seconds per month, so it will need to be reset periodically. There are two ways of doing this: 

1. If you just need to set it a few minutes back or forward you can do this on the device itself.  Hold both pokes during startup (while mouse is running across the screen) and you will enter a small edit menu where you can set the device # and the RTC.  Video demo here.

2. However, if the clock is several days (or months) out of sync it will be easier to use the "SetClock" example in the FED3 library.  This will set the RTC to the local time on your computer.  Importantly, as you've discovered, when you then reset the device again with the "SetClock" code on it, it will revert to the time you flashed it, as you're re-running the same "SetClock" code whenever you reset it.  So your FED3 is operating as designed, although I understand why this would be confusing.

The solution is to flash "SetClock" and then flash your behavioral code without resetting your device.  The behavioral code does not reset the RTC, so it will continue to count up from the time you first flashed "SetClock".  So why are your devices ending up out of sync?  This depends on how long it takes your computer to flash the FED3, which is not a constant duration (your computer may be busy doing other things so it takes more time for some devices to flash).  If it's only a few seconds I wouldn't worry about it, the FED3 is not a precision time-keeping device.  But if it's >1 minute you can use the on-board adjustment routine to sync them back up.

Hope this helps!
-Lex




--
You received this message because you are subscribed to the Google Groups "FEDforum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fedforum+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fedforum/ac75b0a3-76ed-4f0f-9849-c7dab0d26e01n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages