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

Minimum clock speed

Jay KickliterJay Kickliter Posts: 446
edited 2008-08-04 01:54 in Propeller 1
What is the minimum clock speed to use FullDuplexSerial at 9600 baud?

Also, are they any naming conventions in Spin? I see methods upper case, lower case; variables with underscores or capitalLetters.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-08-02 18:03
    Don't know for sure what the minimum clock speed is for 9600 Baud. At 80MHz, the maximum Baud is roughly 230K and the relationship ought to be roughly linear even though there's some fixed overhead. I'd say it's somewhere around 4MHz, but I'd experiment and add a "fudge factor", maybe a minimum of 10MHz. The way to answer this would be to count instructions and figure out the longest path for bit to bit timing in the assembly routine, then calculate the instruction time for that path. It's a lot of work.

    I'm not aware of any accepted naming convention. The compiler treats upper and lower case letters as the same.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2008-08-02 18:23
    Some naming conventions I've seen:

    1. CONstant names in ALL_CAPS.
    2. Global VARiables and PUBlic methods Capitalized.
    3. Local method variables in lower case.
    4. PRIvate methods beginning with _underline.
    5. Assembly opcodes and Spin keywords in lower case (except when being discussed in the forum).
    6. Hex literals in lower case.
    7. Multi-capitialized UpperCaseNames and underline-delimited lower_case_names.
    8. Section names (e.g. CON, VAR, etc.) in ALL CAPS.

    These conventions certainly are not universal, though. Individual taste still reigns over accepted standards.

    -Phil

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    'Still some PropSTICK Kit bare PCBs left!
  • TimmooreTimmoore Posts: 1,031
    edited 2008-08-02 20:01
    I looked closely at the fullduplexserial instruction counts one time, the longest rx/tx loop is ~356 instructions. To spot the start bit this needs to be done in under 1 bit time, so 80000000/356 = 225000bps, i.e. about 230K. So for 9600 you are talking about 3.5Mhz.
  • Jay KickliterJay Kickliter Posts: 446
    edited 2008-08-02 22:15
    Thanks guys. I guess I'll stick with 5 MHz then. I need to save as much power as necessary, as this is going into a high-altitude balloon.
  • TimmooreTimmoore Posts: 1,031
    edited 2008-08-02 23:45
    A few things to be aware of:
    One problem fullduplexserial has is it can be late spotting the start bit, which means it will be late picking up the receive bits. Giving it a very low tolerence for senders that send faster than the baud rate. and most senders dont send exactly at the baud rate.
    This tolerence will be lower if the clock is lower, so you may need to adjust the baud rate of the prop around 9600 to get a good sync with the sender.
    pcFullDuplexSerial4FC (on the object exchange) has a rx/tx loop of about 265 instructions with 1 serial port enabled. So if you have problems with FullDuplexSerial at low clock rates, you can try that. Its also possible to reduce the instruction count to ~256 instructions by removing the support for the other 3 ports.
  • Timothy D. SwieterTimothy D. Swieter Posts: 1,613
    edited 2008-08-03 00:26
    A high-altitude ballon? Tell us more about your project Jay, I enjoy reading about near space experiments.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Timothy D. Swieter, E.I.

    www.brilldea.com·- Prop Blade, LED Painter, RGB LEDs, uOLED-IOC, eProto fo SunSPOT, BitScope
    www.sxmicro.com - a blog·exploring the SX micro
    www.tdswieter.com
  • hippyhippy Posts: 1,981
    edited 2008-08-03 00:30
    What about developing your own separate RX and TX objects using more traditional bit-banging and timing techniques which should be much easier to deal with and able to run at lower speed.

    A PICmicro with a system clock speed of 1MHz can handle bit-banged RX or TX at 31250 baud with FIFO buffering and I'd be very surprised if a Propeller Cog couldn't better that given 'waitpxx' and 'waitcnt'.
  • Jay KickliterJay Kickliter Posts: 446
    edited 2008-08-04 01:54
    Timothy, we're not doing anything new. Just a classmate and I copying other's high-altitude balloon experiments. If we're sucessful the first time, there's a few original ideas I have in mind. But definitely playing it safe on the first run.

    With the exception of some electronics experience I got from the Navy, this is all new to us. So its really making us learn a lot about micro-controllers, PCB design, RF data communications. All we have so far is a pile of parts on a table and more coming in the mail. I'll post more as the project comes along.

    The hardest thing I've encountered so far is finding EagleCAD templates for all the parts, common stuff like RCA and DE-9 jacks. Do people just draw them themselves?
Sign In or Register to comment.