The following programming example assumes that the
PRU is configured for Sigma Delta Mode
(PRU_ICSS_GPCFG0[29-26]
PR1_PRU<n>_GP_MUX_SEL = 3h).
- Configure clock sources, accumulator source, and sample size:
- PRU_ICSS_PRU0_SD_CLK_SELi[1-0] PRU0_SD_CLK_SELi
(where n = 0 or 1, i = 0 to 8) for clock
source
- PRU_ICSS_PRU0_SD_CLK_SELi[2] PRU0_SD_CLK_INVi
(where n = 0 or 1, i = 0 to 8) for clock
polarity
- PRU_ICSS_PRU0_SD_CLK_SELi[5-4] PRU0_SD_ACC_SELi
(where n = 0 or 1, i = 0 to 8) - for accumulator
source (acc1/acc2/acc3)
- PRU_ICSS_PRUSS_SD_PRU0_SAMPLE_SIZEi[7-0]
PRU0_SD_SAMPLE_SIZE for sample size
- Reinitialize all channels whose sample size was configured
- Select channel by writing to channel_select (r30[29-26])
- Delay at least 1 PRU cycle before executing re_int in step 2c.
- Reinitialize selected channel by writing to re_init (r31[23])
- Repeat steps 2a & 2b for all configured channels
- Enable all channels by writing ‘1’ to channel_en (r30[25])
- Select channel by writing to channel_select (r30[29-26])
- Poll shadow_update_flag (r31[28]) to detect when acc1/acc2/acc3 shadow register copy data is ready to be read
- Delay at least 1 PRU cycle before polling shadow_update_flag in Step 4c.
- Read data_out[27-0] (r31[27-0])
- Clear shadow_update_flag by writing ‘1’ to r31[24]
- Repeat step 4 for new channel