Skip to content

Commit bae403f

Browse files
committed
C33: use 32Khz crystal as RTC source
1 parent bd6a5c5 commit bae403f

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

Diff for: libraries/RTC/src/RTC.cpp

+10-8
Original file line numberDiff line numberDiff line change
@@ -437,18 +437,21 @@ void __attribute__((weak)) rtc_callback(rtc_callback_args_t *p_args) {
437437
}
438438
}
439439

440-
rtc_instance_ctrl_t rtc_ctrl;
440+
rtc_instance_ctrl_t rtc_ctrl = {
441+
.open = 0,
442+
};
443+
444+
#ifndef RTC_CLOCK_SOURCE
445+
#define RTC_CLOCK_SOURCE RTC_CLOCK_SOURCE_LOCO
446+
#endif
447+
441448
const rtc_error_adjustment_cfg_t rtc_err_cfg = {
442449
.adjustment_mode = RTC_ERROR_ADJUSTMENT_MODE_AUTOMATIC,
443450
.adjustment_period = RTC_ERROR_ADJUSTMENT_PERIOD_10_SECOND,
444451
.adjustment_type = RTC_ERROR_ADJUSTMENT_NONE,
445452
.adjustment_value = 0, };
446453
rtc_cfg_t rtc_cfg = {
447-
// TODO: change me to RTC_CLOCK_SOURCE_SUBCLK when capacitors are mounted
448-
// https://arduino.atlassian.net/browse/HWH33-204
449-
// Fixes counting time in VBAT mode on H33
450-
// Leave as is for Santiago
451-
.clock_source = RTC_CLOCK_SOURCE_LOCO,
454+
.clock_source = RTC_CLOCK_SOURCE,
452455
.freq_compare_value_loco = 255,
453456
.p_err_cfg = &rtc_err_cfg,
454457
.alarm_ipl = (12),
@@ -458,8 +461,7 @@ rtc_cfg_t rtc_cfg = {
458461
.carry_ipl = (12),
459462
.carry_irq = FSP_INVALID_VECTOR,
460463
.p_callback = rtc_callback,
461-
.p_context = NULL,
462-
464+
.p_context = NULL,
463465
};
464466

465467
#ifdef __cplusplus

Diff for: variants/PORTENTA_C33/pins_arduino.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -204,4 +204,6 @@ static const uint8_t SS = PIN_SPI_CS;
204204
#define LORA_RESET 2 //PWM2
205205
#define LORA_BOOT0 3 //PWM3
206206
#define LORA_IRQ_DUMB 4 //PWM4
207-
#define SerialLoRa Serial3
207+
#define SerialLoRa Serial3
208+
209+
#define RTC_CLOCK_SOURCE RTC_CLOCK_SOURCE_SUBCLK

0 commit comments

Comments
 (0)