P2 Learning Path
jrullan
Posts: 168
in Propeller 2
Hello all,
I recently became interested in the P2 (have only tried P1 in a Quickstart board from Radio Shack like 6 years ago) and got a hold on Jon Mac's board and P2 Edge. I am very excited to learn about P2, but upon heading to propeller.parallax.com I noticed that there are quite a good amount of technical documents about the architecture and about the Spin2 language, and another seemingly plethora of software tools to use or try. So being a newbie (this is very different from my Arduino and ESP32 experiences) my question is:
What is the best way to start learning P2 for a newbie such as me?
Do I learn P1 first and then try to come over to the new kid on the block, or do I dive right into the P2 world?
Is there a kind of "Getting Started on the P2" book or document available now or will it be in the near future?
Which of the tools is the recommended approach for a newbie? (I installed the propeller tool 2.3.0.0 alpha)
Is the debug functionality available in Propeller Tool or just on the PNut tool?
Sorry for all the questions at once. I reckon most people here are flying well above me, but I suppose the easier the learning path the more adepts will come and stay.
I recently became interested in the P2 (have only tried P1 in a Quickstart board from Radio Shack like 6 years ago) and got a hold on Jon Mac's board and P2 Edge. I am very excited to learn about P2, but upon heading to propeller.parallax.com I noticed that there are quite a good amount of technical documents about the architecture and about the Spin2 language, and another seemingly plethora of software tools to use or try. So being a newbie (this is very different from my Arduino and ESP32 experiences) my question is:
What is the best way to start learning P2 for a newbie such as me?
Do I learn P1 first and then try to come over to the new kid on the block, or do I dive right into the P2 world?
Is there a kind of "Getting Started on the P2" book or document available now or will it be in the near future?
Which of the tools is the recommended approach for a newbie? (I installed the propeller tool 2.3.0.0 alpha)
Is the debug functionality available in Propeller Tool or just on the PNut tool?
Sorry for all the questions at once. I reckon most people here are flying well above me, but I suppose the easier the learning path the more adepts will come and stay.
Comments
If you are concentrating on spin, then either P1 or P2. Spin is a little different on P2.
If you’re wanting to program in C then there are a few things to think about. P1 has a good set of learning examples from what I understand. There’s not much C for P2 yet, although there is Catalina and flexprop compilers. Both can target P1 and P2.
If you’re wanting to learn assembly (pasm) then P2 is almost a superset of P1. You can dive in to P2 and just use the base instructions easily. However, pasm examples will no doubt be using the more powerful instructions but more obscure instructions. Pasm is reserved mostly for smaller and faster little programs that run in it’s own cog (core or cpu). Generally they will be a driver for a particular interface eg VGA, keyboard, LCD, sensors, etc.
The advantage of spin is that it’s a high level program that makes writing programs easier. You just use pasm drivers written by others mostly more experienced than yourself. This way exposes you to pasm without actually needing to learn it. You can inspect the code to see how it works, and modify it to do some more functions. It’s a great way to learn.
Thanks for your input. In terms of Spin1 vs Spin2, is there a guide that explains the differences between them?
I have a Kindle version of the book: "Programming The Propeller with Spin" that I bought when I was trying to learn the Propeller 1. I suppose I could use that as a reference to some extent, but so far from the examples I see that Spin2 seems to have more friendly named methods (pinwrite... etc). So without having put too much effort yet, I wonder if the differences are too significant.
For example, I saw an example that have the syntax pinwrite(56 addpins 7,...). I couldnt find the explanation for addpins, and the concept of pinfield mentioned in the documentation.
Update:
Ok... I found out some guidance here: Parallax Spin2 Documentation v34u
My understanding is that pinfield can be one of the following: either a specific pin number or a group of pins specified using one of two syntaxes: [63..56] OR [56 addpins 7]
I've made some notes here: http://www.rayslogic.com/Propeller2/PortingP1toP2.htm
Be sure to check out https://propeller.parallax.com/
Getting started, I would recommend the new PropTool and the examples from PNut and what you can find in the new OBEX.
Another great way to go is with FlexProp (used to be called FlexGui) that lets you program in Spin1, Spin2, C, BASIC and combinations of these.
If you're a C purist, the Catalina might be the way to go.
Also, I'd recommend getting the P2 Eval board, of course...
Thank you for your input Rayman.
I find switching over to the P2 a difficult task as the instructions are different the implementation is different and it not as simple as just porting the code over and your ready to go.
I see you mentioned Arduino and ESP32 which are both good C products so if you are looking to stay in C then I would look at FlexProp and learn the C flavor rather then try to learn a new language like SPIN.
There still is a steep learning curve as there is not much developed yet to drive different products in C.
Mike
Mike
I found that 90% of the code I built on the P1 works on the P2 with little or no change.
Thanks to some heavy aliasing on the P2's flexC compiler most things moved over. I did however have to change some inline assembly code and found that the assembly language is a little easier to write then on the P1.
In any case I was able to get everything so far to work with little or no changes.
I did however have to learn how to move my custom libraries over to the flexprop compiler. Since this compiler is a single stage compiler with no linker all the code is compiled at one time. So I was able to setup a custom include area with all of my libraries and they compile in just fine.
No need SPINning my wheels rewriting code.
Mike
I decided to head on to PASM as I found that the propeller ecosystem relies heavily on using a combination of Spin + PASM. Although this program is "another blinky leds" project, it forced me to learn several aspect of PASM along the way that I think are essential for becoming more proficient. This code is probably very inefficient and there are probably better ways of doing what I did but I'll share it anyway in the hopes that someone might find it useful as an example.