element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      • Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Code Exchange
  • Technologies
  • More
Code Exchange
Blog Easy Multi-Core Development with Spin
  • Blog
  • Forum
  • Documents
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Code Exchange to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: gervasi
  • Date Created: 3 Dec 2012 3:34 PM Date Created
  • Views 983 views
  • Likes 1 like
  • Comments 2 comments
  • Code Exchange
  • spin
  • multicore
Related
Recommended

Easy Multi-Core Development with Spin

gervasi
gervasi
3 Dec 2012

Spin is the high-level language used to program the Parallax Propeller processor.  Propeller is an embedded microprocessor with eight (8) cores.  The cores are called “cogs”.  The Spin language has commands for assigning code to certain cogs so you can have tasks running truly in parallel.  This simplifies tasks that would otherwise be handled by interrupts or a multi-tasking operating system.  In fact, interrupts are not even used in Spin.image

 

Advantages to Spin

Spin is in some ways similar to BASIC, but it is structured like C.  This makes it easy to learn. 

 

Spin is the easiest way for someone new to embedded microprocessors to handle multiple tasks.  You can blindly assign different functions to different cogs without worrying about task latency.  The Propeller chip’s cogs are truly running in parallel.  It’s not a software abstraction.  The developer has control over eight (8) processors, each running at 80MHz. 

 

The development tool is easier than average to get going.  It’s less powerful than Code Composer Studio, but it’s more straightforward to get running.

 

Disadvantages image

The biggest disadvantage to Spin is efficiency.  Driving a single GPIO line high and then low takes about 50 microseconds, which is an astounding 4000 clock cycles.  In Propeller Assembly (PASM) it takes 200 nanoseconds, which is 16 clock cycles.  Spin makes provisions to insert assembly code easily into a program.  The assembly language is about average difficulty as assembly languages go. 

 

If your application is simple enough that you only need one core, Spin is a little harder to use than C.  This disadvantage relative to C goes away as soon as you need to multitask, though, because Spin makes it easy to assign a task to a cog.

 

The Propeller chip does not have a hardware serial controller.  All asynchronous serial (UART), SPI, and I2C communication must be bit-banged.  Bit-banging ties up a processor, but the Propeller chip has eight (8) processors, so this is not as bad as big-banging on a single-core microprocessor.

 

Eight cogs sounds like a lot, but many everyday tasks, such as doing big-banged PWM on one pin while monitoring another pin, require more than one cog.  On a complicated project, you quickly start running out of cogs.

 

Although the free development tool is easy to use, it is not an IDE that supports breakpoints.  This is not as troublesome as it sounds because it’s easy to have one cog reporting status information through the serial port.  There is an advanced development tool called ViewPort that provides typical IDE features like runtime stepping, breakpoints, and memory value display.

 

Getting Started

The fastest way to get started is with the Propeller Demo board.  I has ports for PS/2 keyboard and mouse, RCA video, audio, USB (with FTDI serial chip), and VGA.  The RCA video uses four (4) GPIO ports connected to different resistor values to create a 4-bit DAC.  The video quality is amazingly good.  You wouldn’t suspect such a crude DAC drives the output.

image

If you need access to all Propellers GPIO, you can use the Propstick, which has a USB port for debugging and breaks out every pin on the Propeller chip to pins that can plug into a standard 100-mi-pitch breadboard.

 

The Parallax website has a good deal of sample code and great forums with people eager to answer questions. 

 

Writing Spin for the Propeller chip is the fastest way for a beginner to get started doing projects requiring multiple low-latency tasks. 

  • Sign in to reply
  • Former Member
    Former Member over 13 years ago

    Have a look @ SimpleIDE

    https://sites.google.com/site/propellergcc/documentation/simpleide

     

    There is a version in the works that runs directly on the PI itself

    http://forums.parallax.com/showthread.php?141469-SimpleIDE-for-Raspberry-Pi-Raspian

     

    And now GCC- C/C++ for the prop

    https://sites.google.com/site/propellergcc/home

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • DAB
    DAB over 13 years ago

    When I began playing with embedded processors again, I took a long look at the Propeller.

    It has some very interesting features, but their interpreter took a lot of processing cycles, which is why I looked else where.

    ParalIax has a wealth of support for the device and the chip itself is an interesting approach to multi-tasking/multi-core processing.

     

    I suspect that the Propeller board would be a great learning tool, but once you get to understand threading using interrupts, you can do more with single core chips.

     

    Just my opinion,

    DAB

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube