Re: PRU Timing in C

30 views
Skip to first unread message

Jason Kridner

unread,
May 12, 2017, 5:06:07 PM5/12/17
to M Pitman, beagl...@googlegroups.com, Jason Kridner


On May 12, 2017, at 4:38 PM, M Pitman <mpitm...@gmail.com> wrote:

I've encountered a big issue trying to provide accurate timing of pulses sent from pru0.  I'm toggling one pin and trying to set another pin low for just a single low cycle of the first pin.  This worked fine in assembler language but in C the timing of the second pin based on the first pin being low is not consistent.  It gets delayed somehow and so sometimes goes low when the first pin is high but at other times when the first pin is low.  Is this possibly an overhead problem with the C compiler and thus cannot be trusted for accurate timing?

The way to see what is going on is to leave the assembly around. 


Look for the c_src_interlist option. 

  If so, is there a way to leave this section in assembler but still easily receive analog data from the Beaglebone and communicate with the ARM?

Yes, you can use either inline assembly or follow C calling conventions in your assembly source and call the assembly function from C. 


Thanks,

Mike Pitman

M Pitman

unread,
May 12, 2017, 9:47:47 PM5/12/17
to beagl...@googlegroups.com, Jason Kridner
I've encountered a big issue trying to provide accurate timing of pulses sent from pru0.  I'm toggling one pin and trying to set another pin low for just a single low cycle of the first pin.  This worked fine in assembler language but in C the timing of the second pin based on the first pin being low is not consistent.  It gets delayed somehow and so sometimes goes low when the first pin is high but at other times when the first pin is low.  Is this possibly an overhead problem with the C compiler and thus cannot be trusted for accurate timing?  If so, is there a way to leave this section in assembler but still easily receive analog data from the Beaglebone and communicate with the ARM?

Thanks,

Mike Pitman

Mark Lazarewicz

unread,
May 13, 2017, 2:09:01 PM5/13/17
to beagl...@googlegroups.com
6.6 Interfacing C and C++ With Assembly Language 



From: M Pitman <mpitm...@gmail.com>
To: beagl...@googlegroups.com; Jason Kridner <jkri...@beagleboard.org>
Sent: Friday, May 12, 2017 8:55 PM
Subject: [beagleboard] PRU Timing in C

I've encountered a big issue trying to provide accurate timing of pulses sent from pru0.  I'm toggling one pin and trying to set another pin low for just a single low cycle of the first pin.  This worked fine in assembler language but in C the timing of the second pin based on the first pin being low is not consistent.  It gets delayed somehow and so sometimes goes low when the first pin is high but at other times when the first pin is low.  Is this possibly an overhead problem with the C compiler and thus cannot be trusted for accurate timing?  If so, is there a way to leave this section in assembler but still easily receive analog data from the Beaglebone and communicate with the ARM?

Thanks,

Mike Pitman
--
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 beagleboard...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beagleboard/CAJ2u6KO%3DecqC5E_7Apm2JjgpXVcMPwWGTOAb2haOaCwjSkKD0A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Reply all
Reply to author
Forward
0 new messages