-
Notifications
You must be signed in to change notification settings - Fork 9
OBC Time Service
Mandro edited this page Dec 29, 2016
·
1 revision
Time Service is component responsible for maintaining mission time.
- TS1: Time update
- TS2: Time correction and storage
- TBD: TS3: Time restore on startup
- Updates in-memory mission time.
- Uses internal Backup Real Time Counter (BURTC) to increment mission time.
- Use LFRCO oscilator (
burtcInit.clkSel = burtcClkSelLFRCO;
)
- Use LFRCO oscilator (
- Procedure:
- Startup:
- Initialize semaphore
- Initialize BURTC
- Enable Interrupt (
NVIC_EnableIRQ(BURTC_IRQn)
) - Start task
- ISR (
void BURTC_IRQHandler(void)
):- Give semaphore
- Time monitoring task:
- [In infinite loop]
- Take semaphore
- Success:
- call time service with
TIME_UPDATE_INTERVAL
ms increment - Optionally: substract 1 ms every 50 intervals to reduce measuring error
- Failure: log
- Startup:
- Values:
- Prescaler set to 3 (244 μs) (
burtcInit.clkDiv = 3
) - Compare value set to 205 (
BURTC_CompareSet(BURTC_CounterGet() + 205)
) -
TIME_UPDATE_INTERVAL
= 50 ms (~ 244 μs * 205) - Accuracy with above settings:
- Interrupt interval every 50.02 ms
- 0.04% error: (20 μs error every interrupt, 1 ms error every 50 interrupts, 360 ms error every 15 minutes)
- Prescaler set to 3 (244 μs) (
- Corrects the mission time by taking into account value from external real time clock (EXRTC)
- Persists the mission time to external flash
- Runs every
TIME_PERSIST_INTERVAL
minutes - Task procedure:
- Read initial values on startup:
- Read current mission time from time service ->
MCU[t-1]
- Read current time from EXRTC ->
RTC[t-1]
- Read current mission time from time service ->
- [Infinite loop]:
- Delay
TIME_PERSIST_INTERVAL
minutes - Read update values:
-
MCU[t]
from time service -
RTC[t]
from EXRTC
-
- Correct the
MCU[t]
ΔMCU = (MCU[t] - MCU[t-1])
ΔRTC = (RTC[t] - RTC[t-1])
- If either
Δ
is negative set it to 0 MCU[t] = MCU[t-1] + (ΔMCU + ΔRTC)/2
- Persist the
MCU[t]
andRTC[t]
on external flash RTC[t-1] = RTC[t], MCU[t-1] = MCU[t]
- Read initial values on startup:
- Values:
-
TIME_PERSIST_INTERVAL
= 15 minutes
-
pw-sat.pl | radio.pw-sat.pl | Twitter | Facebook | Instagram
- Meeting 21.11.2015
- [Weekly 20.04.2016] (https://github.com/PW-Sat2/PWSat2OBC/wiki/Weekly-20-04-2016)
- [Weekly 4.05.2016] (https://github.com/PW-Sat2/PWSat2OBC/wiki/Weekly-4.05.2016)
- Weekly 11.05.2016
- Weekly 02.06.2016