Run telemetry tick from the xosc rather than the internal clock

geofence_dev
Richard Meadows 2015-03-16 00:18:41 +00:00
rodzic 86c6b2cf0e
commit b2df1f567e
3 zmienionych plików z 6 dodań i 5 usunięć

Wyświetl plik

@ -122,7 +122,7 @@
* XOSC
*/
#define XOSC_FREQUENCY 16369000
#define XOSC_COUNT_RESOLUTION 4
#define XOSC_GCLK1_DIVIDE 4
/**
* Timings

Wyświetl plik

@ -42,6 +42,7 @@
#include "system/conf_clocks.h"
#include "system/system.h"
#include "samd20.h"
#include "hw_config.h"
/* Syncronisation Macros */
#define DFLL_WAIT_FOR_SYNC() \
@ -60,7 +61,7 @@ uint32_t system_clock_source_get_hz(const enum system_clock_source clock_source)
{
switch (clock_source) {
case SYSTEM_CLOCK_SOURCE_XOSC:
return 0;//TODO _system_clock_inst.xosc.frequency;
return XOSC_FREQUENCY;
case SYSTEM_CLOCK_SOURCE_OSC8M:
return 8000000UL >> SYSCTRL->OSC8M.bit.PRESC;

Wyświetl plik

@ -62,7 +62,7 @@ void xosc_init(void) {
system_gclk_gen_set_config(GCLK_GENERATOR_1,
GCLK_SOURCE_XOSC, /* Source */
false, /* High When Disabled */
XOSC_COUNT_RESOLUTION,/* Division Factor */
XOSC_GCLK1_DIVIDE,/* Division Factor */
false, /* Run in standby */
false); /* Output Pin Enable */
@ -251,10 +251,10 @@ void TC2_Handler(void) {
/* Calcuate the frequency of XOSC relative to this source */
switch (_measurement_t) {
case XOSC_MEASURE_OSC8M:
source_freq = capture_value * XOSC_COUNT_RESOLUTION;
source_freq = capture_value * XOSC_GCLK1_DIVIDE;
break;
case XOSC_MEASURE_TIMEPULSE:
source_freq = capture_value * XOSC_COUNT_RESOLUTION * GPS_TIMEPULSE_FREQ;
source_freq = capture_value * XOSC_GCLK1_DIVIDE * GPS_TIMEPULSE_FREQ;
break;
}