SPRUIM2H May 2020 – October 2023 AM2431 , AM2432 , AM2434 , AM6411 , AM6412 , AM6421 , AM6422 , AM6441 , AM6442
Figure 6-193 shows a block diagram of the Sigma Delta hardware integrators and integration with the PRU R30 / R31 interface for a single channel.
The three accumulators (acc1-acc3) for each channel are simple 28 bit adders. The input for acc1 is 1-bit, while the inputs for acc2 and acc3 are 28-bits. On each positive edge of the CLK_OUT, all three 28-bit counters (acc1-acc3) and the sample counter for each channel will get updated as follows:
acc1 = acc1 + data_in
acc2 = acc2 + acc1
acc3 = acc3 + acc2
sample_count = sample_count + 1
Each accumulator will rollover at 0xFF_FFFF. For example if acc2 = 0x10 and acc3 = 0xFF_FFFF, then acc3 will update to 0x00_0000F on the next clock event. Sample counter will rollover when it equals the defined sample size (ICSSG_PRU0_SD_SAMPLE_SIZE_REGi[7-0] PRU0_SD_SAMPLE_SIZEi).
Note that while the channels are not enabled, no operations are performed and all flags and counters are cleared. If a new sample size is to be loaded, the PRU firmware should assert re_init (r31[23]), and all stored count values are cleared to 0.
Fast detect block is used to detect fast changes in the amount of ones, presented in a programmable sliding window of 4 to 32 bits. The sliding window is controlled by ICSSG_PRU0_SD_SAMPLE_SIZE_REGi[10-8] PRU0_FD_WINDOW_SIZE_i bit field.
Fast detect must be enabled through the ICSSG_PRU0_SD_SAMPLE_SIZE_REGi[23] PRU0_FD_EN_i register before SD is enabled. It will start the compare after the first 32 sample clocks. Fast detect block will remain active until a re_init (r31[23]) is asserted.
The Sigma Delta interface has two status flags:
When sample_counter equals the defined sample size (ICSSG_PRU0_SD_SAMPLE_SIZE_REGi[7-0] PRU0_SD_SAMPLE_SIZEi), then the acc1/acc2/acc3 shadow register copy will be updated, the shadow_update_flag (r31[28]) will be set, and sample_counter will rollover to 0. The PRU firmware can clear this flag by writing ‘1’ to shadow_update_flag_clr (r31[28]). If sample_count equals the defined sample size and the shadow_update_flag is still set, then shadow_update_flag_ovf (r31[29]) will be set. Similarly, the PRU firmware can clear this flag by writing ‘1’ to shadow_update_flag_ovf_clr (r31[29]). Note that the clear operation for both flags has a higher priority than the set event.
The PRU firmware can monitor the acc2/acc3 and sample_counter values through data_out[27-0] (r31[27-0]). Table 6-421 shows the configuration options for data_out[27-0].
snoop (r30[22]) | sample_counter_select (r30[21]) | data_out (r31[27-0]) |
---|---|---|
0 | 0 | Reads acc1/acc2/acc3 shadow register copy. See Figure 6-193 Sigma Delta Hardware Integrators Block Diagram (snoop = 0). |
1 | 0 | Reads acc1/acc2/acc3 directly. See Figure 6-194 Sigma Delta Hardware Integrators Block Diagram (snoop = 1). |
0 | 1 | Reads sample_counter shadow register copy. See Figure 6-193 Sigma Delta Hardware Integrators Block Diagram (snoop = 0). |
1 | 1 | Reads sample_counter directly. See Figure 6-194 Sigma Delta Hardware Integrators Block Diagram (snoop = 1). |