Shop OBEX P1 Docs P2 Docs Learn Events
Experimental P2.spin? — Parallax Forums

Experimental P2.spin?

The P1 had such good documentation...I am really struggling with the new P2. It looks like the Propeller Tool comes with a debugger for the P2. In the RUN menu, I checked ENABLE DEBUG. From there, I think you're supposed to press CONTROL + F10 to start the Debugger? However, all I ever get is a message that states "Cannot find source file: Experimental P2.spin".

Comments

  • RaymanRayman Posts: 13,711
    edited 2024-01-13 15:15

    I made a little getting started guide that should be pretty generic for all P2 boards (more or less).
    Might explain a few things...
    https://www.rayslogic.com/Propeller2/SimpleP2/SimpleP2Plus/SimpleP2Plus_GettingStarted_Rev.1a.pdf

    If it helps and you have any feedback, please let me know...

  • RaymanRayman Posts: 13,711

    Also, I've been using a new version of serial "SimplestSerial.spin2" that works with the debug window.
    There are a couple of caveats to using it, such as when using with Spin2 debug commands and when launching new cogs, but it's been pretty convenient...

  • RaymanRayman Posts: 13,711

    Also, note that I don't think you can include P1 type .spin files in Prop Tool. Can with FlexProp though...

  • Thanks for your comment Rayman. Is "SimpleP2Plus" a program you wrote? I was under the impression that the Propeller Tool comes with a built in debugger for Spin2 programs. It is this feature that I am trying to invoke.

  • RaymanRayman Posts: 13,711
    edited 2024-01-13 16:33

    So, one has to include a "debug" statement in the code to invoke the debug window.
    If you see step#11 in the above, including the "SimplerSerial" object will invoke the debug window because it includes a debug statement in one of it's methods...
    That code download should work for you, but you probably want to change the LED pins to 56&57 if using a Parallax board...

  • @3dogpottery said:
    However, all I ever get is a message that states "Cannot find source file: Experimental P2.spin".

    When you hit control when loading, it will try to load your set top file. Either don't hold control to load the current file or right click the tab of your top file (the one that is your main program) and set it as top file.

  • 3dogpottery3dogpottery Posts: 76
    edited 2024-01-13 16:59

    @Wuerfel_21 said:

    @3dogpottery said:
    However, all I ever get is a message that states "Cannot find source file: Experimental P2.spin".

    When you hit control when loading, it will try to load your set top file. Either don't hold control to load the current file or right click the tab of your top file (the one that is your main program) and set it as top file.

    Thanks for your reply. "Experimental P2.spin" is not my program. The message "Cannot find source file: Experimental P2.spin" is generated by the Propeller Tool. Even if I tried to debug a simple "Hello world" program, the same statement is generated. I am thinking that my attempt to single step a program is beyond my pay grade. With the Propeller 1, I used PSAD and was able to troubleshoot my assembly code with ease.

  • @3dogpottery said:
    Thanks for your reply. "Experimental P2.spin" is not my program.

    I was your program at some point, when you set it as your top object and forgot about doing that. The Propeller Tool remembers that across sessions.

  • RaymanRayman Posts: 13,711

    Inline assembly is a cool new P2 feature that makes it easy to test out assembly inside Spin2 PUB sections...

  • RaymanRayman Posts: 13,711

    Thinking it'd be better if the "Top Object" thing was a feature that comes disabled by default... Seems to cause trouble...

  • RaymanRayman Posts: 13,711

    Single stepping assembly is something I haven't done myself, but how to do it is described in the Spin2 documentation:

    There is also a single-stepping PASM debugger which can be invoked via plain DEBUG statements which do not contain any parameters within parentheses. Debugging is initiated in PNut by adding the Ctrl key to the usual F10 to 'run' or F11 to 'program', or in PropellerTool by enabling Debug Mode with Ctrl+D then using F10 or F11 as is normal. This compiles your application with all the DEBUG statements, adds the debugging program to the download, and then brings up the DEBUG Output window which begins receiving messages at the start of your application.

  • JonnyMacJonnyMac Posts: 8,894

    Inline assembly is a cool new P2 feature that makes it easy to test out assembly inside Spin2 PUB sections.

    It's one of my favorite features, and can also be used to with timing-critical code that can't be done in pure [interpreted] Spin2. For example, one can use inline assembly to update WS2812b pixels without invoking a separate cog. I find this useful in projects that only use a few pixels as indicators.

  • @Wuerfel_21 said:

    @3dogpottery said:
    Thanks for your reply. "Experimental P2.spin" is not my program.

    I was your program at some point, when you set it as your top object and forgot about doing that. The Propeller Tool remembers that across sessions.

    Now that you’ve said that, I think you are correct. I seem to remember naming some silly attempt at a program that.

  • @Rayman said:
    Single stepping assembly is something I haven't done myself, but how to do it is described in the Spin2 documentation:

    There is also a single-stepping PASM debugger which can be invoked via plain DEBUG statements which do not contain any parameters within parentheses. Debugging is initiated in PNut by adding the Ctrl key to the usual F10 to 'run' or F11 to 'program', or in PropellerTool by enabling Debug Mode with Ctrl+D then using F10 or F11 as is normal. This compiles your application with all the DEBUG statements, adds the debugging program to the download, and then brings up the DEBUG Output window which begins receiving messages at the start of your application.

    Thanks Rayman for the help. You know, I’ve actually done that and a very colorful window pops up with lots of arcane information. I can also see a particular line of code highlighted. However, when I try to single step to the next line code, nothing happens. I’ve read lots of the P2 documentation, but somehow haven’t run across any single stepping directions. However, I will try to do this again.

  • 3dogpottery3dogpottery Posts: 76
    edited 2024-01-14 13:31

    @JonnyMac said:

    Inline assembly is a cool new P2 feature that makes it easy to test out assembly inside Spin2 PUB sections.

    It's one of my favorite features, and can also be used to with timing-critical code that can't be done in pure [interpreted] Spin2. For example, one can use inline assembly to update WS2812b pixels without invoking a separate cog. I find this useful in projects that only use a few pixels as indicators.

    Ok, it’s Jon for sure! Hey, I’ve been watching your SPIN2 for Beginners Series and am learning a lot. You must be a frigging genius. I’ve been analyzing your jm_i2c in-line assembly code to get a feel of how P2 assembly differs from P1 assembly. I haven’t figured out yet why you pass the last acknowledge to the read routine when it doesn’t get used within that particular piece of code. I’m sure I’m missing something. Well, I just turned 75 and my brain gets a little fogged at times.

  • JonnyMacJonnyMac Posts: 8,894

    I’ve been watching your SPIN2 for Beginners Series and am learning a lot.

    Excellent. I'm sure those presentations would be better if I did them now.

    You must be a frigging genius.

    Uh, no -- just a guy who likes to code Propeller chips.

    I haven’t figured out yet why you pass the last acknowledge to the read routine when it doesn’t get used within that particular piece of code.

    It does right here:

    .put_ack                testb     ackbit, #0            wc      ' ackbit.[0] --> c
                            drvc      sda                           ' c --> sda
    

    I've attached my latest code in case you have something older that I may have miscoded.

  • @Rayman said:
    I made a little getting started guide that should be pretty generic for all P2 boards (more or less).
    Might explain a few things...
    https://www.rayslogic.com/Propeller2/SimpleP2/SimpleP2Plus/SimpleP2Plus_GettingStarted_Rev.1a.pdf

    If it helps and you have any feedback, please let me know...

    Thanks Rayman for your help. Actually, I am very familiar with the P1 and have been coding for years. What I really liked about the P1 was the ability to single step through my PSAM code using a little program called PASD. You are probably familiar with it; You could examine registers and see exactly what your assembly code is doing. In the Spin2 Language Documentation, there is a section titled "DEBUG". Within this document, it plainly states that "There is also a single-stepping PASM debugger which can be invoked via plain DEBUG statements which do not contain any parameters within parentheses." Well, I've tried and tried to get this "debugger" to work to no avail. Even when this very colorful debugging window appears, it is inert. Even if it did work, it appears very small with no way to increase font size, etc. I even downloaded this app called "PNut". From there, I can actually get this "debugger" looking like it is running code, but again, it appears so tiny on my screen that I would need a magnifying glass to read it. Additionally, I see no way to single-step through any code. In the P2 documentation, it states that the debugging environment is intuitive! Man, I guess I don't have a shred of "intuition".

  • RaymanRayman Posts: 13,711

    Guess there should be a guide for using the single step debug feature…
    It’s a nice feature.

  • RaymanRayman Posts: 13,711

    I think Chip has a video of him using it somewhere. Would be good to find…

  • 3dogpottery3dogpottery Posts: 76
    edited 2024-01-21 17:40

    @Rayman said:
    Guess there should be a guide for using the single step debug feature…
    It’s a nice feature.

    Thanks for the feedback Rayman. There actually is a "guide" for using the single step feature. It is in the "Parallax Propeller 2
    Spin2 Language Documentation" under the heading "PASM-Level Debugger". However, when it is deployed, the debugging window is frozen. This was confirmed by Jon McPhalen. He suggested that I use PNut to debug, and I actually got it to work. The debugging GUI is supposed to be "intuitive", but I find it highly confusing. The GUI is very small and there is no way to zoom in. I wish the guy that wrote PASD for the Propeller 1 could add the P2. It is an excellent debugger that shows cog registers and main memory.

  • RaymanRayman Posts: 13,711

    It seems like the P2 PASM-level debugger is similar to PASD for P1.
    Also seems like PASD could be made to work for P2. But, there are some P2 instructions like REP, etc. that would probably mess it up...

  • 3dogpottery3dogpottery Posts: 76
    edited 2024-01-22 19:11

    @JonnyMac said:

    I’ve been watching your SPIN2 for Beginners Series and am learning a lot.

    Excellent. I'm sure those presentations would be better if I did them now.

    You must be a frigging genius.

    Uh, no -- just a guy who likes to code Propeller chips.

    I haven’t figured out yet why you pass the last acknowledge to the read routine when it doesn’t get used within that particular piece of code.

    It does right here:

    .put_ack                testb     ackbit, #0            wc      ' ackbit.[0] --> c
                            drvc      sda                           ' c --> sda
    

    I've attached my latest code in case you have something older that I may have miscoded.

    @JonnyMac said:

    I’ve been watching your SPIN2 for Beginners Series and am learning a lot.

    Excellent. I'm sure those presentations would be better if I did them now.

    You must be a frigging genius.

    Uh, no -- just a guy who likes to code Propeller chips.

    I haven’t figured out yet why you pass the last acknowledge to the read routine when it doesn’t get used within that particular piece of code.

    It does right here:

    .put_ack                testb     ackbit, #0            wc      ' ackbit.[0] --> c
                            drvc      sda                           ' c --> sda
    

    I've attached my latest code in case you have something older that I may have miscoded.

    Regarding my comment about the acknowledge parameter not being used in an i2c read, I was under the misapprehension that only the slave device generated the ack or nack. After re-examining the users manual on the MPU6050, I see that it is the master that sets the ack or nack after a read. I believe I now understand why you pass an acknowledge parameter in your read method.

Sign In or Register to comment.