Shop OBEX P1 Docs P2 Docs Learn Events
SX running at 100Mhz — Parallax Forums

SX running at 100Mhz

Tony LeylandTony Leyland Posts: 71
edited 2005-01-18 05:17 in General Discussion
Hi,

I'm currently using an SX28 on the SX-Tech board and testing with the SX Key 3.0
It's being clocked at 100Mhz by the SX Key - I require maximum speed from
the CPU for my application.

I'm experiencing strange behavoir at the I/O pins, in that if I clear RB.4 (which has an LED on it)
and then immediately set RB.5 then the LED on RB.4 will light ! If I then insert a NOP instruction between the
clearing of RB.4 and the setting of RB.5 then the LED will stay off as expected.

I've tried it on 2 chips and still the same behavoir - even as low as 75Mhz. If I lower it to 50Mhz then all is well.

Has anybody any experience at running at such high speeds ? Any thoughts on what's happening here ? Is it the SX Key ?

Many thanks in advance, here is the source:-


DEVICE SX28,OSCHS3,TURBO
FREQ 100_000_000
DEVICE STACKX,OPTIONX
IRC_CAL IRC_FAST

RESET Main

ORG $000

Main:
mov !RB,#0 ; Configure ports for outputs
clrb RB.4 ; LED connected to this pin

; nop ; Remove the ';' SX will then do I/O properly at >=75Mhz

setb RB.5 ; Nothing connected to this pin

Loop:
jmp Loop

