Ask Larry

Dear Larry,

Can you please tell me the minimum and maximum speed capability of the Rabbit’s serial ports?

Ryan A.

Hello Ryan,

One of the main “features” that governs the speed of ALL Rabbit subsystems is the main CPU clock frequency. Here is a block diagram of the serial port clock system for the Rabbit 4000 and 5000 processors:

Unless you have deliberately changed it, the Peripheral Clock frequency is the same as the CPU clock. The Most Significant Bit of the 15 bit divider is used to control the last selector in the diagram. If it is “1” then the 15 Bit Divider is selected. The Rabbit 2000 and Rabbit 3000 processors do not have the 15 Bit Divider. The default for Dynamic C 10.xx is to use the 15 Bit Divider.

The diagram also shows a divide-by-two block driven by the Peripheral Clock. The selection is made via the TAPR. There are two ways to control this feature:

  • Set the TAPR from within your program – this is not recommended because the serxOpen functions will not calculate the baud rates properly.
  • Define the macro USE_TIMERA_PRESCALE in the Options – Project Options -Defines tab

The default is to use the divide-by-two.

Timer A1 is only needed in the Rabbit 2000 and 3000 if a “low” baud rate is required. Since all of the timer A’s are eight bits, there is obviously a limit of 256 as a divisor. Dynamic C (9.xx and earlier) will automatically use Timer A1 if a single low baud rate is required. If multiple low baud rates are required you will need to do some manual adjusting. I hope this response answers your question.

Examples

Keep in mind that Dynamic C will normally do all of the calculations “under the hood” as long as you do not do anything to keep it from doing so. The following examples assume that the defaults are being used.

Let’s start with an RCM4000 @ 59.98 MHz. What are the minimum and maximum baud rates?
The maximum Asynchronous rate will be 59.98 MHz/16 = 3.748750M baud.
The minimum Asynchronous rate will be 59.98 MHz/16/32768 = 114.4 baud.

The maximum Synchronous rate will be 59.98 MHz/2 = 29.99M Bits/second
The minimum Synchronous rate will be 59.98 MHz/2/32768 = 915.2 Bits/second

However, there is a major “catch” here relative to the maximum values! Even though the processor is capable of generating signals at the speeds indicated there is nothing that says the rest of the circuitry (or software) is capable of handling them. Looking at the specifications for one of our Single Board Computers, the BL4S100, you will see that its’ maximum baud rate is listed as 115K. The reason for this is the RS232 IC we use is limited to that speed.

As indicated in the last paragraph software also becomes a limiting factor at high speeds. Testing has indicated that our standard serial port drivers, which use interrupts, can handle 460kbaud on a single port with a 30 MHz CPU. If you attempt to receive data at a higher rate bytes will be lost because the ISR handling time is not fast enough. For transmitting, using a higher baud rate will not yield the expected results - the individual bytes will be at the requested baud rate but there will be inter-byte gaps due to ISR processing time.

Do not attempt to run high speed serial signals without proper attention to signal integrity. We are often asked “How fast can I run the SPI?” This is not an easy question to answer. In general we suggest to the customer that it be run no faster than is required by the system. If you need to run high speed CMOS signals any distance you would be well advised to use terminating resistors. Sometimes a “back termination” will be adequate. Sometimes you will have to add resistors at the receiving end. You may need to use twisted pair. There are many things to consider when transporting high speed signals. You should view the signals with a good oscilloscope that is properly grounded.

We also get asked “How do I access SPI with your XXX Single Board Computer?” In general, the answer is “You don’t.” Our SBCs are not designed to make the pins of the microprocessor available. The only exception to this is if the board has a RabbitNet circuit on it and you are not using it. The hardware used for RabbitNet is simply differential SPI. Using the correct phase of the available signals will give you a set of signals that are SPI. You will probably have to do some manual programming in order to enable the circuit but it will be relatively straight-forward.

- Larry C.

Larry Cicchinelli is Rabbit’s Technical Support Manager. He has 30 years of embedded experience, and is considered one of the foremost authorities on Rabbit products. Larry and his staff offer comprehensive technical support to Rabbit customers.

Submit your questions for Larry via email at AskLarry@rabbit.com

Read more Ask Larry Answers