There are 4 tasks of the PRU firmware
for the device 2 and the task manager configuration is similar to those of device
1:
- Task 0 is hit by the capture 6
event of IEP to latch the SYNC0 pulse from controller. Also compensate the
incremental value of IEP to synchronize the timing with the controller. The
compensation value is calculated using the following formula:
Compensation value = CAP6 – CMP1 –
hardware delay
Compensation is applied based on the
calculated value. If the compensation value is positive, then set CMP_INC bit field
= 0x3 in the IEP_GLOBAL_CFG_REG register (0x3002E000). Write the COMPEN_CNT bit
field = calculated compensation value in the IEP_COMPEN_REG register (0x3002E008).
As a result, the IEP counter can be incremented by 3 for the number of times
specified by the calculated compensation value. If the compensation value is
negative, then set CMP_INC bit field = 0x5. Write the COMPEN_CNT bit field =
absolute of the compensation value in IEP_COMPEN_REG register (0x3002E008). In this
case, the IEP counter can be incremented by 5 for the number of times specified by
the calculated compensation value.
- Task 1 is hit by the compare 0
event of IEP to generate the SYNC0 pulse to compare the output SYNC0 pulse of
the device with the SYNC0 pulse from the controller, also the compare 0 event is
used to reset the IEP timer. The SYNC0 activation time is triggered by IEP
compare 1 event. The SYNC0 pulse generation mode is set to single-shot mode and
pulse width set to 50ns via IEP_SYNC_CTRL_REG and IEP_SYNC_PWIDTH_REG
respectively. During the task 0, the SYNC0 pulse is disabled then enabled by
IEP_SYNC_CTRL_REG [0].
- Task 2 is hit by the compare 2
event of IEP for pre-scheduled. Assuming that the position sense can start from
this time slot.
- Task 3 is hit by the compare 3
event of IEP to start transmitting position data via FSI interface. During the
task, PRU firmware can set the FSI TX buffer, move the position data from TCM to
the FSI TX buffer via the PRU XFR2VBUS hardware accelerator and start the FSI
transmitting.