Shop OBEX P1 Docs P2 Docs Learn Events
BS2 clock speed question — Parallax Forums

BS2 clock speed question

davejamesdavejames Posts: 4,047
edited 2014-06-13 00:30 in BASIC Stamp
I see the following clock speed specs listed for the various BS2 products as:

BS2 - 20 MHz
BS2e - 20 MHz
BS2sx - 50 MHz
BS2p24 - 20 MHz Turbo
BS2p40 - 20 MHz Turbo
BS2pe - 8 MHz Turbo
BS2px24 - 33 MHz Turbo

To those that might know, what's this "Turbo" thing all about?

Thanks.

Comments

  • Tracy AllenTracy Allen Posts: 6,664
    edited 2014-06-05 13:16
    The original BASIC Stamp using the PIC chip executes one instruction for every 4 clocks, so with a 20Mhz resonator the interpreter is running at a base rate of 5MHz. The BS2e and the BS2sx are pretty much a straight port of the PIC code over to the SX28 chip. There speeds are exactly the same or 2.5x faster respectively.

    The SX chip is code compatible with the PIC, but it also has a turbo(!) mode. That is a pipeline where most can execute at one instruction per clock. In "p" series Stamps the interpreter is recast to run in turbo mode. Thus, the p series Stamps are much faster at a given resonator frequency. For example, the BS2pe uses an 8MHz resonator but it runs slightly faster than the BS2e with its 20MHz resonator. The BS2p gets about a 3x speed advantage over the BS2 and the BS2px about 5x. 20Mhz and 32MHz resonators respectively. The turbo mode is not an exact 4x multiple of the original speeds, because many instructions such as those that involve branching have refill the pipeline.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2014-06-05 13:17
    That is a function of the SX microcontroller where in compatibility mode the instructions internally take 4 cycles to complete. In turbo mode however, they take only 1 once the instruction pipeline is loaded.

    Edit: Tracy beat me to it. Better explanation too. :innocent:
  • davejamesdavejames Posts: 4,047
    edited 2014-06-05 14:15
    ...thanks guys!


    So - where is this information documented aside from possibly Mr. Allen's site?
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2014-06-05 14:37
    The SX Datasheet. The turbo function relates to the SX and its use of the resonator (or more accurately the instruction pipeline). In this case the speed is listed with Turbo after it to indicate that the internal fature is enabled. The 'turbo' option is usually specified at the beginning of the source code, so in terms of the BASIC Stamp it would be in the source code for the interpreter.
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2014-06-05 15:41
    I recall that it was Chuck Gracey, Ken and Chip's dad, who did a lot of the work to convert the BASIC Stamp interpreter code over to turbo mode and to add other features that are only available on the p series. I like to feel that I had good input into the introduction of the BS2pe, the low power data logger Stamp.

    The turbo thing is what made the SX such a hot processor. A lot of us are sad to see it disappear (due to IP disputes, I think).
  • GenetixGenetix Posts: 1,754
    edited 2014-06-05 16:42
    Tracy,

    Other than speed, are there any other differences between the BS2 and its SX-variants, functionally?
    I ask because I am not familiar with the SX but I've worked with PICs.
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2014-06-06 08:26
    The BS2e and BS2sx added scratchpad RAM and 8 slots of program eeprom with the RUN command to jump from slot to slot. The p series then added instructions to support peripherals (i2c, lcd..) , more flexible eeprom access across slots, polling of the input pins. Rereading the question, are you asking about differences between the original and the sx-based Stamps, or the differences between the PIC and the SX chips?
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2014-06-06 08:28
    Rereading the question, are you asking about differences between the original and the sx-based Stamps, or the differences between the PIC and the SX chips?

    That is why I didn't offer anything. :innocent:
  • davejamesdavejames Posts: 4,047
    edited 2014-06-06 12:23
    The SX Datasheet.

    ...so, "no" in relation to Parallax documentation.
  • GenetixGenetix Posts: 1,754
    edited 2014-06-06 15:15
    Tracy,

    Can I take circuits designed for the PIC-BS2 and use them on the SX-BS2, or vice-versa?
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2014-06-07 05:03
    Circuits are hard-wire which are always interchangible, but some timing code may require adjustment.

    Turbo mode is only available on the versions of the BS that use the SX chip. And it mostly runs code 4X faster than a PIC with the same XTAL. (I say mostly as some code will force the Turbo mode to dump what is in its pipeline and those items run at 1X... but on the whole it is much faster).

    Be aware that the faster you go, the more power the BS consumes. So take a look at the comparison chart for power consumption figures in the BasicStamp Manual. There are some situations where the lowly BS2 and BS1 are really the best choice for battery operation.

    The SX chips are something akin to a Deluxe PIC. More speed and more RAM in comparison a similar PIC. But they program through the OSC rather than programing the way the PIC does. Both can use a similar Boot Loader and that's why they are interchangeable for the BasicStamps.
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2014-06-08 19:52
    What Loopy said.

    The BS2e is the most compatible with the original BS2. It uses an SX28 chip, but not running in turbo mode. The timings are exactly the same as they are on the BS2. You get three new commands, GET, PUT and RUN that have to do with the 7 additional 2k memory slots for program and data.

    There are small differences in the power consumption in both run and sleep mode, with the BS2e drawing higher currents, and there are slight differences in the drive capabilities of the pins and pin thresholds, the BS2e having higher drive capability. Mostly things that won't make much difference. But the original BS2 is definitely lower power.

    The current version of the BS2e (hardware rev e, firmware rev 1.2) works over the full industrial temperature range, down to -40°C and below. Watch out though if you want to use an earlier rev below about -10°C; there is a bug in the brownout circuit of the SX chip on the 4.2V setting at sub-zero. The BS2e rev e instead has an external 4.2V brownout chip, like the original BS2.

    The p series Stamps have differences in timing, but the circuit interface is basically the same, same pinout on the modules and chips. Except the BS2p40 offers 16 additional i/o pins, x0 to x15 plus p0 to p15. P series all have additional very useful i/o commands in PBASIC.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2014-06-09 09:18
    Something else to consider. Just because the SX chip is running 4x faster in turbo mode does not mean that the BASIC Stamp Module is 4x faster than one running at the same frequency without turbo. Many instructions do not run faster regardless of the clock frequency. An obvious one is PAUSE. However fast BASIC Stamp Modules do offer increased performance/range on commands like SERIN/SEROUT. The important thing to remember is that the BASIC Stamp Modules execute PBASIC commands via an interpreter, so performance varies with certain commands.
  • GenetixGenetix Posts: 1,754
    edited 2014-06-13 00:30
    Thanks for the information since I have a BS2pe and a BS2px.
Sign In or Register to comment.