Shop OBEX P1 Docs P2 Docs Learn Events
Interested in getting started with the Propeller -- some questions about progra — Parallax Forums

Interested in getting started with the Propeller -- some questions about progra

phi_phi_ Posts: 3
edited 2010-04-06 02:47 in Propeller 1
I'm interested in playing around with the Propeller, mainly because it's such an intriguing architecture and seems to be quite fast as well, but there are a couple of points I need to consider, so I'd like to ask a few questions here.

I'm quite unexperienced with MCUs, so please excuse me if some questions might be weird or even stupid. I've done some (C) coding on 8-bit Harvard-architecture RISCs, though.

First of all, I'm interested in programming the Propeller, not so much in immediate applications. Primarily, this means getting into Propeller programming has to be as cheap as possible, as it's mainly about getting to know the programming languages etc. first, not so much the nice applications you can use it for. The development kits seem to be quite nice, but I honestly just don't care about 80% of their features like TV output at the moment, so it'd be just a waste if I found out I didn't like the way the Propeller is programmed after all.
Having read some of the documentation, I figure I'll just need a P8X32A, a couple of transistors (cf. Serial to Propeller), an external quartz, a serial EEPROM and the 3.3 V power supply to get started. Am I correct or do I need more? I do have an RS232 port on my PC, so I guess I won't run into problems with USB->RS232 converters. Availability of the Propeller chip here is so-so, but the development platforms are hard to get, so building a minimal setup "from scratch" would actually be more convenient as well.

I'm mainly interested in the Propeller for two reasons. First, it's a Multicore design (interesting by principle), second, a von-Neumann architecture (which allows for self-modifying code). The manual states all assembly code is directly run from cog ram, which seems to be rather small for large projects. Is it feasible to dynamically load additional program code at runtime, or should the architecture's property to keep code and data in the same ram not be exploited? Are there operations to quickly copy sequential amounts from hub ram into cog ram, or does this need to be done one word at a time?

