Question about I/O Architecture
nick112147
Posts: 42
··· I have a question about the I/O architecture of the Propeller microcontroller. Are all of the I/O pins serial(P0-P31), or just P28-P31? Any help is greatly appriciated. Thanks,
Nick
Nick
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
Longer answer : All pins 0-31 can be anything you want them to be once your program starts running; inputs or outputs. When booting from Eeprom and downloading from PC the pins have a special purpose, but as soon as booting and download is complete they are turned back to inputs. You can do anything you want with them after that. To use them for serial you will need some software which interfaces with those pins to send or receive serial data.
Nick
-Phil
In response to Mr.Green: So I wouldn't even need a real OS, since all of the routines exist in firmware form. what is even better because I don't want to bog down the processor. I am extremely new to the Propeller, what mainstream processor can I compare a cog's processing·to, a·Motorola 68K·or an early/newer x86?
Post Edited (nick112147) : 3/5/2008 1:42:23 AM GMT
Nick
I believed this, and is it true to a point, but... I tried to use 28 and 29 for propeller to propeller communication via FullDuplexSerial. This worked, but I ran into a lot of trouble with a reboot of one of the propellers sending the contents of the EEPROM to the other propeller. Also programming the EEPROM without disconnecting the other propeller was problematic. So you can use these pins after bootup, but you need to be careful of how you do it.A GOTCHA that got me. -Chuck-
Nick
More flexible code ( buffered, background receive and so on ) exists, as Mike says, as free to download and use "objects".
In my current project I use pins 1 and 2 for full duplex serial communication with a zigbee link to my laptop, pins 26 and 27 for full duplex serial communication with another propeller, and pin 8 for a half duplex serial connection to a GPS module. -Chuck-
@Hippy: I like that! However I am an ASM man myself, for the fact that I want all system level programming (drivers, BIOS, everything that is NOT the game) to be as fast as physicaly possible. While SPIN seems fast, it is interpreted in real time. Interpretation is slow, and since games are resource demanding little demons, every ns counts, because I know that having the SPIN interpreted for complex AI or graphics routines from an external GPU will as several ns to the overall execution time.
@Mr.Rice: Awsome. Thanks for the information Mr.Rice. I think this processor will serve me better than my original chioce of using a motorola for the CPU of my console. I really like the idea of using 2 processors. Has anyone ever considered using a different CPU rather than another propeller, say a Z80 or something basic like that?
I've found the Propeller ideally suited to rapid development and early prototyping, more so than other processors. It really does suit the "get it working, rewrite and optimise later if necessary" model. Only when limitations arise is ones hand forced into using PASM and heavy optimisations. On other processors tight, efficient coding may be required from day one which can be a major obstacle to getting a first prototype working, and it's a lot of potentially wasted effort if a brick wall is hit and a redesign is needed.
Your questions don't bother us, it's a novel enough architecture that everyone has questions when they first look at it.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
Post Edited (Paul Baker (Parallax)) : 3/5/2008 4:47:13 AM GMT
Be careful about the "assembly for everything because of its blinding speed". Each cog has only 496 x 32 bit words for instructions and data (plus 16 special purpose registers). Spin serves as a sort of scripting language to tie together the assembly language "functions" and is a quite powerful enough programming language in its own right. The Spin interpreter will run in a cog by itself and interpret byte codes in the main memory with data in the main memory and is fast enough to do 19.2KBaud half duplex serial I/O without the use of assembly.
Each cog has two special counters that can be used to measure pulse widths to a resolution of 12.5ns (with an 80MHz system clock) or generate pulses with the same resolution and these counters can be controlled from Spin.
Post Edited (Mike Green) : 3/5/2008 5:11:50 AM GMT
I suppose using ample amounts RAM as intermediate between all of the devices versus directly connecting them to a serial port I program on the chip could solve the problem. One cog dedicated to SPIN, two to three for the GPU, one should be sufficient for sound, and the other 3 can be used as support. I am liking Mr.Rice's use of two processors connected via a serial bus. Out of curiousity, has anyone ever succesfully interfaced a CDROM drive with a Propeller? I hate to use ROM cartriges, they are bulky and quite expensive to make. Thanks again for all of the replies, the amount of help I am recieving is astounding. Thanks,
Nick
You should take a look at some of the games posted up in the HYDRA section of this forum. The main game logic runs easily in SPIN, while the lower level GFX, sound and I/O, run as assembly language programs, each in their own COGs. It all happens on one chip!
Because those choices are made in software, you get to make all the trade-offs without having to do core hardware (re)design in so many cases. It's also totally useful to use more than one Propeller, treating each as either a very capable sub-system, or the main CPU as you see fit. That's the beauty of it. Any Propeller can do graphics, sound, I/O, frequency generation, etc... In fact, any COG on any Propeller can do these things at any time, so long as there is enough RAM to handle the task.
A great example of the multiple Propeller approach is the PropGFX system Coley and Baggars are developing. It's a propeller, and one can even program it like any other propeller, with some work. However, the goal is to have it packaged and shipped with the programming already done to act like a very capable GPU. As such, it can be incorporated into many designs, not just Propeller ones. I think a Z80 demo is in the works, showing off doing just that.
For those cases where a given large program won't fit into a COG instruction space, cannot be broken into parallel components (or isn't worth doing that), and has speed requirements that exceed what SPIN can deliver, there are some projects being developed to address that:
There are two main approaches: alternative interpreters, and large memory model assembly code.
The alternative interpreters really won't have a speed advantage over SPIN (I'm pretty sure, who knows?), so just consider them SPIN like, for this discussion and leave it there. They do larger programs, and have other features SPIN does not have, most likely.
The large memory model stuff is interesting though! And it's the focus of a lot of different development efforts. See the Propeller wiki for more on this.
Basically, COGs load up their program from the main HUB memory, which can then be overwritten for other purposes, and begin executing them. That's the model used most often right now. Perfect for I/O, sound, GFX, etc... You only need to get the COG loaded, then it just does it's thing, leaving that HUB memory free for other purposes. So, that's 32K of HUB memory, plus 16K of COG memory, 2K / cog, or 512 longs per COG. If you are careful about how you load, init, and use that memory, you can get above the 32K limit, maybe closer to 48K of RAM instead of 32K.
An alternative is to have the COG load up a smaller assembly language kernel program, which then just fetches and executes assembly instructions from the main HUB memory. The speed of this is somewhere between SPIN and assembly, with the result being probably closer to assembly than SPIN. That larger program then lives in the HUB memory, where it gets executed, piece by piece, by one or more of the COGs, as necessary.
The up and coming Imagecraft C complier is going to use this model.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Propeller Wiki: Share the coolness!
Chat in real time with other Propellerheads on IRC #propeller @ freenode.net
as you say you have some background in assembly programming already it might further (or start) your understanding of how the Propeller works by browsing through my tutorial "Programming the Parallax Propeller using Machine Language":
http://forums.parallax.com/attachment.php?attachmentid=48819
Cartrige GFX/Sound ROM -> RAM -> Any hardware needing to access it.
On the program side, the binary program would go directly into the Propeller, then sending any data it needs to to the second Propeller that "listens" for instructions for controlling the graphics and sound processors.
Cartrige Program ROM -> Propeller #1 -> Propeller #2 -> Sound/Graphical Processors
My design is probably faulty in many ways but it looks like a good starting point.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I am 1010, so be surprised!
You sound like you need a Hybrid www.propgfx.co.uk/forum/Blah.pl?b-hb/m-1192495734/
and a PropGFX www.propgfx.co.uk/forum/Blah.pl?b-PL/m-1198808109/
Coley
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
PropGFX Forums - The home of the Hybrid Development System and PropGFX Lite
@Coley: Nice project! But what is the PropGFX, your own custom chip? If it is, I should mention that I could in no way afford to hire a foundry to make me chips :-(. Forgive my daftness, but it just looks like you are using a custom chip. If it isn't a custom chip, what brand is it? Also, what do you recommend as a graphics coprocessor? For about a year now, I have been searching for a good graphics processor that doesn't require making a million dollar deal with ATI lol. Thanks.
@deSilva: Very nice tutorial, it is helping me alot, I am going to start writing a BIOS tonight. Thanks.
Thanks again everyone, you guys are really helping me with my design!
Nick
The PropGFX is as the name implies a 'Propeller' based 'Graphics' co-processor and it is due to be launched very soon.
It comes in an 'easy to integrate' DIP40 package and is ideal for prototyping.
Regards,
Coley
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
PropGFX Forums - The home of the Hybrid Development System and PropGFX Lite
if you take a look at the picture of
http://www.propgfx.co.uk/forum/Blah.pl?b-hb/m-1192495734/
first you see tha backside of the pcb
there is a chip-id P8X32A-D40 this is the ID of the ORIGINAL PARALLAX PROPELLER-CHIP!
it nothing custumized
and if you take a close look at the other pictures you can see a very slight letters printed on the topside of this chip
especially the picture titled "The Magical Propeller in all it's Glory!"
IT IS the propellerchip !
best regards
Stefan
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
Post Edited (Paul Baker (Parallax)) : 3/6/2008 9:48:16 PM GMT
Post Edited (nick112147) : 3/6/2008 9:59:51 PM GMT