Shop OBEX P1 Docs P2 Docs Learn Events
SX48BD Multi-Function Timer — Parallax Forums

SX48BD Multi-Function Timer

DragonSXDragonSX Posts: 14
edited 2007-02-22 19:50 in General Discussion
With the SX48BD, I want to clock the multi-function timer with an external clock and capture the counter with the capture input. Can I use the external clock input with the capture 1 input?

-Matt

Comments

  • BeanBean Posts: 8,129
    edited 2007-02-21 18:40
    Matt,
    What you need to to is setup the timer to as "external counter", then when you want to get the current count, you need to change the timer mode to "capture" and toggle the capture pin.

    You have to do it this way because you cannot get the current count without capturing it first.

    What I do is connect one of the SX pins to the capture pin, then toggle that pin to capture the count.

    P.S. Are you using assembly or SX/B ?

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheap used 4-digit LED display with driver IC·www.hc4led.com

    Low power SD Data Logger www.sddatalogger.com
    SX-Video Display Modules www.sxvm.com
    ·
  • DragonSXDragonSX Posts: 14
    edited 2007-02-21 19:15
    What I want to do is run the SX at 4MHz since I need to save power. The only timing critical event is the counter, which needs to be clocked at 75MHz and only for about 1us. Both capture inputs are an external event that is used to capture the counter value clocked by the external 75MHz clock.

    I either need to use the external 75MHz clock input to the counter or be able to change the OSC1 input frequency to 75MHz for that 1us time period and then back to 4MHz after the capture is complete.

    The datasheet does not describe the external counter mode much besides saying it work like PWM mode. Does this mean the capture inputs cannot be used in the "external event" mode (since this is the only mode that appears to have the external clock capability and there does not seem to be any clock source configuration bit)?

    Thanks for the reply (P.S. I think I have answered my own question already but in need of reassurance that the capability is not there),

    Matt
  • BeanBean Posts: 8,129
    edited 2007-02-21 19:18
    What is the frequency your are trying to count ?

    In my experience, the SX must run at 3x the frequency being counted.
    So running at 75Mhz would allow you to count a 25MHz frequency.

    Your right, you cannot use the capture inputs while in external event mode, that's why you need to change modes to get the count.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheap used 4-digit LED display with driver IC·www.hc4led.com

    Low power SD Data Logger www.sddatalogger.com
    SX-Video Display Modules www.sxvm.com
    ·
  • DragonSXDragonSX Posts: 14
    edited 2007-02-21 19:34
    I'm not using the sync fuse and I am not using the RTCC. The block diagram says the counter runs off the system clock through the 3-bit divide which can be set to 1. In your experience this config. setting does not work?

    BTW, I am using the CCS SX C Compiler.


    -Matt
  • BeanBean Posts: 8,129
    edited 2007-02-21 19:43
    Matt,
    What frequency are you trying to count ???

    If I remember correctly, the SX must be clocked a 3x the frequency being counted.

    Perhaps an external frequency divider could be used.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheap used 4-digit LED display with driver IC·www.hc4led.com

    Low power SD Data Logger www.sddatalogger.com
    SX-Video Display Modules www.sxvm.com
    ·
  • DragonSXDragonSX Posts: 14
    edited 2007-02-21 20:33
    capture 1 input captures counter then capture 2 input captures within 1us of the first capture. Counter is being clocked at 75MHz.

    "If I remember correctly, the SX must be clocked a 3x the frequency being counted."

    I am not trying to determine a frequency if that is what you mean? Or are you talking about the external clock, in which I wouldn't this that were true unless you had the sync fuse enabled.

    I wish the SX chip could come out of Power Down Mode faster. Then I could just goto sleep when I am done taking the time measurement. Then I could run at 75MHz then goto sleep to save power. The fastest I can get the SX48BD to wake up is about 400us though.

    -Matt
  • BeanBean Posts: 8,129
    edited 2007-02-22 12:28
    DragonSX said...
    I am not trying to determine a frequency if that is what you mean? Or are you talking about the external clock, in which I wouldn't this that were true unless you had the sync fuse enabled.
    What ARE you trying to determine ? The time between capture pulses ? More details please...

    Bean.


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheap used 4-digit LED display with driver IC·www.hc4led.com

    Low power SD Data Logger www.sddatalogger.com
    SX-Video Display Modules www.sxvm.com
    ·
  • DragonSXDragonSX Posts: 14
    edited 2007-02-22 15:56
    "capture 1 input captures counter then capture 2 input captures within 1us of the first capture. Counter is being clocked at 75MHz."

    Yes, "The time between capture pulses ?" (well edges since it captures on rising or falling edges).

    I don't see any reason why the counter cannot be clocked at 75MHz as long as the sync fuse is disabled.

    From the SX datasheet:
    datasheet said...
    Synchronous input enable (this bit synchronizes the signal presented at the input pins to the internal
    clock through two internal flip-flops). Required to be enabled unless the transition on the input pin is
    not close to the clock edge. If enabled, port data must be read more than 2 cycles after a change to
    the input level mode or Schmitt Trigger mode (see Figure 3-2). SYNC is always enabled on RTCC.

    The reason I want to do this is because I do not need the whole chip to run at 75MHz while it is sitting in loops waiting for the captured time interval. Waste of power. I want to run the rest of the SX48 off of the internal 4MHz.


    I guess this doesn't matter anymore anyway since my original question:

    "With the SX48BD, I want to clock the multi-function timer with an external clock and capture the counter with the capture input. Can I use the external clock input with the capture 1 input?" (maybe I should have added "at the same time" to word it better.)

    doesn't seem possible.


    Another question to anyone familiar with the propeller - Is what I am trying to do possible with the propeller?

    1) Idle the chip at a slower system clock.
    2) Jump quickly (on the fly) to a faster system clock to capture the time between 2 edges (counter counting at 75-80Mhz - about 13ns per clock).
    3) Jump quickly back down to the slower system clock.
    4) Bonus would be to have different power management capabilities which would allow you to enter and escape from them quickly (<100us).

    My understanding is that the Propeller has a PLL. Do you know how fast the PLL will change from 1 freq. to the next?

    -Matt
  • DragonSXDragonSX Posts: 14
    edited 2007-02-22 17:50
    After DLing the counters app. note for the propeller, and filtering though ALL the modes, doesn't look possible.

    -Matt
  • BeanBean Posts: 8,129
    edited 2007-02-22 17:57
    Matt,
    What power usage can you stand while counting and while idle ?


    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheap used 4-digit LED display with driver IC·www.hc4led.com

    Low power SD Data Logger www.sddatalogger.com
    SX-Video Display Modules www.sxvm.com
    ·
  • DragonSXDragonSX Posts: 14
    edited 2007-02-22 19:27
    Ideal <10ma in idle (we were considering a method that would draw 40-50ma).
    not that picky about during counting since that will only take a few us. We assumed it would be around 150-200ma.

    I was running some experiments for someone else here to see if we could get the SX to run off of 2 separate clocks (4MHz and 50-75MHz). The idea was to dominate a crystal @ 4MHz with a 75MHz clock only while counting. So far, the tests fail (as I would expect). This hack was to be temporary until we could come up with a better solution.

    The other idea was to get an external clock management chip, but the chips we looked at (Cypress with PLL) don't change frequency quickly enough. We need the frequency to change in less than 100us (if not ns). This has to be done with the least amount of circuitry possible. Talk about optimizing freaked.gif

    If you have any suggestion or know of any solutions for changing a clock source frequency quickly, let me know.

    -Matt
  • BeanBean Posts: 8,129
    edited 2007-02-22 19:50
    Can you use an external high speed counter chip ? Since you are only counting for a couple uSec the count shouldn't be that high. An 8 bit counter would be good for 3 uSec.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheap used 4-digit LED display with driver IC·www.hc4led.com

    Low power SD Data Logger www.sddatalogger.com
    SX-Video Display Modules www.sxvm.com
    ·
Sign In or Register to comment.