+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 20 of 24

Thread: Fastest that you would or could toggle an IO pin?

  1. #1

    WBA Consulting's Avatar
    Location
    4.3 Light Years from Rigil Kentaurus
    Posts
    2,135
    Blog Entries
    26

    Cool Fastest that you would or could toggle an IO pin?

    I am getting mixed answers in my searching so I figured I would ask my question directly. Irregardless of what the propeller can do as far as speed of toggling a pin, in most uses of a propeller, what is the fastest you would toggle an IO pin? For example, I know my Honda is spec'd to do 110mph, but I never need to go over 75.

    I also need to answer the same question for a BASIC Stamp because my project ties into both.

    -------------------------
    Update 8/31/12
    In SPIN, I was able to obtain 18KHz
    In PASM, I was able to obtain 5MHz as a 50% duty cycle with a XOR loop.
    With Counters, I was able to obtain 60MHz through my translators which was my goal. I did go to 80, but the translators output was very unstable.
    Last edited by WBA Consulting; 09-01-2012 at 06:44 AM.
    Andrew Williams
    WBA Consulting

  2. #2

    Default Re: Fastest that you would or could toggle an IO pin?

    I think...

    Using a counter, you can output a ClkFreq/2 square wave (ie 40~50MHz depending on 5~6.25MHz xtal)
    Or in single cog Pasm, about 10~12.5 MHz

    Your Honda, whats it go to 6000rpm? Thats 100 Hz, or 500,000 times slower

  3. #3

    Default Re: Fastest that you would or could toggle an IO pin?

    hmm.

    I think what's really being asked is how long it takes for a spin statement to turn on, and then turn off, a single output pin.

    rough estimate is that I was just barely able to get 38 KHz IR working with just spin instructions with an 80 MHz clock.
    subsequent revisions used a counter, of course, to produce the 38 KHz modulation and then much more slowly stream out the bits using spin.

  4. #4

    Default Re: Fastest that you would or could toggle an IO pin?

    If using the PLL, the max I've been able to see is 230Mhz with 80MHz system clock.

    If PASM, 10Mhz, 1 instruction on, 1 off.

  5. #5
    frank freedman's Avatar
    Location
    Phoenix Az -- Hmmm, kinda runs hot & cold
    Posts
    1,033

    Default Re: Fastest that you would or could toggle an IO pin?

    Find out for yourself. But determine whether you are using spin or pasm. There (big duh please) is a huge difference in speeds. What will your project require to meet your needs? Then set up loops of different functions to get a feel for timing. Not just a toggle on/off as that may give an absolute speed, but would not be very representative of what you will get.

    An example test I ran was step through all 4096 values into a 12bit mdac to put out a ramp function. In spin it took multiple seconds to run from 0 to 4096. In PASM, the same ramp would take about 18 mS. So maybe it would make better sense to evaluate whether the chip specs can deliver on the project.

    FF

  6. #6

    Default Re: Fastest that you would or could toggle an IO pin?

    <-- Hit the speed limiter on a Honda

    I've toggled a pin at 9000hz, so on for 4444 clk cycles and off for 4444 clk cycles, for my automotive project. (15k rpm) This was in PASM and spin, although with spin I had nothing else in the loop besides the pin toggle code, because it is so much slower. If you can spare a dedicated cog to spin, this will be fine. If you have other stuff going on, PASM is the way to go IMO.




    Quote Originally Posted by WBA Consulting View Post
    I am getting mixed answers in my searching so I figured I would ask my question directly. Irregardless of what the propeller can do as far as speed of toggling a pin, in most uses of a propeller, what is the fastest you would toggle an IO pin? For example, I know my Honda is spec'd to do 110mph, but I never need to go over 75.

    I also need to answer the same question for a BASIC Stamp because my project ties into both.

  7. #7
    Cluso99's Avatar
    Location
    Sydney/Brisbane Australia or 'sailing on the high seas'
    Posts
    9,941

    Default Re: Fastest that you would or could toggle an IO pin?

    The counters can toggle at clock speed, so an 80MHz clock can toggle at 80MHz. Using the internal PLL in the video counter can toggle faster - IIRC up to 2x clock speed. PASM can do clock/8 (2 sets of 4 clocks for 2 instructions but of course will top out when you need a jump instruction. Spin is much slower, typically ~50 pasm instructions per spin simple instruction.

    FYI: FUllDUplexSerial will run at 115,200 quite happily - some have run it faster IIRC. That is 115,200 bits per second.
    My Prop boards: CpuBlade, TriBlade, RamBlade, www.clusos.com
    Prop Tools (Index)
    Emulators (Index) ZiCog (Z80)
    Prop OS (also see Sphinx, PropDos, PropCmd)

  8. #8

    Default Re: Fastest that you would or could toggle an IO pin?

    I tried toggling a pin on a plain old BS2 and got 1.19 kHz out.
    - Rick

  9. #9

    Default Re: Fastest that you would or could toggle an IO pin?

    I don't think the question is asking for the fastest possible speed, but the fastest speed that most code runs at. I.e., if you averaged the maximum speed of I/O toggling of every object in the Obex, what would that speed be?

  10. #10

    WBA Consulting's Avatar
    Location
    4.3 Light Years from Rigil Kentaurus
    Posts
    2,135
    Blog Entries
    26

    Default Re: Fastest that you would or could toggle an IO pin?

    Some very good answers and details to help me along, but SRLM is correct as I am trying to determine if a 30mhz limit on IO pins would limit the propeller's functionality.
    I was at the conclusion that toggling a propeller pin at 80mhz was possible, but why would you need to? A better way to ask my question is probably: If you can't toggle a pin over 30mhz, what can the propeller NOT do that most propeller users would be doing. If I hand you a propeller board that cannot go faster than 30mhz on an IO pin, could you still use it?

    Rdl2004: thanks, I was figuring the stamp would be way under my 30mhz breakpoint.
    Andrew Williams
    WBA Consulting

  11. #11

    Default Re: Fastest that you would or could toggle an IO pin?

    For mechanical systems the fastest I need to toggle a pin for would be a 20,000 rpm bldc motor (3 phases/windings) which is 1 KHz. For data acquisition more than 1MHz is rarely needed. Fastest ever was 96MHz for acquiring data from a PMT but that was done in hardware.

  12. #12

    Default Re: Fastest that you would or could toggle an IO pin?

    Quote Originally Posted by WBA Consulting View Post
    Some very good answers and details to help me along, but SRLM is correct as I am trying to determine if a 30mhz limit on IO pins would limit the propeller's functionality.
    I was at the conclusion that toggling a propeller pin at 80mhz was possible, but why would you need to? A better way to ask my question is probably: If you can't toggle a pin over 30mhz, what can the propeller NOT do that most propeller users would be doing. If I hand you a propeller board that cannot go faster than 30mhz on an IO pin, could you still use it?
    Only for some things - remember the Prop can also resolve any pin edge to 12.5ns, so any Bandwidth limit restricts the corner cases on both generate, and sync.

    A better question is, what drives the need to limit a pin BW to 30MHz ?

  13. #13

    Default Re: Fastest that you would or could toggle an IO pin?

    Quote Originally Posted by WBA Consulting View Post
    Some very good answers and details to help me along, but SRLM is correct as I am trying to determine if a 30mhz limit on IO pins would limit the propeller's functionality.
    I was at the conclusion that toggling a propeller pin at 80mhz was possible, but why would you need to? A better way to ask my question is probably: If you can't toggle a pin over 30mhz, what can the propeller NOT do that most propeller users would be doing. If I hand you a propeller board that cannot go faster than 30mhz on an IO pin, could you still use it?

    Rdl2004: thanks, I was figuring the stamp would be way under my 30mhz breakpoint.
    With a 30 MHz limit you can not do SigmaDelta ADC and DutyPWM output. If Duty not works then for example all the sound object that use DUTY mode for DACs will not work well.

    With 30 mhz (=0.03 Hz) you can not do much more than blinking a LED very slow.

    Andy

  14. #14

    Default Re: Fastest that you would or could toggle an IO pin?

    Quote Originally Posted by kwinn View Post
    For mechanical systems the fastest I need to toggle a pin for would be a 20,000 rpm bldc motor (3 phases/windings) which is 1 KHz. For data acquisition more than 1MHz is rarely needed. Fastest ever was 96MHz for acquiring data from a PMT but that was done in hardware.
    Rather off topic but a BLDC motor at 20,000 rpm the frequency depends on the number of magnet pole pairs, not the number of windings, each winding sees one cycle per pole-pair. I've some brushless BLDCs with 7 pole pairs so the windings would run at 2.33kHz for 20,000rpm, but the time step between each phase switching would be 1/6 of that period, i.e. 71.4us - in the PASM range clearly.

    Pet peeve for previous posters: mhz ?? KHz ?? really?? Those mean 0.1 'z' and 1024 hertz respectively (m = milli = x0.001, h = hect = x100, K = x1024 (not SI) hertz is abbreviated Hz not hz)

  15. #15

    WBA Consulting's Avatar
    Location
    4.3 Light Years from Rigil Kentaurus
    Posts
    2,135
    Blog Entries
    26

    Default Re: Fastest that you would or could toggle an IO pin?

    Quote Originally Posted by jmg View Post
    A better question is, what drives the need to limit a pin BW to 30MHz ?
    I am working on a propeller pcb design that will have another chip between the prop and the io pin. The particular chip I am currently looking at has a switching limit of 30mhz (megahertz) ;-)
    Andrew Williams
    WBA Consulting

  16. #16

    Default Re: Fastest that you would or could toggle an IO pin?

    Quote Originally Posted by WBA Consulting View Post
    I am working on a propeller pcb design that will have another chip between the prop and the io pin. The particular chip I am currently looking at has a switching limit of 30mhz (megahertz) ;-)
    So there must be some as yet unstated benefit of that chip, and it presumably does not go between ALL Prop Pins, and the real world ?
    Dedicated IO functions are fine, provided users still have some choice.
    Plenty of designs have RS232 chips, or Darlington Arrays on some of their pins.

  17. #17

    Default Re: Fastest that you would or could toggle an IO pin?

    Quote Originally Posted by WBA Conmsulting
    I am working on a propeller pcb design that will have another chip between the prop and the io pin.
    What is the other chip, and what is it's purpose? We could help you better if you were less coy about your intentions.

    -Phil

  18. #18

    WBA Consulting's Avatar
    Location
    4.3 Light Years from Rigil Kentaurus
    Posts
    2,135
    Blog Entries
    26

    Default Re: Fastest that you would or could toggle an IO pin?

    Phil, et al,
    My apologies, but there are many caveats to the design that are as yet undisclosed purposely, so forgive my attempts to get detailed answers from a non-detailed question. After more thought and an email from someone who has some knowledge of the design, I have been able to confirm that the 30mhz limit will pose minimal issues for my design's main intent. The secondary intent of the design will only have concerns among 10-20% of those users, so overall, less than 5% of my target market will be saddened by the limit.
    Andrew Williams
    WBA Consulting

  19. #19

    WBA Consulting's Avatar
    Location
    4.3 Light Years from Rigil Kentaurus
    Posts
    2,135
    Blog Entries
    26

    Default Re: Fastest that you would or could toggle an IO pin?

    Update: I have my design in prototype stage and I am trying to "break it". For more detail, I am using voltage translators with the prop that are rated at 60Mbps (TXS0108E). I am trying to get the prop to surpass that by using PASM and counters to toggle a pin. Earlier in this thread it is mentioned that 10Mhz should be possible in PASM. The best I can get is 6.684Mhz (on my board and my PropBOE.

    Can anyone tell me why my PASM code is not faster than that? I am using a modified version of Jonnymac's JM_Blinker code. I still need to dig deeper into counters to try to get to 40Mhz as reported being possible.

    Code:
    '' =================================================================================================
    ''
    ''   File....... jm_blinker.spin
    ''   Purpose.... PASM LED blinker
    ''   Author..... Jon "JonnyMac" McPhalen              
    ''   E-mail..... jon@jonmcphalen.com
    ''   Started.... 
    ''   Updated....  Andrew Wiliams, PASM Toggle Speed
    ''
    '' =================================================================================================
    
    CON
      _clkmode  = xtal1+pll16x
      _clkfreq  = 80_000_000
      
    var
    
      long  blinkpin                                                ' pin used by blinker cog
    
    pub start
    
      blinkpin := 5
      result := cognew(@blinker, @blinkpin)                  ' start blinker cog
    
    dat
    
                            org     0
    
    blinker                 mov     t1, par                         ' start of structure
                            rdlong  t2, t1                          ' read blink pin
                            mov     pinmask, #1                     ' create mask from pin #
                            shl     pinmask, t2
                            mov     dira, pinmask                   ' make pin an output
                      
    bloop                   andn    outa, pinmask                   ' pin off
                            or      outa, pinmask                   ' pin on
                            jmp     #bloop                          ' loop forever
                              
    ' --------------------------------------------------------------------------------------------------
    
    pinmask                 res     1                               ' mask for blinker pin
    ontix                   res     1                               ' on timing in system ticks
    offtix                  res     1                               ' off timing in system ticks
    timer                   res     1
    
    t1                      res     1
    t2                      res     1
    
    
    dat
    
    {{
    
      Terms of Use: MIT License
    
      Permission is hereby granted, free of charge, to any person obtaining a copy of this
      software and associated documentation files (the "Software"), to deal in the Software
      without restriction, including without limitation the rights to use, copy, modify,
      merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
      permit persons to whom the Software is furnished to do so, subject to the following
      conditions:
    
      The above copyright notice and this permission notice shall be included in all copies
      or substantial portions of the Software.
    
      THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
      INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
      PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
      HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
      CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
      OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    
    }}
    Andrew Williams
    WBA Consulting

  20. #20

    Default Re: Fastest that you would or could toggle an IO pin?

    Quote Originally Posted by WBA Consulting View Post
    Earlier in this thread it is mentioned that 10Mhz should be possible in PASM. The best I can get is 6.684Mhz (on my board and my PropBOE.

    Can anyone tell me why my PASM code is not faster than that?
    It depends on semantics - you have a Set/Clr/Jmp, in a 3 op code loop. You have one Pin-cycle per loop (not 50% duty), so 6.6666' MHz is the result.
    You can do a XOR+JMP and now the loop runs at 10MHz, but a 10MHz toggle is a 5MHz pin frequency.

    Or you can unroll the loop and chain XOR, for a 20MHz toggle burst, or a 10MHz pin frequency burst, for tests.

+ Reply to Thread

Similar Threads

  1. Should demos/toggle/lmm_toggle/toggle.c compile w/ -mcog option?
    By mindrobots in forum Propeller GCC Alpha Test Forum
    Replies: 2
    Last Post: 11-19-2011, 02:03 AM
  2. I only want to toggle an LED!
    By kutalinelucas in forum Propeller 1 Multicore Microcontroller
    Replies: 2
    Last Post: 08-14-2011, 02:57 PM
  3. toggle a LED
    By Maria Ivanovna in forum Propeller 1 Multicore Microcontroller
    Replies: 9
    Last Post: 10-23-2009, 05:37 AM
  4. AC Toggle
    By Naphtali Moore in forum General Discussion
    Replies: 3
    Last Post: 10-06-2007, 08:53 PM
  5. toggle I/O pin
    By khannad1 in forum SX Chips and Programming Tools
    Replies: 2
    Last Post: 07-27-2007, 08:17 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts