This programming example puts the SYSMON into its default sequence mode, enables alarms, configures the sequencer channels, and selects the continuous loop sequence mode. This routine can be used for both SYSMON units. Ensure access to the register sets before attempting to access them (see Register Access via APB Slave Interface).
1.Put the SYSMON unit into its default sequence mode and enable the alarms. Write 0000h to the CONFIG_REG{1, 3} registers.
2.PS SYSMON unit only. If the PS SYSMON unit is held in reset, then deassert reset. This causes the unit to operate in its default sequence mode and allows the software to configure the sequence registers. The PS SYSMON unit reset is controlled by AMS.PS_SYSMON_CONTROL_STATUS [reset_user]. After reset is deasserted, wait until the AMS_CTRL.PS_SYSMON_CONTROL_STATUS [startup_done] bit is set. Software might begin the startup state machine again by writing a 1 to the self clearing [startup_trigger] bit and wait again for the [startup_done] bit.
3.Select the desired full-rate sensor channels. Write to the SEQ_CHANNEL registers.
4.If the low-rate sensor channels are to be included, write to the CONFIG_REG4 [sequence_rate] and [low_rate_eos] bit fields to define the rates and select the low-rate channels using the SEQ_LOW_RATE_CHANNEL registers. Do not select channels already selected in the SEQ_CHANNEL registers.
5.PL SYSMON unit only. If the external sensor channels are used (VP_VN, VAUX), select the desired sampling circuit and acquisition length for each of these channels. Write to the appropriate SEQ_INPUT_MODE{0, 1} and SEQ_ACQ{0, 1} registers.
6.If desired, set the alarm thresholds by writing to the ALARM_*_UPPER and ALARM_*_LOWER registers. The thresholds are described in Sensor Alarm Types. The programming is done using the transfer functions described in the UltraScale Architecture System Monitor User Guide (UG580) [Ref 6].
7.If average measurements are desired, select the channels in the SEQ_AVERAGE registers and set the desired averaging count in the CONFIG_REG0 [averaging] bit field.
8.Change the sequence mode from default mode to continuous loop mode and keep the alarms enabled. Write 2000h to the CONFIG_REG1 register.
Read the measurement registers for the monitored channels. If averaging is enabled, a value does not appear in the measurement register until the SYSMON unit has looped through the channel sequencer the number of times in the averaging count value. The EOS event indicates when the measurement registers have valid data.