Comments

  • pjvpjv Posts: 1,903
    edited 2005-01-14 15:20
    Yup, this is the standard problem everyone experiences at high speeds with read-modify-write I/O pins.

    What happens is the small amountof capacitance on the SX I/O lines prevent the levels from changing quickly enough, so when a bit is told to go high (or low), and then the same port is told to change another bit, the read-modify-write sequence reads the not-yet-fully-changed value (wrong value) of the fisrt bit, and then re-writes that wrong value.

    At high speeds, the standard work-around for this problem is to provide some delay as nop's or other instructions between a port write and a subsequent re-access of that port. Experimentation will indicate what is a sufficient number of cycles; it depends on pin loading.

    Peter
  • Tony LeylandTony Leyland Posts: 71
    edited 2005-01-15 10:11
    Thanks Peter, I'll make sure I'll insert a NOP between 2·output pin operations.

    Are there any other problems (glitches) that I might see at 100Mhz ?· Is it OK to run at this speed
    or am I just being greedy !

    Does anybody know of the practical implications of running at 100Mhz - like sheilding on the PCB and
    how best to acheive it ?

    Many Thanks

    Tony
  • ForrestForrest Posts: 1,341
    edited 2005-01-15 12:18
    I would think a good sized heat sink with a fan would be a requirement. The X Game Station is using an SX52 clicked at 80 MHz and it has a large heat sink on it http://www.xgamestation.com/ I'd pose the question on the forums at X Game Station - as the designer of the system Andre (forum name Necron) is frequently there answering questions.
  • pjvpjv Posts: 1,903
    edited 2005-01-15 18:01
    Hi Tony;

    I think Forrest has a good point, a little air circulation at 100 Mhz is not a bad thing, but not absolutely neccessary.

    For testing, I have run them as fast as 115 MHz, but they do get quite hot, and very fussy on the supply voltage. I can't recall now what the precise voltage preference was, but you can experiment by slowly cranking the speed up on the SX-Key, while carefully wiggling the supply voltage a little bit. I did notice improper operation of some instructions at these extreme speeds.

    Because of convenience in getting inexpensive resonators, almost all of my applications run at 50 Mhz, and that makes them warm enough already. As you said, you might be getting a little greedy looking for 100. Pehaps a good compromize is 75 or 80 Mhz. I have not yet found a good inexpensive source for those resonators, and I don't want the cost, space, nor power consumption of an external oscillator.

    By the way, a single nop may not be sufficient delay for reliable operation of consecutive port accessing where the first access is a write. It depends a lot on the (capacitive) loading on the pins. Starting with zero nop's, which we already know will not work, I would suggest increasing nop's (or other, more useful instructions) between the port accesses one at a time until the results just work, and then add 50% more as a safety margin. Please realize that each pin may behave differently, requiring more or less nop's. You then need to pick the largest number of instructions. Too many cannot hurt, only it slows down the performance somewhat, but you gain reliability. And with clever programming the nop's can usually be replaced with instructions you needed to execute anyway.

    Have fun experimenting.

    Peter
  • Tony LeylandTony Leyland Posts: 71
    edited 2005-01-15 23:11
    Thank you for your help, I will utilise those ideas in the design.

    By-the-way, the reason I'm looking for maximum performance is that I'm developing a
    general purpose function generator (Sine, Triangle, Ramp etc.) with an 8-bit DAC attached.
    I'm trying to get the maximum frequency waveforms out of it (30Khz+) I can, and keeping
    the resolution of the Sine waveforms high without lowering the Sine waveform enties in the
    table below 256 (like 128 say).

    Cheers,
    Tony
  • dkemppaidkemppai Posts: 315
    edited 2005-01-16 02:30
    Tony,

    You konw,·the AD9833 DDS chip would be a lot easier.
    Sine, Triangl, or Square wave up to 12.5Mhz,
    with about 0.1Hz frequency resolution with a 10Bit D-A...
    You can also clock it lower Mclock, and get .01Hz resolution
    or something gross like that.

    I have a few I've been wanting to play with, but just haven't
    had the time to make a Dip Adaptor...·· ...the problem is that
    the the MSOP10 is really freaking tiny!

    The hardest thing is in code is dealing with the 28bit frequency
    tuning word. But, even that math wouldn't be too difficult...

    It really is a freaking awesome chip! Makes me wish I hadn't purchased
    my Agilent 33220A func/arb so soon...

    http://www.analog.com/en/prod/0,,770_843_AD9833%2C00.html

    Dan

    P.S. Maybe·we should clue the parallax guys onto this one...
    ...I know that this chip with a multiplying dac would make a
    really nice signal generator module for the basic stamp or
    SX processor.
  • pjvpjv Posts: 1,903
    edited 2005-01-16 04:18
    Hi Tony;

    If you are looking for a low-end signal generator, why not try having a go at using an SX directly to generate the sine waves by means of outputting a Pulse Density Modulation technique (a close cousin of pulse width modulation). It is really easy to generate and all you need for external components is a small capacitor (say 0.01 uf) and a resistor (say 2.2K). While there are several undesirable attributes to this technique, the results can be remarkably good for many applications.

    Some of the negatives for a general purpose application are:

    Upper frequency limit perhaps 20 or 30 KHz, depending on processor speed.
    Amplitude resolution limited to 8 bits; more with more speed
    Unipolar output; that is not swinging positive and negative about zero
    Sine steps of 32, or 8 per quadrant; more with more speed

    Some of these attributes may be improved at the expense of making others worse; for example all can be made better at the expense of upper frequency (here is your high speed 100 MHz operation issue).

    It makes for a great experiment, costs exactly 3 cents, and yet makes a great looking sine wave, or triangle wave or saw-tooth.
    And, (somewhat) arbitrary funcions can also be generated.

    It's really amazing how much performance you can squeeze out of these virtual peripheral concepts!

    If this is interesting to you I can give you more direction.

    Peter
  • StephenStephen Posts: 53
    edited 2005-01-17 07:20
    FWIW, the SX48/52 will be far more successful at overclocking than the SX18/20/28. There were a few tweaks to the memories in the device to allow for 100MHz operation. In addition the SX28AC100 (never sold, available as engineering samples only) could never debug at 100MHz. SX48/52 had no problems at these speeds...

    Also better use a heatsink, these suckers get hot at these speeds. You may also need to crank the VCC a little higher, but no more than 6.25V.
  • Tony LeylandTony Leyland Posts: 71
    edited 2005-01-17 12:43
    Hi Dan,

    Thanks for letting me know about the AD9833 DDS chip.· Wow, that is a very powerful chip. I could not
    beleive at first how they were able to produce such accurate frequencies and in the Mhz range !· After
    ploughing through many datasheets about DDS technology, I'm going to have a go in assembly on the SX as it's
    given me some ideas to experiment with (will certainly be counting my clock cycles !).· Just working now on a
    programmable delay loop that is·accurate to 1 clock cycle·and then I will probably use variable Sine tables
    of 64,32,16,8 or even 4 bytes per quadrant.· If I can't get·programmable·waveforms up to 100Khz then I'll look at
    the AD9833 chip.

    The whole project is a function generator with sweep mode that is to be programmed from a PC so that
    I can see the frequency response of filters in the audio range - maybe displayed on PC screen.

    Hi Peter,

    Do you have any www links where I could find out about the "Pulse Density Modulation technique" that you mentioned
    as it may give me some additional ideas.· Many Thanks.

    Thanks Stephen for the info·on the SX48/52, I'm certainly interested in that chip but a little put off by·SMD
    technology as I've no experience with SMD (with developement boards etc).

    Thank you all very much for your help.
    Tony
  • dkemppaidkemppai Posts: 315
    edited 2005-01-18 03:21
    Tony Leyland said...

    Thanks for letting me know about the AD9833 DDS chip.· Wow, that is a very powerful chip. I could not
    beleive at first how they were able to produce such accurate frequencies and in the Mhz range !· After
    ploughing through many datasheets about DDS technology, I'm going to have a go in assembly on the SX as it's
    given me some ideas to experiment with (will certainly be counting my clock cycles !).· Just working now on a
    programmable delay loop that is·accurate to 1 clock cycle·and then I will probably use variable Sine tables
    of 64,32,16,8 or even 4 bytes per quadrant.· If I can't get·programmable·waveforms up to 100Khz then I'll look at
    the AD9833 chip.

    Tony, there are a few things to watch out for with the frequency generation and sine tables. I spend
    some time generating sine waves (low frequency) and had some trouble getting the clock cycles to line
    up. Basically, I used the SX28 for a PWM modulator to generate 60Hz·AC from a DC source. Tested
    a prototype unit up to 600W...·· ...then work got in the way. [noparse]:([/noparse]

    Anyway, you may also check out the IXDP610 from ixys. This chip makes PWM a lot easier! You can update
    the PWM width as required by your frequency progrm...

    http://www.ixys.com/91600.pdf· (At least this one comes in a DIP format!)


    As for the signal generator and filter response, I know exactly what you are trying to do.
    I bought a Agilent 33220A and use it with my TDS3032B scope to plot gain and phase
    for analog systems. I wrote an excel addin that controls the sig gen and scope measuring
    gain and phase vs frequency. It's really nice to automate the task when dealing
    with 1/100 Hz sines·because you can start it running and walk away.·(It takes 100 seconds
    for each cycle) Still wish I would have known about the DDS chip...

    -Dan

    ·
  • pjvpjv Posts: 1,903
    edited 2005-01-18 04:34
    Hi Tony;

    In regard to pulse density modulation, I have no links, but it is the standard technique I have seen in numerous Parallax applications where a variable voltage voltage was required from a DAC. In these cases the DAC can be seen to be a simple pulse density train out of one of the SX pins, and a resistor (2.2K) coupled to a grounded integrating capacitor (.01U).

    The software is unbelievably simple, costs nothing, yet gives astonishing results.

    If DUTY is a 0 to 255 value representing the desired voltage ratio of 5 volts, and
    ACCUM is a one byte accumulator, and
    PORTBIT is the desired output line,

    Then run the following code in a fairly fast ISR, say 1 or 10 usec

    ADD ACCUM, DUTY
    SC
    CLRB PORTBIT
    SNC
    SETB PORTBIT

    If you change the value of DUTY in the mainline program, you can see the corresponding change in density distibution of pulses out the PORTBIT.
    The RC filters that train nicely to a DC value with DUTY=0 giving o volts, DUTY = $FF giving 5volts, and DUTY = $80 giving 2.5 volts, etc.

    Then let your mainline software on a regular basis (8 or more times per quadrant) pick the next sine value for DUTY out of a lookup table, and out comes your sinewave. Or alternately your triangle, or ramp, all accoring to a repeating DUTY value lookup table. The wave period is the time it takes to cycle though all the values.

    Simple, and works great.

    Higher amplitude precision can be gained by making the ACCUM and DUTY more than 8 bits long, and use a bit value in the higher byte instead of using CARRY to decide to SET or CLEAR the PORTBIT. Clearly, the reverse is also true. Even 4 bits can give a result adequate for some applications.

    With a little more work you can even output two or more simultaneous frequencies by doubling up the the ISR code and using two port bits. In fact you can generate two outputs of the same frequency, shifted by a phase, if you stagger their two lookup values from the table. Then, for even more fun, if you sum the two sine waves through two resistors, you can change the resulting amplitude by varying the phase between them. In-phase for maximum amplitude, out of phase gives cancellation.

    Experimenting with this is great fun, especially if you have a multi-channel oscilloscope.

    Peter
  • StephenStephen Posts: 53
    edited 2005-01-18 05:17
    FWIW, here's an artificial sine gen app from a while back...
Sign In or Register to comment.