Can the external EEPROM be larger than 32 K or will the Propeller only accept 32 K EEPROMS? (Of course, since it doesn't have more than 32 K of ram, program data will be limited to 32 K, but the remaining space could be used for logging, etc.) If so, will the EEPROM's entire contents be cleared when uploading a new program to the Propeller?

I expect to make plenty of mistakes when programming (at least until I've mastered the platform), so I'll need a decent debugger that will ideally let me view register contents and single-step through the code. What software can be recommended for this?

Thanks for answering my questions!

Comments

  • mparkmpark Posts: 1,305
    edited 2010-04-02 04:55
    You can actually do without crystal and EEPROM to start. EEPROMs bigger than 32k are fine; only the first 32k is written when you download a program.
  • potatoheadpotatohead Posts: 10,261
    edited 2010-04-02 05:26
    Well, you can use viewport to debug lots of things on the Propeller.

    On the COG memory, yes, you can do lots of tricks. One is to load bits of code into the COG, then run them. Another is to write a kernel in your COG, that fetches instructions from the HUB, and executes them as native instructions, fetching, executing, fetching, etc... That is called LMM, and a lot of tools and code for doing this is out there, and I think you will find that quite interesting.

    Finally, since the COGs all run independent of one another, you can mix up, PASM, SPIN, LMM and have the chip doing lots of things, using the different means of running programs. SPIN, as you probably know now, is an intrepeted language, where the program exists as a byte code in the HUB, executed by the COG. SPIN programs can interface with other PASM / LMM programs using the shared HUB memory for that purpose.

    When a COG is started, it's memory space is filled from the HUB, and once running, can over write that memory space, freeing it for buffers and such.

    On the matter of self-modify code, it's the norm on Propeller, for indexing, as well as other things. Not only is self-modify code possible, but there are instructions that make this task straight forward, for the most part.

    One thing I find quite interesting is the COG memory isn't specialized at all. There are simply memory addresses, and the program. The only "registers" in the thing are the control registers for pin states, counters and such, the PC, and flags. Your program simply uses the COG memory as storage, or program, or both as you see fit. The end result of this is a very clean, compact and flexible assembly environment.

    It was noted that you don't need the EEPROM, so long as you just want to load a program and run it.

    You might download GEAR, for a nice Propeller simulation. It's slow, but can directly use output from the IDE. That can give you a taste of the thing, and it's able to simulate the executing of things. I found it helpful.

    Edit( Did anyone see the block of text this was last night? I posted it here from a PS3, just goofing around. Looked fine on the screen, looked fine on view after post. Came in this morning to one BIG FAT PARAGRAPH, hit edit, saw the original formatting, hit "submit", and all is good. Weird.)

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Propeller Wiki: Share the coolness!
    8x8 color 80 Column NTSC Text Object
    Safety Tip: Life is as good as YOU think it is!

    Post Edited (potatohead) : 4/2/2010 7:12:45 PM GMT
  • HumanoidoHumanoido Posts: 5,770
    edited 2010-04-02 06:47
    You can do without the power supply by using just a couple of simple AA batteries.
    You can make those batteries last ages and ages by foregoing the quartz and using the internal rc.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    humanoido
    *Stamp SEED Supercomputer *Basic Stamp Supercomputer *TriCore Stamp Supercomputer
    *Minuscule Stamp Supercomputer *Tiny Stamp Supercomputer *Penguin with 12 Brains
    *BASIC Stamp Supercomputing Book *Three Dimensional Computer *StampOne News!
    *Penguin Tech *Penguin Robot Society *Toddler Humanoid Robot Project
    *Ultimate List Prop Languages *Prop-a-Lot *Propalot Stuff *Prop SC Computer
    *Prop IB Hypercomputer - under development *Hobby Space Program
  • Nick McClickNick McClick Posts: 1,003
    edited 2010-04-02 08:18
    I did a super-basic breadboard setup and demo program at http://www.instructables.com/id/Programming-the-Propeller-Microcontroller/

    Here was my breadboard wiring;
    4473448249_98f2907f0e.jpg

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Propeller Forums RSS Feed!

    Gadget Gangster - Share your Electronic Projects
  • heaterheater Posts: 3,370
    edited 2010-04-02 09:18
    One of the wonderful things about the Prop is that you can start with almost nothing but the Prop.
    I originally threw together a circuit as shown by Nick McClick soldered on perf board and used the transistor programming interface you mentioned. That instantly gives you confidence that the thing works and you can program it.

    Next up add a crystal, some LEDs, the TV output resistors, SD card, whatever you want step by simple step.

    Despite what you say, it is dead easy to add the TV out circuit and is a great way to impress your friends for almost no effort. It also makes a great debugging output device.

    I managed to create a emulation of an entire CP/M computer on the Prop using such a simple set up.

    Do work you way through all the Spin/PASM examples you can find in the manual and elsewhere. Then look into the wonderful world of LMM (large memory model) and overlays for COG code.

    Have fun.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    For me, the past is not over yet.
  • phi_phi_ Posts: 3
    edited 2010-04-04 16:19
    While I'm finding out where to buy the parts, I'd be quite interested in some characteristic examples of Propeller Assembly, especially concerning self-modifying code.
    Could you please point me to some ressources for that?

    Also, has anyone made some comparable measurements of the Propeller's performance yet (Dhrystone, CoreMark, etc.)?
  • potatoheadpotatohead Posts: 10,261
    edited 2010-04-04 16:34
    http://forums.parallax.com/showthread.php?p=668559

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Propeller Wiki: Share the coolness!
    8x8 color 80 Column NTSC Text Object
    Safety Tip: Life is as good as YOU think it is!
  • Mike GreenMike Green Posts: 23,101
    edited 2010-04-04 18:22
    The Propeller is designed as a microcontroller, not as a general purpose computer. Tests like Dhrystone really don't mean much so, unless some individual is curious enough about the test to put the effort in to implement it, you'll probably not see it. Much more important are specific implementations of functions. Even there, it's difficult to compare the Propeller to other microcontrollers that might have specific I/O devices built into the chip like a UART or a USB host interface. Both can be done and have been done. The details of the UART performance depend on exactly what's implemented. If you need a full duplex serial channel, one Propeller cog can handle over 230KBaud. A half duplex channel can be done at over 1MBaud. If you need support of handshaking, the maximum speeds are a little lower. If you want to have multiple channels using just one cog, the maximum speeds are lower still.

    The Propeller can do multichannel speech synthesis (with pitch controls for singing) with the channels distributed within a synthesized stereo space. It can emulate a Bell-202 or CCITT V.23 modem. It can also emulate a complete Z80 computer including hard disks and display and keyboard interfaces at speeds on the order of the original device.
  • Mike GreenMike Green Posts: 23,101
    edited 2010-04-04 18:40
    To answer your other questions:

    You can use EEPROMs up to 128K bytes in size (24LC1024B). The bootloader only uses the first 32K. Anything beyond that is untouched by the bootloader. You can attach up to 512K total in EEPROMs to the same I/O pins (28/29) whether 4 x 128K or 8 x 64K. You can also attach other types of I2C devices (like a Real Time Clock or an I/O expander) to the same I/O pins as long as you provide the necessary I/O routines.

    There's no "block transfer" between the cog and hub memory except for the initial loading of the cog memory from hub memory on a COGINIT or COGNEW instruction. You can write an optimal loop that would transfer 4 bytes (one long) every 16 system clock cycles in either direction, but the cog area has to be at the beginning of the cog's memory.
  • Cluso99Cluso99 Posts: 18,069
    edited 2010-04-05 06:54
    Nick - that is a really nice and simple setup there for beginners (with bypass caps too at the ends of the rails but this should be fine - look like 1uF tantalums) smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Links to other interesting threads:

    · Home of the MultiBladeProps: TriBlade,·RamBlade,·SixBlade, website
    · Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
    · Prop Tools under Development or Completed (Index)
    · Emulators: CPUs Z80 etc; Micros Altair etc;· Terminals·VT100 etc; (Index) ZiCog (Z80) , MoCog (6809)·
    · Prop OS: SphinxOS·, PropDos , PropCmd··· Search the Propeller forums·(uses advanced Google search)
    My cruising website is: ·www.bluemagic.biz·· MultiBlade Props: www.cluso.bluemagic.biz
  • heaterheater Posts: 3,370
    edited 2010-04-05 10:05
    Having heard so much about people popping the PPLs on the Prop and that it's probably due to incorrect wiring of the power and ground pins isn't it a good idea to hop wire links over/under the Prop chip on that breadboard layout? Linking the two power pins together and two ground pins.

    I've never had such a problem, just a thought.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    For me, the past is not over yet.
  • kwinnkwinn Posts: 8,697
    edited 2010-04-05 14:08
    phi_, I would suggest a more complete system like a basic protoboard and the prop plug if you are interested in programming and are new to the hardware area. Total before taxes and shipping is $49.98. The only additional item you will need is an AC adapter for power and a USB port on your computer. Going this route can save a lot of headaches you may have assembling your own system on perf or prototyping boards.
  • phi_phi_ Posts: 3
    edited 2010-04-06 02:47
    Thanks a lot for the help so far! I really appreciate it.

    Getting the propeller boards here is a bit of a hassle, not so much just getting the chip. I'd probably buy it for the equivalent of $50 if it were easily available, but since a working bare-bones Propeller platform can be created on a breadboard with next to no components I won't bother and just build it myself.
    I have a working RS232 port on my computer, so usb adapter compatibility--the main reason, besides not having to modify an adapter yourself, for getting a prop plug--isn't of much concern. Because I don't have any fancy video hardware to connect it to anyway, a very minimal system will suffice for evaluating the Propeller, getting used to programming and seeing if it suits my coding style.

    Post Edited (phi_) : 4/6/2010 3:42:53 AM GMT
Sign In or Register to comment.