SatNOGS-COMMS  4.1.0
A COMMS subsystem for CubeSats
Loading...
Searching...
No Matches
startup.cpp
Go to the documentation of this file.
1#include "startup.hpp"
2#include "memory_monitor.hpp"
3#include "ota.hpp"
6
7namespace scl = satnogs::comms::lib;
8
9namespace satnogs::comms
10{
11
12#if DT_HAS_COMPAT_STATUS_OKAY(st_stm32_watchdog)
13#define WDT_NODE DT_COMPAT_GET_ANY_STATUS_OKAY(st_stm32_watchdog)
14#else
15#error "IWDG is not available. Check the device tree configuration"
16#endif
17
18const struct device *v_bat_dev = DEVICE_DT_GET(DT_ALIAS(vbat));
19
20const struct gpio_dt_spec led0 = GPIO_DT_SPEC_GET(DT_ALIAS(led0), gpios);
21const struct gpio_dt_spec led1 = GPIO_DT_SPEC_GET(DT_ALIAS(led1), gpios);
22
23const struct spi_config radio_spi_cfg = {
24 .frequency = 10000000,
25 .operation = SPI_OP_MODE_MASTER | SPI_TRANSFER_MSB | SPI_WORD_SET(8) |
26 SPI_LINES_SINGLE | SPI_FULL_DUPLEX | SPI_FRAME_FORMAT_MOTOROLA,
27 .cs = {.gpio = {.port = nullptr, .pin = 0, .dt_flags = 0}, .delay = 0}};
28const struct device *radio_spi_dev = DEVICE_DT_GET(DT_NODELABEL(spi4));
29const struct gpio_dt_spec radio_cs =
30 GPIO_DT_SPEC_GET(DT_NODELABEL(radio_cs), gpios);
31
32const struct gpio_dt_spec radio_rst =
33 GPIO_DT_SPEC_GET(DT_NODELABEL(radio_rst), gpios);
34
35const struct gpio_dt_spec radio_ext_clk =
36 GPIO_DT_SPEC_GET(DT_NODELABEL(en_ext_clk), gpios);
37
38const struct spi_config fpga_spi_cfg = {
39 .frequency = 5000000,
40 .operation = SPI_OP_MODE_MASTER | SPI_TRANSFER_MSB | SPI_WORD_SET(8) |
41 SPI_LINES_SINGLE | SPI_FULL_DUPLEX | SPI_FRAME_FORMAT_MOTOROLA,
42 .cs = {.gpio = SPI_CS_GPIOS_DT_SPEC_GET(DT_NODELABEL(fpga_spi)),
43 .delay = 4}};
44const struct device *fpga_spi_dev = DEVICE_DT_GET(DT_NODELABEL(spi2));
45
46const struct gpio_dt_spec fpga_done =
47 GPIO_DT_SPEC_GET(DT_NODELABEL(fpga_done), gpios);
48
49#if DT_NODE_EXISTS(DT_NODELABEL(fpga_boot_sel0)) && \
50 DT_NODE_EXISTS(DT_NODELABEL(fpga_boot_sel1))
51const struct gpio_dt_spec fpga_boot_sel1 =
52 GPIO_DT_SPEC_GET(DT_NODELABEL(fpga_boot_sel1), gpios);
53const struct gpio_dt_spec fpga_boot_sel0 =
54 GPIO_DT_SPEC_GET(DT_NODELABEL(fpga_boot_sel0), gpios);
55#endif
56
57const struct gpio_dt_spec p5v_rf_en =
58 GPIO_DT_SPEC_GET(DT_NODELABEL(p5v_rf_en), gpios);
59const struct gpio_dt_spec p5v_fpga_en =
60 GPIO_DT_SPEC_GET(DT_NODELABEL(p5v_fpga_en), gpios);
61const struct device *sens_i2c = DEVICE_DT_GET(DT_ALIAS(sensorsi2c));
62
63const struct gpio_dt_spec can1_en =
64 GPIO_DT_SPEC_GET(DT_NODELABEL(can1_en), gpios);
65const struct gpio_dt_spec can1_low_pwr =
66 GPIO_DT_SPEC_GET(DT_NODELABEL(can1_low_pwr), gpios);
67const struct gpio_dt_spec can2_en =
68 GPIO_DT_SPEC_GET(DT_NODELABEL(can2_en), gpios);
69const struct gpio_dt_spec can2_low_pwr =
70 GPIO_DT_SPEC_GET(DT_NODELABEL(can2_low_pwr), gpios);
71
72const struct gpio_dt_spec p5v_rf_pg =
73 GPIO_DT_SPEC_GET(DT_NODELABEL(p5v_rf_pg), gpios);
74const struct gpio_dt_spec p5v_fpga_pg =
75 GPIO_DT_SPEC_GET(DT_NODELABEL(p5v_fpga_pg), gpios);
76
77#if DT_NODE_EXISTS(DT_NODELABEL(p3v3_rf_pg))
78const struct gpio_dt_spec p3v3_rf_pg =
79 GPIO_DT_SPEC_GET(DT_NODELABEL(p3v3_rf_pg), gpios);
80#else
81const struct gpio_dt_spec p3v3_rf_pg = {.port = nullptr, 0, 0};
82#endif
83
84const struct gpio_dt_spec en_uhf =
85 GPIO_DT_SPEC_GET(DT_NODELABEL(en_uhf), gpios);
86const struct gpio_dt_spec uhf_pgood =
87 GPIO_DT_SPEC_GET(DT_NODELABEL(uhf_pgood), gpios);
88const struct gpio_dt_spec en_sband =
89 GPIO_DT_SPEC_GET(DT_NODELABEL(en_sband), gpios);
90const struct gpio_dt_spec sband_pgood =
91 GPIO_DT_SPEC_GET(DT_NODELABEL(sband_pgood), gpios);
92
93const struct gpio_dt_spec en_agc_uhf =
94 GPIO_DT_SPEC_GET(DT_NODELABEL(en_agc_uhf), gpios);
95const struct gpio_dt_spec flt_sel_uhf =
96 GPIO_DT_SPEC_GET(DT_NODELABEL(flt_sel_uhf), gpios);
97const struct gpio_dt_spec alert_uhf_pa_temp =
98 GPIO_DT_SPEC_GET(DT_NODELABEL(alert_uhf_pa_temp), gpios);
99
100const struct gpio_dt_spec mixer_rst =
101 GPIO_DT_SPEC_GET(DT_NODELABEL(mixer_rst), gpios);
102const struct gpio_dt_spec mixer_enx =
103 GPIO_DT_SPEC_GET(DT_NODELABEL(mixer_enx), gpios);
104const struct gpio_dt_spec mixer_scl =
105 GPIO_DT_SPEC_GET(DT_NODELABEL(mixer_scl), gpios);
106const struct gpio_dt_spec mixer_sda =
107 GPIO_DT_SPEC_GET(DT_NODELABEL(mixer_sda), gpios);
108
109const struct gpio_dt_spec en_agc_sband =
110 GPIO_DT_SPEC_GET(DT_NODELABEL(en_agc_sband), gpios);
111const struct gpio_dt_spec flt_sel_sband =
112 GPIO_DT_SPEC_GET(DT_NODELABEL(flt_sel_sband), gpios);
113const struct gpio_dt_spec alert_sband_pa_temp =
114 GPIO_DT_SPEC_GET(DT_NODELABEL(alert_sband_pa_temp), gpios);
115
116const struct gpio_dt_spec emmc_en =
117 GPIO_DT_SPEC_GET(DT_NODELABEL(emmc_en), gpios);
118const struct gpio_dt_spec emmc_sel =
119 GPIO_DT_SPEC_GET(DT_NODELABEL(emmc_sel), gpios);
120const struct gpio_dt_spec emmc_rst =
121 GPIO_DT_SPEC_GET(DT_NODELABEL(emmc_rst), gpios);
122
123static const struct adc_dt_spec adc_1_16 =
124 ADC_DT_SPEC_GET_BY_NAME(DT_PATH(zephyr_user), imon_3v3_d);
125static const struct adc_dt_spec adc_3_0 =
126 ADC_DT_SPEC_GET_BY_NAME(DT_PATH(zephyr_user), imon_5v_rf);
127static const struct adc_dt_spec adc_3_1 =
128 ADC_DT_SPEC_GET_BY_NAME(DT_PATH(zephyr_user), imon_5v_fpga);
129
130const struct device *dac1 = DEVICE_DT_GET(DT_NODELABEL(dac1));
131
132const struct gpio_dt_spec radio_trx_irq =
133 GPIO_DT_SPEC_GET(DT_NODELABEL(radio_trx_irq), gpios);
134
135static void
136radio_trx_irq_handler(struct k_work *item)
137{
139}
140struct k_work radio_trx_irq_work;
141struct gpio_callback radio_trx_irq_clbk_h;
142
143static void
144radio_trx_irq_callback(const struct device *dev, struct gpio_callback *cb,
145 uint32_t pins)
146{
147 k_work_submit(&radio_trx_irq_work);
148}
149
150/* Create a generic workqueue with lower priority than the systemworkqueue
151 */
152static struct k_work_q asynq_workq;
153K_THREAD_STACK_DEFINE(async_workq_stack, CONFIG_ASYNC_WORKQUEUE_STACK_SIZE);
154
155/* Misc IO */
156gpio_bsp l0(&led0);
157gpio_bsp l1(&led1);
158
159/* FPGA IO*/
161gpio_bsp gpio_fpga_done(&fpga_done, false);
162
163#if DT_NODE_EXISTS(DT_NODELABEL(fpga_boot_sel0)) && \
164 DT_NODE_EXISTS(DT_NODELABEL(fpga_boot_sel1))
165gpio_bsp gpio_fpga_boot_sel_1(&fpga_boot_sel1);
166gpio_bsp gpio_fpga_boot_sel_0(&fpga_boot_sel0);
167/* For now default boot mode should be QSPI */
168#else
171
172#endif
173
174/* Power IO */
176gpio_bsp gpio_p5v_rf(&p5v_rf_en);
177gpio_bsp gpio_p5v_fpga(&p5v_fpga_en);
178gpio_bsp gpio_can1_en(&can1_en);
179gpio_bsp gpio_can1_low_pwr(&can1_low_pwr);
180gpio_bsp gpio_can2_en(&can2_en);
181gpio_bsp gpio_can2_low_pwr(&can2_low_pwr);
182gpio_bsp gpio_rf_5v_pgood(&p5v_rf_pg, false);
183gpio_bsp gpio_fpga_5v_pgood(&p5v_fpga_pg, false);
184gpio_bsp gpio_en_uhf(&en_uhf);
185gpio_bsp gpio_uhf_pgood(&uhf_pgood, false);
186gpio_bsp gpio_en_sband(&en_sband);
187gpio_bsp gpio_sband_pgood(&sband_pgood, false);
188
189/* Radio IO */
190gpio_bsp gpio_en_agc_uhf(&en_agc_uhf);
191gpio_bsp gpio_flt_sel_uhf(&flt_sel_uhf);
192gpio_bsp gpio_alert_uhf_pa_temp(&alert_uhf_pa_temp, false);
193gpio_bsp gpio_en_agc_sband(&en_agc_sband);
194gpio_bsp gpio_flt_sel_sband(&flt_sel_sband);
195gpio_bsp gpio_alert_sband_pa_temp(&alert_sband_pa_temp, false);
196
198gpio_bsp radio_nrst(&radio_rst);
199gpio_bsp gpio_mixer_rst(&mixer_rst);
200gpio_bsp gpio_mixer_enx(&mixer_enx);
201gpio_bsp gpio_mixer_scl(&mixer_scl);
202gpio_bsp gpio_mixer_sda(&mixer_sda);
203gpio_bsp radio_en_ext_clk(&radio_ext_clk);
204
207
208/* EMMC IO */
209gpio_bsp gpio_emmc_en(&emmc_en);
210gpio_bsp gpio_emmc_sel(&emmc_sel);
211gpio_bsp gpio_emmc_rst(&emmc_rst);
212
214
215static adc_bsp adc_imon_3v3_d(adc_1_16);
216static adc_bsp adc_imon_5v_rf(adc_3_0);
217static adc_bsp adc_imon_5v_fpga(adc_3_1);
218
220
221scl::power::r_lim adc_rlim(CONFIG_R_LIM_3V3_D, CONFIG_R_LIM_5V_RF,
222 CONFIG_R_LIM_5V_FPGA);
223
225 .rf_5v_en = gpio_p5v_rf,
226 .fpga_5v_en = gpio_p5v_fpga,
227 .can1_en = gpio_can1_en,
228 .can1_low_pwr = gpio_can1_low_pwr,
229 .can2_en = gpio_can2_en,
230 .can2_low_pwr = gpio_can2_low_pwr,
231 .rf_5v_pgood = gpio_rf_5v_pgood,
232 .fpga_5v_pgood = gpio_fpga_5v_pgood,
233 .uhf_en = gpio_en_uhf,
234 .uhf_pgood = gpio_uhf_pgood,
235 .sband_en = gpio_en_sband,
236 .sband_pgood = gpio_sband_pgood,
237 .imon_3v3_d = adc_imon_3v3_d,
238 .imon_5v_rf = adc_imon_5v_rf,
239 .imon_fpga = adc_imon_5v_fpga,
240 .v_mon = v_bat,
241 .rlim = adc_rlim,
242 .efuse_adc_current_gain =
243 CONFIG_EFUSE_ADC_CURRENT_GAIN};
244
245/* Handle the available antenna configurations */
246static auto uhf_antenna = []() -> auto {
247/* The GPIO antenna overlay has been set */
248#if DT_NODE_HAS_PROP(DT_ALIAS(uhf_antenna), deploy_gpios)
249 /* The following objects should be declated static as they will be invalidated
250 * when they reach the end of the lamda function scope */
251 static const struct gpio_dt_spec deploy_gpio =
252 GPIO_DT_SPEC_GET(DT_ALIAS(uhf_antenna), deploy_gpios);
253 static const struct gpio_dt_spec sense_gpio =
254 GPIO_DT_SPEC_GET(DT_ALIAS(uhf_antenna), sense_gpios);
255
256 static gpio_bsp deploy0(&deploy_gpio);
257 static gpio_bsp sense0(&sense_gpio);
258
259 auto ant =
260 scl::antenna_gpio("uhf-gpio", {{.deploy = deploy0, .sense = sense0}});
261
262 return ant;
263/* The ISIS i2c antenna overlay has been set */
264#elif DT_NODE_HAS_PROP(DT_ALIAS(uhf_antenna), i2c_dev)
265 static const struct device *antenna_i2c =
266 DEVICE_DT_GET(DT_PROP(DT_ALIAS(uhf_antenna), i2c_dev));
267 static i2c_bsp antenna_i2c_bsp(antenna_i2c);
268
269/* Power control is optional */
270#if DT_NODE_HAS_PROP(DT_ALIAS(uhf_antenna), pwr_gpios)
271 static const struct gpio_dt_spec pwr_gpio =
272 GPIO_DT_SPEC_GET(DT_ALIAS(uhf_antenna), pwr_gpios);
273 static gpio_bsp pwr(&pwr_gpio);
274#else
275 static scl::bsp::dummy_gpio pwr;
276#endif
278 "uhf-isis", antenna_i2c_bsp, DT_PROP(DT_ALIAS(uhf_antenna), addr), pwr);
279/*
280 * If no antenna configuration have been set from the overlays, just create a
281 * dummy antenna definition. Any operation on this dummy object should not
282 * have any effect
283 */
284#else
285 return scl::antenna("uhf-dummy", 0);
286#endif
287}();
288
289static auto sband_antenna = []() -> auto {
290/* The GPIO antenna overlay has been set */
291#if DT_NODE_HAS_PROP(DT_ALIAS(sband_antenna), deploy_gpios)
292 /* The following objects should be declated static as they will be invalidated
293 * when they reach the end of the lamda function scope */
294 static const struct gpio_dt_spec deploy_gpio =
295 GPIO_DT_SPEC_GET(DT_ALIAS(sband_antenna), deploy_gpios);
296 static const struct gpio_dt_spec sense_gpio =
297 GPIO_DT_SPEC_GET(DT_ALIAS(sband_antenna), sense_gpios);
298
299 static gpio_bsp deploy0(&deploy_gpio);
300 static gpio_bsp sense0(&sense_gpio);
301
302 auto ant =
303 scl::antenna_gpio("sband-gpio", {{.deploy = deploy0, .sense = sense0}});
304
305 return ant;
306/* The ISIS i2c antenna overlay has been set */
307#elif DT_NODE_HAS_PROP(DT_ALIAS(sband_antenna), i2c_dev)
308// TODO
309/*
310 * If no antenna configuration have been set from the overlays, just create a
311 * dummy antenna definition. Any operation on this dummy object should not
312 * have any effect
313 */
314#else
315 return scl::antenna("sband-dummy", 0);
316#endif
317}();
318
320
322 .en_agc = gpio_en_agc_uhf,
323 /* We re-purpose the ENBL pin, which is controlled by the HW with the gain
324 selection pin */
325 .agc_vset = agc_vout_uhf,
326 .flt_sel = gpio_flt_sel_uhf};
327
328scl::rf_frontend24::io_conf rffe24_io = {.en_agc = gpio_en_agc_sband,
329 .agc_vset = agc_vout_sband,
330 .flt_sel = gpio_flt_sel_sband,
331 .mixer_clk = gpio_mixer_scl,
332 .mixer_rst = gpio_mixer_rst,
333 .mixer_enx = gpio_mixer_enx,
334 .mixer_sda = gpio_mixer_sda,
335 .chrono = chr};
336
338 .nreset = radio_nrst,
339 .en_ext_clk = radio_en_ext_clk,
340 .chrono = chr,
341 .rffe09_io = rffe09_io,
342 .rffe24_io = rffe24_io};
343
344scl::board::io_conf board_io = {.emmc_en = gpio_emmc_en,
345 .emmc_sel = gpio_emmc_sel,
346 .emmc_rst = gpio_emmc_rst,
347 .fpga_spi = fpga_spi,
348 .led0 = l0,
349 .led1 = l1,
350 .pwr_io = pwr_cnf,
351 .sensors_i2c = sensors_i2c,
352 .alert_t_pa_uhf = gpio_alert_uhf_pa_temp,
353 .alert_t_pa_sband = gpio_alert_sband_pa_temp,
354 .radio_io = radio_cnf,
355 .chrono = chr,
356 .fpga_done = gpio_fpga_done,
357 .fpga_boot_sel_1 = gpio_fpga_boot_sel_1,
358 .fpga_boot_sel_0 = gpio_fpga_boot_sel_0,
359 .uhf_antenna = uhf_antenna,
360 .sband_antenna = sband_antenna};
361
362void
364{
365 auto &log = logger::get_instance();
366 log.log("Unhandled exception");
367 try {
368 if (std::current_exception()) {
369 std::rethrow_exception(std::current_exception());
370 }
371 /* Precedence matters! */
372 } catch (const scl::exception &e) {
373 log.log(e);
374 } catch (const etl::exception &e) {
375 log.log(e);
376 } catch (const std::exception &e) {
377 log.log(e);
378 }
379
380 k_panic();
381}
382
388startup::startup() : m_wdgid(0)
389{
390 /*
391 * IMPORTANT: Before do anything enable the hardware watchdog!
392 * Ideally, it should be already enabled by the bootloader!
393 */
394 const struct device *hw_wdt_dev = DEVICE_DT_GET_OR_NULL(WDT_NODE);
395 int ret = task_wdt_init(hw_wdt_dev);
396 if (ret) {
397 auto &log = logger::get_instance();
398 log.log("Failed to initialize the Task Watchdog");
399 k_panic();
400 }
401 m_wdgid = task_wdt_add(CONFIG_WATCHDOG_PERIOD_SYS, task_wdt_callback,
402 (void *)k_current_get());
403 /*
404 * task_wdt_add() does activates the IWDG internally. The IWDG is enabled at
405 * the first call of task_wdt_feed(). So it is essential for the
406 * task_wdt_feed() to be called before any code that may hang the MCU
407 */
408 task_wdt_feed(m_wdgid);
409
410 /* Enable RTC charging and set the charging resistor to 1.5 kOhms */
411 SET_BIT(PWR->CR3, PWR_CR3_VBE);
412 SET_BIT(PWR->CR3, PWR_CR3_VBRS);
413
414 /* Register the handler for any unhandled exception */
415 std::set_terminate(unhandled_exception);
416
417 const k_work_queue_config cfg = {.name = "asynq_workq", .no_yield = 0};
418 k_work_queue_start(&asynq_workq, async_workq_stack,
419 K_THREAD_STACK_SIZEOF(async_workq_stack),
420 CONFIG_ASYNC_WORKQUEUE_PRIO, &cfg);
421}
422
427void
429{
430 /*
431 * The board initialization access the settings storage. If we want to protect
432 * this procedure for any possible exception, settings retrieval should be
433 * performed after the watchdog and logging subsystem initialization
434 */
437 board_params =
438 {
439 .radio_params =
440 {.rffe09_params =
441 {.rx_range =
444 .tx_range = {settings.get<
448 .agc0_range = {settings.get<
451 .get<settings::
452 param::UHF_AGC0_RANGE_MAX>()},
453 .gain0_range =
454 {settings
457 .get<settings::param::UHF_GAIN0_RANGE_MAX>()},
458 .agc0_calib = {settings
459 .get<settings::
460 param::UHF_AGC0_CALIB_SLOPE>(),
462 .get<
463 settings::
464 param::UHF_AGC0_CALIB_INTRCPT>()},
465 .gain0_calib =
466 {settings
469 .get<settings::param::UHF_GAIN0_CALIB_INTRCPT>()}},
470 .rffe24_params =
471 {.rx_range =
472 {settings
475 .get<settings::param::SBAND_RX_RANGE_MAX>()},
476 .tx_range =
477 {settings
480 .get<settings::param::SBAND_TX_RANGE_MAX>()},
481 .agc0_range =
482 {settings
485 .get<settings::param::SBAND_AGC0_RANGE_MAX>()},
486 .gain0_range =
487 {settings
491 .agc0_calib =
492 {settings.get<
496 .gain0_calib =
497 {settings.get<
500 SBAND_GAIN0_CALIB_INTRCPT>()}},
501 .uhf_len = {.tx = CONFIG_UHF_TX_FRAME_LEN,
502 .rx = CONFIG_UHF_RX_FRAME_LEN},
503 .sband_len = {.tx = CONFIG_SBAND_TX_FRAME_LEN,
504 .rx = CONFIG_SBAND_RX_FRAME_LEN},
505 .tx_mixer_params =
506 {{{.freq = {2270000000, 2290000000}, .lo = 182000000},
507 {.freq = {2200000000, 2270000000}, .lo = 216000000}}},
508 .rx_mixer_params =
509 {{{.freq = {2025000000, 2070000000}, .lo = 390000000},
510 {.freq = {2070000000, 2110000000}, .lo = 369000000}}},
511 .clk = settings.radio_clk_src()},
513 .rx_msgq = rx_msgq};
514
517 scl::board::init(board_io, board_params);
519}
520
527void
529{
530 auto &board = scl::board::get_instance();
532 auto &fpga = board.fpga();
533 fpga.set_boot_mode(settings.get<settings::param::FPGA_BOOT_MODE>());
534
535 auto &msg_arb = msg_arbiter::get_instance();
536 auto &io_ctrl = io::get_instance();
538 auto &log = logger::get_instance();
540 auto &thermal_mon = thermal::get_instance();
541 auto &mem_mon = memory_monitor::get_instance();
542
543 mem_mon.start();
544
545 log.boot();
546
547 fpga.enable(false);
548
549 task_wdt_feed(m_wdgid);
551
552 /* Spawn the threads */
553 msg_arb.start();
554 io_ctrl.start();
555 io_wdg.start();
556 task_wdt_feed(m_wdgid);
557 thermal_mon.start();
558
559 /* Now that the radio has been initialized activate its IRQ */
560 gpio_pin_configure_dt(&radio_trx_irq, GPIO_INPUT | radio_trx_irq.dt_flags);
561
562 gpio_init_callback(&radio_trx_irq_clbk_h, radio_trx_irq_callback,
563 BIT(radio_trx_irq.pin));
564 gpio_add_callback(radio_trx_irq.port, &radio_trx_irq_clbk_h);
565 k_work_init(&radio_trx_irq_work, radio_trx_irq_handler);
566 gpio_pin_interrupt_configure_dt(&radio_trx_irq, GPIO_INT_EDGE_TO_ACTIVE);
567
568 mission.start();
570 "All threads started succesfully!");
571}
572
581int
583{
584 return m_wdgid;
585}
586
587k_work_q *
589{
590 return &asynq_workq;
591}
592
593} // namespace satnogs::comms
IO and GS watchdog.
Definition io_wdg.hpp:42
void start()
Starts the io_wdg. This method should be called after the board initialization process (satnogs::comm...
Definition io_wdg.cpp:54
static io_wdg & get_instance()
Singleton access to the io_wdg subsystem.
Definition io_wdg.hpp:62
static io & get_instance()
Definition io.hpp:181
This class implements a simple GPIO-based antenna deployment mechanism, using for each controllable e...
This class implements the management of Antenna System2 from ISIS.
Generic antenna definition.
Definition antenna.hpp:46
IO peripherals required for the control of the various subsystems of the board.
Definition board.hpp:83
Board initialization parameters.
Definition board.hpp:114
static void init(const io_conf &io, const params &p)
Initializes the board and creates a single instance.
Definition board.cpp:36
static board & get_instance()
Gets a reference to the single instance of the Board interface class.
Definition board.cpp:66
A dummy GPIO implementation with no effect. Can be used for CI testing or default construction of gpi...
Definition gpio.hpp:119
Exception base class.
Definition exception.hpp:63
Represents the I/O configuration for the power management system.
Definition power.hpp:143
Current limit resistor configuration.
Definition power.hpp:104
IO configuration that is necessary for the radio to operate.
Definition radio.hpp:207
static const uint16_t UHF_AGC_VOUT_DAC_CH
Definition radio.hpp:133
static int trx_irq_handler()
The IRQ handler of the AT86RF215 IRQ.
Definition radio.cpp:228
static const uint16_t SBAND_AGC_VOUT_DAC_CH
Definition radio.hpp:139
IO configuration for controlling the various peripherals of the S-Band frontend.
@ UART
UART logging output.
Definition logger.hpp:78
@ RTT
Real-Time Transfer logging (Segger RTT).
Definition logger.hpp:77
static logger & get_instance()
Singleton access to the logger subsystem.
Definition logger.hpp:102
static memory_monitor & get_instance()
Mission specific generic callback service.
Definition mission.hpp:56
void start() const
This method is called at the end of the startup::start().
Definition mission.cpp:74
static mission & get_instance()
Get a singleton access to the mission subsystem.
Definition mission.hpp:91
void pre_init() const
This method is called before the satnogs::comms::lib::board::init().
Definition mission.cpp:32
void post_init() const
This method is called after the satnogs::comms::lib::board::init().
Definition mission.cpp:53
static msg_arbiter & get_instance()
Singleton access to a unique and global msg_arbiter instance.
Store and retrieve reliably persistent settings.
Definition settings.hpp:60
static settings & get_instance()
Get a singleton access to the settings subsystem.
Definition settings.hpp:210
auto get()
Get a specific core setting from RAM shadow table.
Definition settings.hpp:348
param
Specific setting identifier.
Definition settings.hpp:71
lib::radio::clk_src radio_clk_src()
Returns the current radio clock source.
Definition settings.cpp:205
void incr_boot_cnt()
Increments the current boot count and stores it at the persistent storage.
Definition settings.cpp:76
Same as the spi_bsp but with manual control of the CS line.
Definition bsp.hpp:204
struct k_work_q * workq()
Definition startup.cpp:588
void prepare()
Prepares and initializes the transceiver.
Definition startup.cpp:428
startup(startup const &)=delete
int wdg_id() const
Returns the Task Watchdog ID registered at the contructor.
Definition startup.cpp:582
void start()
Starts the execution of all the subsystems and their coressponding tasks.
Definition startup.cpp:528
static thermal & get_instance()
Definition thermal.hpp:75
const struct gpio_dt_spec en_uhf
Definition startup.cpp:84
const struct gpio_dt_spec emmc_en
Definition startup.cpp:116
const struct gpio_dt_spec radio_ext_clk
Definition startup.cpp:35
const struct device * dac1
Definition startup.cpp:130
scl::rf_frontend09::io_conf rffe09_io
Definition startup.cpp:321
const struct gpio_dt_spec p5v_fpga_en
Definition startup.cpp:59
const struct gpio_dt_spec fpga_done
Definition startup.cpp:46
dac_bsp agc_vout_sband(dac1, scl::radio::SBAND_AGC_VOUT_DAC_CH, 12)
scl::board::io_conf board_io
Definition startup.cpp:344
const struct gpio_dt_spec en_sband
Definition startup.cpp:88
const struct gpio_dt_spec p5v_fpga_pg
Definition startup.cpp:74
scl::rf_frontend24::io_conf rffe24_io
Definition startup.cpp:328
const struct gpio_dt_spec p5v_rf_en
Definition startup.cpp:57
scl::power::r_lim adc_rlim(CONFIG_R_LIM_3V3_D, CONFIG_R_LIM_5V_RF, CONFIG_R_LIM_5V_FPGA)
const struct device * sens_i2c
Definition startup.cpp:61
const struct gpio_dt_spec en_agc_sband
Definition startup.cpp:109
const struct gpio_dt_spec sband_pgood
Definition startup.cpp:90
const struct gpio_dt_spec flt_sel_sband
Definition startup.cpp:111
const struct spi_config radio_spi_cfg
Definition startup.cpp:23
scl::bsp::dummy_gpio gpio_fpga_boot_sel_1
Definition startup.cpp:169
const struct gpio_dt_spec mixer_scl
Definition startup.cpp:104
const struct gpio_dt_spec emmc_rst
Definition startup.cpp:120
chrono_bsp chr
Definition startup.cpp:213
const struct gpio_dt_spec en_agc_uhf
Definition startup.cpp:93
const struct gpio_dt_spec alert_uhf_pa_temp
Definition startup.cpp:97
spi_bsp fpga_spi(fpga_spi_dev, fpga_spi_cfg)
const struct gpio_dt_spec can1_en
Definition startup.cpp:63
scl::radio::io_conf radio_cnf
Definition startup.cpp:337
const struct device * radio_spi_dev
Definition startup.cpp:28
const struct gpio_dt_spec radio_cs
Definition startup.cpp:29
sensor_bsp v_bat(v_bat_dev)
struct k_work radio_trx_irq_work
Definition startup.cpp:140
const struct gpio_dt_spec can2_low_pwr
Definition startup.cpp:69
const struct device * fpga_spi_dev
Definition startup.cpp:44
void task_wdt_callback(int channel_id, void *user_data)
Definition callbacks.cpp:37
scl::power::io_conf pwr_cnf
Definition startup.cpp:224
const struct gpio_dt_spec radio_rst
Definition startup.cpp:32
const struct device * v_bat_dev
Definition startup.cpp:18
const struct gpio_dt_spec led1
Definition startup.cpp:21
const struct gpio_dt_spec mixer_rst
Definition startup.cpp:100
const struct gpio_dt_spec flt_sel_uhf
Definition startup.cpp:95
const struct gpio_dt_spec can2_en
Definition startup.cpp:67
struct gpio_callback radio_trx_irq_clbk_h
Definition startup.cpp:141
K_THREAD_STACK_DEFINE(radio_rx_thread_stack, CONFIG_RADIO_RX_THREAD_STACK_SIZE)
scl::bsp::dummy_gpio gpio_fpga_boot_sel_0
Definition startup.cpp:170
dac_bsp agc_vout_uhf(dac1, scl::radio::UHF_AGC_VOUT_DAC_CH, 12)
const struct gpio_dt_spec alert_sband_pa_temp
Definition startup.cpp:113
const struct gpio_dt_spec uhf_pgood
Definition startup.cpp:86
const struct gpio_dt_spec can1_low_pwr
Definition startup.cpp:65
const struct gpio_dt_spec led0
Definition startup.cpp:20
const struct gpio_dt_spec mixer_enx
Definition startup.cpp:102
const struct gpio_dt_spec radio_trx_irq
Definition startup.cpp:132
spi_manual_cs_bsp radio_spi(radio_spi_dev, radio_spi_cfg, &radio_cs)
i2c_bsp sensors_i2c(sens_i2c)
const struct gpio_dt_spec mixer_sda
Definition startup.cpp:106
const struct gpio_dt_spec p3v3_rf_pg
Definition startup.cpp:81
const struct gpio_dt_spec emmc_sel
Definition startup.cpp:118
const struct spi_config fpga_spi_cfg
Definition startup.cpp:38
void unhandled_exception()
Definition startup.cpp:363
const struct gpio_dt_spec p5v_rf_pg
Definition startup.cpp:72