When to use:
RCON output (or a specific <CAUSE>_count) to telemetry on every bootWDTO reset actually occurredWhen NOT to use:
RCON register; it is inert on SAM/ARM and PIC32MK/MX/MZ (warns, outputs hold 0)RCON is snapshotted and cleared once at boot; it is not re-read every step

33CK256MP508At firmware init the block reads RCON once into a volatile global and clears RCON (so the next reset starts from a clean slate). A true power-on is detected via a magic word in persistent RAM (independent of RCON.POR), which is more reliable than RCON.POR across the various brown-out / VREG cold-start signatures. On the first power-up (magic word absent) the counters are initialized to zero and the current boot is not counted; on a warm reset (magic word present, RAM survived) the persistent counter for each cause bit that was set is incremented. So the counters report resets since power-up, not the power-up itself.
The block is chip-aware: it reads the actual RCON bitfields from the chip database, so only the reset-cause checkboxes that physically exist on the selected device are shown. The Behavior field (Status tab) summarizes the available cause bits, the RCON width, and the relevant datasheet section for the detected family.
One block per model. Because there is a single
RCONand one set of persistent counters, only one Reset_Status block is allowed; a second instance raises a build error.
The block produces three kinds of output, all derived from the single boot-time RCON snapshot:
RCON โ the raw register value before it is cleared. Multiple bits can be set at once (e.g. POR + BOR on a cold power-up), so this is a bitmask, not a single cause.<CAUSE>_count โ a persistent counter incremented on a warm reset whenever that specific RCON bit was set. Enabled per checkbox. Survives WDT / software / external resets; zeroed (and not counted) on a true power-on / RAM-losing reset.ResetEvents โ a persistent counter incremented once per warm reset event when any true reset-cause bit is set. It is not the arithmetic sum of the per-cause counters: if POR and BOR co-assert on a warm reset, POR_count and BOR_count each increment, but ResetEvents increments only once.Reset causes (counted by ResetEvents): POR, BOR, WDTO, SWR, EXTR, CM, IOPUWR, TRAPR.
Wake / status flags (diagnostic counters only, never counted by ResetEvents): IDLE, SLEEP, VREGS, VREGSF. These represent low-power wake or regulator status, not an actual device reset.
What happens at boot for a few common RCON snapshots on a classic dsPIC (counters assumed enabled). Note the first cold power-up is not counted (RAM not yet initialized); all rows except the first therefore describe a warm reset whose persistent RAM survived:
| Scenario | RCON bits set at boot | Per-cause counters incremented | ResetEvents |
|---|---|---|---|
| First cold power-up (RAM uninit) | POR + BOR | none (counters zeroed) | +0 |
| Watchdog timeout (warm) | WDTO | WDTO_count | +1 |
Software reset (asm RESET, warm) | SWR | SWR_count | +1 |
| MCLR pin reset (warm) | EXTR | EXTR_count | +1 |
| Trap-conflict reset (warm) | TRAPR | TRAPR_count | +1 |
| Wake from sleep (no reset) | SLEEP only | SLEEP_count | +0 |
| Wake from idle (no reset) | IDLE only | IDLE_count | +0 |
The first power-up boot is not counted. On the very first boot of a freshly programmed device (or after any reset that loses RAM, e.g. a true power-loss POR), the magic word in persistent RAM is uninitialized, so all counters are initialized to zero and the current boot is not counted. Counting begins on the next (warm) reset, whose persistent RAM survived. A cold power-up therefore lands at
POR_count = 0,BOR_count = 0,ResetEvents = 0; a subsequent watchdog reset then makesWDTO_count = 1,ResetEvents = 1. This is by design โ the counters report resets since the device first powered up, not the power-up itself.
| Port | Direction | Type | Description |
|---|---|---|---|
RCON | Output (optional) | uint16 (classic dsPIC) / uint32 (dsPIC33A) | Raw RCON snapshot taken at boot, before it is cleared. Enabled by Output RCON snapshot (on by default). |
ResetEvents | Output (optional) | uint16 / uint32 | One count per warm reset event when any true reset-cause bit is set (not the sum of per-cause counters; the first power-up is not counted). Enabled by Output ResetEvents. |
<CAUSE>_count | Output (optional) | uint16 / uint32 | Persistent counter for one reset cause (e.g. WDTO_count). One port per enabled checkbox. |
Port order is RCON (if enabled) first, then ResetEvents, then the per-cause counters. All counter outputs are persistent โ they survive non-POR resets and zero on power-on. If RCON, ResetEvents and every per-cause counter are all unchecked, the block has zero output ports and generates no code.
| Parameter | Variable | Options | Description |
|---|---|---|---|
| Output RCON snapshot | ProvideRCON | off / on | Adds the RCON output port carrying the register snapshot taken at boot (before RCON is cleared). On by default. Uncheck to remove the RCON output; if it and every counter are unchecked the block has no outputs and generates no code. |
| Counter port type | CounterWidth | uint16, uint32 | Width of ResetEvents and per-cause counters. uint16 saves RAM (max 65,535/cause); uint32 for higher counts. |
| Output ResetEvents | ProvideTotalCount | off / on | Adds the ResetEvents event-counter port. On a warm reset it increments once when any true reset-cause bit is set (POR, BOR, WDTO, SWR, EXTR, CM, IOPUWR, TRAPR); the first power-up is not counted. Wake/status bits (IDLE, SLEEP, VREGS, VREGSF) remain available as individual counters but are not included in ResetEvents. |
| Output POR_count | Provide_POR_count | off / on | Power-on resets counted after the first power-up (the first power-up zeroes the counters and is not itself counted; a later POR that loses RAM is likewise not counted). |
| Output BOR_count | Provide_BOR_count | off / on | Brown-out resets (warm). Co-asserts with POR; the first power-up is not counted. |
| Output IDLE_count | Provide_IDLE_count | off / on | Wake-from-idle events seen at boot. |
| Output SLEEP_count | Provide_SLEEP_count | off / on | Wake-from-sleep events seen at boot. |
| Output WDTO_count | Provide_WDTO_count | off / on | Watchdog-timeout resets since last POR. |
| Output SWR_count | Provide_SWR_count | off / on | Software resets (asm RESET) since last POR. |
| Output EXTR_count | Provide_EXTR_count | off / on | MCLR (external pin) resets since last POR. |
| Output VREGS_count | Provide_VREGS_count | off / on | Voltage-regulator standby at sleep entry. |
| Output CM_count | Provide_CM_count | off / on | Configuration-mismatch resets. |
| Output VREGSF_count | Provide_VREGSF_count | off / on | Sleep-wake VREG fault. |
| Output IOPUWR_count | Provide_IOPUWR_count | off / on | Illegal-opcode / uninitialized-W reset. |
| Output TRAPR_count | Provide_TRAPR_count | off / on | Trap-conflict reset. |
Checkboxes for cause bits the selected chip does not have are hidden automatically (driven by the chip database, not a hardcoded list) โ so a tooltip only ever appears for a cause the targeted device actually supports. See Reset-cause availability by family below for which causes each family exposes.
| Parameter | Variable | Description |
|---|---|---|
| Behavior | BehaviorInfo_TXT | Read-only. RCON width, the cause bits present on this chip, the persistence rule, and the datasheet reference for the detected family. |
| Sample time | SampleTime | Default inf (constant โ values are latched at boot / updated only by reset events). Use a discrete rate only if a downstream block must inherit one. |
The set of RCON cause bits differs per family; the block shows only what exists:
| Cause | 30F | 33F | 33E/EP | 33EV | 33C | 33A |
|---|---|---|---|---|---|---|
| POR, BOR, IDLE, SLEEP, WDTO, SWR, EXTR | โ | โ | โ | โ | โ | โ |
| CM | โ | โ | โ | โ | โ | โ |
| VREGS | โ | โ | โ | โ | โ | โ |
| IOPUWR | โ | โ | โ | โ | โ | โ |
| TRAPR | โ | โ | โ | โ | โ | โ |
| VREGSF | โ | โ | โ | โ | โ | โ |
(Exact set is resolved at compile time from the chip database โ the table above is indicative.)
RCON into a volatile global, runs the magic-word POR check, then clears RCON. Counter increments run only on a warm reset (the else branch of the magic-word check) so the first power-up is never counted.__attribute__((persistent)) globals (one per enabled cause + optional total) survive WDT/SW/EXT resets; on a true cold start (RAM lost) the magic word mismatches and they are zeroed without counting.RCON, ResetEvents and every per-cause counter are unchecked, the block emits no globals, no Start code and no output ports (it does nothing).RCON output is enabled it holds 0, the model still compiles.RCON port and counters are typed uint16 (classic) / uint32 (33A) consistently in both simulation and generated code.mdl = 'my_model';
add_block('MCHP_Blockset/System Configuration/Microchip Master', [mdl '/Master']);
add_block('MCHP_Blockset/System Functions/Reset_Status', [mdl '/BootCause']);
% Expose the watchdog-reset tally and the raw RCON word.
set_param([mdl '/BootCause'], 'Provide_WDTO_count', 'on');
set_param([mdl '/BootCause'], 'CounterWidth', 'uint16');
% Route RCON / WDTO_count to a UART Tx block for telemetry on boot.
% Watchdog resets the MCU on a missed deadline ...
add_block('MCHP_Blockset/System Functions/Watchdog_DMT', [mdl '/WDT']);
set_param([mdl '/WDT'], 'Mechanism', 'Standard WDT', 'TimeoutChoice', '1 (s)');
% ... and Reset_Status confirms a WDTO reset actually happened, with a count.
add_block('MCHP_Blockset/System Functions/Reset_Status', [mdl '/BootCause']);
set_param([mdl '/BootCause'], 'Provide_WDTO_count', 'on');
| Family | Support | RCON width | Notes |
|---|---|---|---|
| dsPIC30F | โ | 16-bit | No VREGS / CM / VREGSF bits |
| dsPIC33F | โ | 16-bit | No VREGSF |
| dsPIC33E / EP / EV | โ | 16-bit | EP/EV add VREGSF |
| dsPIC33C / CK / CH / CDV | โ | 16-bit | Full classic cause set |
| dsPIC33A / AK | โ | 32-bit | No IOPUWR / TRAPR / VREGS; status bits VREG*R/BUCKR are not counted |
| SAM / PIC32MK / MX / MZ | โ | โ | Block inert (no RCON) |
WDTO reset this block can confirm and countRCON definition from the database it populates