Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
10/10/09 16:06
Read: times


 
#169622 - Some suggestions for low-jitter processor activation
Responding to: ???'s previous message
Sorry for a most probably totally off-topic post in regards to the OP:s request, but this is a short description of some methods to get multiple processors to synchronize to serial data in an easy way and without expensive hardware.

When the timing requirements are low, it will be enough to just let the ISR put received characters into a receive buffer and when the main loop detects a suitable character, it starts performing the trigged action. Depending on the iteration speed of the main loop, this may give ms-scale jitter.

For better results, the UART ISR can be extended to contain the code to detect the trigger character and perform the required action. This will reduce the jitter to basically depend on the baudrate generator speed. If the UART runs the bit sampling at 16x the baudrate, the chip would sample the start bit at 16*9600 Hz or every 6.5us. If we assume two sample periods for jitter that would mean 13us jitter plus jitter from entering the ISR (nesting problems, instruction timing, interrupts disabled, ...). Having chips with +/- 1% RC oscillators and an ISR that takes 100us until a result is produced, the oscillator would add 2us extra. Stepping up from 9600 baud to 115200 baud, the 2 bit sampling periods would shrink from 13 to 1.1us.

If there is a need to reduce the jitter from the processor being busy with other interrupts or in a critical section with interrupts disabled, the serial activation can be updated to a two-step operation. The first serial character sent out is used as a "PREPARE" to warn the chip that a time-critical activation is getting near. The chip can then deactivate other interrupts and start a single timer of a couple of character intervals as a timeout. It then either enters a busy loop or - if possible - performs some form of 'halt' or similar where the processor core is stopped until the next interrupt arrives. If the next interrupt is the timer, then there was a problem and the processor can recover gracefully from the timeout. If the next interrupt is the UART receive detecting a "GO" character, then the UART ISR will only be affected by the varying latency depending on what instruction it was currently processing in the loop, so the jitter entering the ISR would be down to machine cycles.

Obviously, when getting the ISR activation jitter down to machine cycles, the two big error sources would be an RC oscillator, and the frequency of the baudrate generator. Using a cheap 100ppm crystal would reduce jitter from a 100us computation into +/- 10ns instead of +/- 1us.

The easist way to reduce the baudrate-induced jitter is to send the "READY" character as standard serial data, but then rely on a handshake signal to produce some form of pin-change interrupt for the "GO" signal. With this change, the input trigger would no longer be sampled at the baudrate generator speed but often the main oscillator speed or sometimes scaled by a PLL for even higher sampling rates. And since the "GO" signal is now just a toggled digital signal, it works just as well to get a single processor to start an action with quite low jitter.

So in the end, a trivially cheap microcontroller with a trivially cheap RC oscillator can manage us-level jitter while being self-synchronizing. And having a low-quality crystal, it is possible to drop the jitter to a couple of machine cycles, as long as the evaluation in the ISR doesn't performs conditional jumps depending on received command data or state of input pins. For the least jitter, computations should make use of lookup tables or the computations should be written in constant path-length form. More advanced processors should have code and data caches disabled, to remove variance introduced by earlier code execution.

When the requirements are to manage jitter less than a couple of machine cycles, then the logic solution is to avoid using a processor or to (depending on iteration speed of commands/control loop) introduce hardware buffering to dejitter computed results. One issue here is of course that at ns/GHz standard silicon gets into troubles with bandwidth/rise times. Especially if the external signals can't be run at very low voltages. But anyone requiring concurrency in these time ranges would not ask questions on this forum about how a PC could communicate serially with two 8051 chips.

List of 71 messages in thread
TopicAuthorDate
Communication between two 8051            01/01/70 00:00      
   I'm going to recommend            01/01/70 00:00      
      I'm going to recommend            01/01/70 00:00      
   I'd recommend ...            01/01/70 00:00      
      irrelevant, however            01/01/70 00:00      
      chip            01/01/70 00:00      
         multiple chips ....            01/01/70 00:00      
            Perhaps you don't need two UARTs            01/01/70 00:00      
   Side note, multiple COM ports            01/01/70 00:00      
      FTDI Multi-UART to USB            01/01/70 00:00      
   Clarify?            01/01/70 00:00      
   Parallel 8051 TXs and RXs            01/01/70 00:00      
      Two transmitters            01/01/70 00:00      
         Which lesson to give?            01/01/70 00:00      
            and ..            01/01/70 00:00      
            Like good little children            01/01/70 00:00      
            Jimmy Neutron/Phineas & Ferb            01/01/70 00:00      
            Tony Gelonese's method should work...            01/01/70 00:00      
               no, and yes            01/01/70 00:00      
         some more thought...Per Westermark            01/01/70 00:00      
            It is all in the subpressed details            01/01/70 00:00      
               SIlabs chips would burn            01/01/70 00:00      
      No, That won't "just work"            01/01/70 00:00      
         I think there's more to this than meets the eye            01/01/70 00:00      
            Not always interrupt response instantly            01/01/70 00:00      
               Since the O/P hasn't been back ...            01/01/70 00:00      
                  serial communication            01/01/70 00:00      
                     you are aware?            01/01/70 00:00      
                        You are also aware?            01/01/70 00:00      
                     Synchronize transfers            01/01/70 00:00      
                        Connecting two TX outputs            01/01/70 00:00      
                     Unnecessary complication!            01/01/70 00:00      
                        Different name            01/01/70 00:00      
                        Walter and Walter            01/01/70 00:00      
                           Name            01/01/70 00:00      
                              what are you ashamed/afraid/... of            01/01/70 00:00      
                              Walter, Please eschew obfuscation and equivocation            01/01/70 00:00      
                     That Phytec Board has RS485 and I2C and SPI            01/01/70 00:00      
                        summarizing            01/01/70 00:00      
                           to a nail everything looks like a hammer            01/01/70 00:00      
                        actually ... he hasn't said he needs that ...            01/01/70 00:00      
                           Often important information arrives quite late            01/01/70 00:00      
                           Actually, he did!            01/01/70 00:00      
                              It's not complete            01/01/70 00:00      
                                 he's so stingy with information            01/01/70 00:00      
   Some more Thought....            01/01/70 00:00      
      This assumes perfect synchronization            01/01/70 00:00      
      the longest reply ever            01/01/70 00:00      
         Schematic is Incomplete            01/01/70 00:00      
      Missing boundary limits            01/01/70 00:00      
         Use p3.0 and p3.1            01/01/70 00:00      
            huh?            01/01/70 00:00      
            You need to clarify your requirement!            01/01/70 00:00      
            This contradicts an earlier post from you            01/01/70 00:00      
               agree with most, but???            01/01/70 00:00      
                  clock-for-clock send            01/01/70 00:00      
                     Still not clear!            01/01/70 00:00      
                        I think you lost the thread            01/01/70 00:00      
                           If they're to remain in precise synchronization ...            01/01/70 00:00      
                              Ridiculous            01/01/70 00:00      
                                 Come on, Walter!            01/01/70 00:00      
                                 It's routinely done ...            01/01/70 00:00      
                                    Don't relive your past again and again            01/01/70 00:00      
                                       MCU is a component, not a computer system.            01/01/70 00:00      
                                          Tell me more about femtosecond precision            01/01/70 00:00      
                                             not even then            01/01/70 00:00      
                                                Watch out            01/01/70 00:00      
                                                   Some suggestions for low-jitter processor activation            01/01/70 00:00      
                                                That's exactly what it is            01/01/70 00:00      
                  The two slaves must be in the same state            01/01/70 00:00      
            Is this yet another problem?            01/01/70 00:00      

Back to Subject List