rcbench
Servo and ESC test bench: panel, IOmcu and shared C
Loading...
Searching...
No Matches
iomcu_report.c File Reference

The console report every 3s: the flash store, the running slot and why this start happened, the CAN bus and the current monitors as the pages show them. More...

#include <stdio.h>
#include <string.h>
#include "pico.h"
#include "boot/bootrom_constants.h"
#include "hardware/structs/powman.h"
#include "hardware/structs/watchdog.h"
#include "pico/bootrom.h"
#include "iomcu.h"
#include "reset_cause.h"
#include "sense_limit.h"
#include "sense_map.h"
#include "update_hw.h"
#include "xl2515.h"
#include "console_hw.h"

Macros

#define IOMCU_SAY   console_hw_say
 This file's report lines.

Functions

void reset_start (void)
 Reads why this start happened, once at boot, and prints it.
static void sense_report (void)
 The current monitors as the pages show them, with can_report() every 3s, while either part is enabled: what a bench session reads before the panel has a screen for them.
void can_report (uint32_t now)
 Prints the console report when 3s have passed.

Variables

static reset_regs_t s_reset
 The registers as reset_start() read them.

Detailed Description

The console report every 3s: the flash store, the running slot and why this start happened, the CAN bus and the current monitors as the pages show them.

See iomcu.h.

SPDX-License-Identifier: MIT

Macro Definition Documentation

◆ IOMCU_SAY

#define IOMCU_SAY   console_hw_say

This file's report lines.

The bench console build sends them through the console's output: none lands inside a console line that leaves in pieces, and none waits for the host. Every other build prints them, and printf() waits for the host for up to 500 ms (PICO_STDIO_USB_STDOUT_TIMEOUT_US).

Function Documentation

◆ can_report()

void can_report ( uint32_t now)

Prints the console report when 3s have passed.

Parameters
nowThe pass's clock in ms.

◆ reset_start()

void reset_start ( void )

Reads why this start happened, once at boot, and prints it.

Reads POWMAN CHIP_RESET, WATCHDOG REASON, SCRATCH2 and SCRATCH3 and the boot ROM's boot info, then zeroes SCRATCH2 and SCRATCH3 (reset_cause.h). The SDK's start-up code writes none of them. can_report() repeats the line every 3s.

◆ sense_report()

void sense_report ( void )
static

The current monitors as the pages show them, with can_report() every 3s, while either part is enabled: what a bench session reads before the panel has a screen for them.

The registers as published, in their own units: FLAGS, PRESENT and the IDs in hex, the reset counts of the INA228 and the INA3221, BENCH's 10mV and 10mA, CH1's mA and mV, times in 0.1ms; and the INA3221 map with each channel's mA.