Oh sorry, I didn't see your PS ;) In case that one PRU reads from the scratchpad and in the same cycle the other PRU writes to it, I am pretty sure that there will be no conflicts. It is the standard behaviour when you program sequential logic with a hardware description language. However, the read operation will yield the "old" data from the scratchpad, that is the ones from before the write operation.
But as you have lots of time to waste on one PRU, it might be a better idea to use direct PRU transfer (XIN/XOUT with device 14), without the scratchpad in between. Lets say your PRU0 (the time-critical one) executes N instructions per loop. Then just let PRU1 make an update of the important registers every M cycles (with M<N) so that data for PRU0 will always be fresh and PRU0 will never have to wait for PRU1. The advantage is that your PWM will run perfectly deterministic, that is there will never be any irregularities in the output signal due to the interrupt. The data will be updated every PWM cycle, and all this only costs you one instruction per PWM loop cycle. On Sunday, August 2, 2015 at 4:39:21 PM UTC+2, Lenny wrote: > > Hi Carlos, > > have you looked at the PruReferenceGuide section 5.2.4.2 (p.34-35)? Let me > copy paste here: > > > A collision occurs when two XOUT commands simultaneously access the same > asset or device ID. > Table 20 shows the priority assigned to each operation when a collision > occurs. In direct connect mode > (device ID 14), any PRU transaction will be terminated if the stall is > greater than 1024 cycles. This will > generate the event pr<1/0>_xfr_timeout that is connected to INTC. > > Table 20. Scratch Pad XFR Collision Conditions > > Operation Collision Handling > PRU<n> XOUT (→) bank[j] > If both PRU cores access the same bank simultaneously, PRU0 > is given priority. PRU1 will temporarily stall until the PRU0 > operation completes. > > PRU<n> XOUT (→) PRU<m> If PRU<n> > executes XOUT before PRU<m> executes XIN, then > PRU<n> will stall until either PRU<m> executes XIN or the stall > is greater than 1024 cycles. > > PRU<n> XIN (←) PRU<m> If PRU<n> executes XIN before PRU<m> executes XOUT, > then > PRU<n> will stall until either PRU<m> executes XIN or the stall > is greater than 1024 cycles. > > > I used the direct XOUT / XIN with device ID=14 to synchronize the two > PRU's. There were no unexpected problems, everything like described in the > manual. > > Let me know if this wasnt your problem. Bests, Lenny > > > -- For more options, visit http://beagleboard.org/discuss --- You received this message because you are subscribed to the Google Groups "BeagleBoard" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
