Shop OBEX P1 Docs P2 Docs Learn Events
Help with Propeller Tool and Serial terminal — Parallax Forums

Help with Propeller Tool and Serial terminal

This discussion was created from comments split from: Welcome to the P2 - PASM2 and SPIN2 code category!.
«1

Comments

  • Serial terminal only works with flexprop C code. None of the examples in Spin2 work for the P2 Eval board for serial / debug output.

    Very little to no support available. Is not backwards compatible to P1 code, not to mention random syntax changes.

  • @zlantz said:
    Serial terminal only works with flexprop C code. None of the examples in Spin2 work for the P2 Eval board for serial / debug output.

    Very little to no support available. Is not backwards compatible to P1 code, not to mention random syntax changes.

    Serial terminal works with every language.
    Some SPIN2 examples might be targeted for certain boards, but most will work on all P2 boards.
    Support is available- you only need to ask.
    As the system is developed, some changes will be made to improve.
    Code is not supposed to be fully backward compatible- that has been made very clear from the outset because the P2 is far more powerful then P1, and has many new features.

    If you have any specific questions or need help to achieve something, please start a new thread and ask for help.

  • Serial terminal only works with flexprop C code. None of the examples in Spin2 work for the P2 Eval board for serial / debug output.

    If you're using Propeller Tool you can press F12 to launch PST (Propeller Serial Terminal) to work with your app. I write a lot of public demos -- all of them are in Spin (1 or 2) and all work with PST. Some of my more recent programs have added ANSI support to allow FlexProp users to run my programs.

    The P1 and P2 are different, and yes, there are some code modifications. Those of us who use Python had to make adjustments going from Python 2 to Python 3. Progress means that these things sometimes happen.

  • zlantzzlantz Posts: 136
    edited 2021-12-18 23:41

    I have used the P1 for many years with great success. Spin1/PSAM1 is easy to handle and everything ~mostly works~. Spin2 is a bit of an offshoot (requiring massive re-writes) and you just cannot use Spin1 and expect it to still work with Spin2 as many functions don't exist any more (or have new parameters - or needs a complete changeover) - both Spin and PASM [for instance "JMPRET" ASM P1 does not have an equivalent to P2 ASM] and now this function cannot be ported from P1 to P2.

    I have the P2 Eval board Rev C and none of the serial/terminal demos work with this board. I have literally tried every example instance that exists with 100% failure. I can get everything else to seemingly work (with no way to really know for sure) but serial terminal/debug is out of the question in Spin2... though it works perfectly fine with FlexC.

    On my old P1 boards, every instance of Serial I/O works just fine. Why is it that every example for the P2 does not work except for in the FlexC language?
    Not a single Spin2 example of Serial / Terminal / Debug works with the P2 Eval Board Rev C.

    Its been quite a challenge to switch from P1 to P2. I have spent multiple months trying to get a simple serial output to work and yet nothing works. Other functions seem to work fine but there is no way to confirm without a serial data output function.

    So far it seems the P1 is the only viable solution and I should look at linking two chips together instead of trying to get the $150 P2 Eval to work.

    I did not expect to have to switch to FlexC to get Terminal to work instead of simply just using Spin2 for the same purpose. Now I have to re-write everything into FlexC if I want to migrate my projects from P1 to P2. This is a bit ridiculous.

    I would have to say, it has been the most frustrating upgrade I have ever done in my life & I still question if it is even possible. It might be better to link 2x P1 chips together vs trying to get 1x P2 to work.

    PST does not output data from the P2 Serial output function... Or there is something wrong with every example presented. PST stays a blank screen with every example attempted.

    It would be great to get this chip working as I had graciously waited for its release many years past when it was said to be first released.

  • msrobotsmsrobots Posts: 3,701
    edited 2021-12-18 23:50

    @zlantz,

    I am seriously confused, I can run any available serial in SPIN 2 using PropTool or FlexProp and had never any problems.

    My guess is that this is not P2 related. FlexC uses it's own Terminal, PropTool uses PST.

    Maybe your PST is borked?

    Test as follow. Program P2 with FlexC and verify output with Flex build in terminal.

    close Terminal

    Then Open PST on the same port baud settings and see if the output is visible. If not PST might be borked.

    • not sure if closing the terminal resets the P2 -

    try,

    Mike

  • zlantzzlantz Posts: 136
    edited 2021-12-19 17:03

    Hi Mike,

    PST seems to work just fine with any and all P1 codes... but P2 it just stays blank. If i code a very very basic HelloWorld in FlexC it works with the built in Debug terminal and PST (but not in Spin2 in any fashion). Instead it is just a blank screen the entire time.


    As a simple example... this works 100%:


    include <stdio.h>

    int main(void) {
    while (1) {
    printf("Hello, world!\n");
    }
    return 0;
    }


    But this works 0%:


    CON

    CLK_FREQ = 200_000_000 ' system freq as a constant
    MS_001 = CLK_FREQ / 1_000 ' ticks in 1ms
    US_001 = CLK_FREQ / 1_000_000 ' ticks in 1us
    _clkfreq = CLK_FREQ ' set system clock

    OBJ
    jSer : "jm_serial"

    pub main ()
    jSer.start(115200)

    repeat
    jSer.fstr0(string("test string\r\n"))
    waitus(100)

    Idk how to make this webpage format the code right... I used proper indentations as required - posting ~here~ re-formats what I have copied and messes it all up.

  • Do note that the Flex compiler has full Spin2 support (and can even do Spin1-on-P2, with some caveats).

  • zlantzzlantz Posts: 136
    edited 2021-12-19 00:46

    @Wuerfel_21 said:
    Do note that the Flex compiler has full Spin2 support (and can even do Spin1-on-P2, with some caveats).

    I have downloaded some codes to try and attempt this... I didn't intend to switch to the P2 only to have to use a P1 interpreter to run a serial terminal on the P2 so that it works. P2 should have a working terminal / serial / debug output function just like the P1 did that operates on the Spin2 language. Its really hard to wrap my head around using a P2 chip with P1 code that uses an interpreter to function on the P2 chip... Why cannot I just program P2 code directly to the P2 chip?

  • RaymanRayman Posts: 13,800
    edited 2021-12-19 01:06

    @zlantz It should work, but there are nuances... Sometimes, with Prop Tool, the name of the file is important. Spin1 files end in .spin and Spin2 files end in .spin2.

    If you have FlexProp IDE, try the fibo.spin2 example. That has serial output.

    BTW: FlexProp has it's own serial terminal and isn't intended to work with PST, but you could probably make it work with PST.

  • AribaAriba Posts: 2,682
    edited 2021-12-19 01:19

    Do you try that Spin2 code with flexProp or the with PropTool?
    If flexProp, have you set the Baudrate to 115200 in the Menu?
    Have you tried the Examples in the samples directory of flexProp that do serial communications (mostly with SmartSerial)?

    We all use Serial communications with the P2 since forever, with PNUT, PropTool, flexProp, with Basic, with Spin2, with C, with TAQOZ, with microPython and other languages. Without it you could not develop and debug all the code that got made so far.

    BTW: You should use waitms(100) not waitus().

  • zlantzzlantz Posts: 136
    edited 2021-12-19 02:08

    So, with Propeller IDE (P1/P2) its easy to code in, but apparently I then need to copy that code into a different compiler to transfer the data to the chip/flash such as PNut or flexprop because the Propeller IDE compiler doesn't work as it was intended? Totally unexpected but I can work with that...

    When I try to do this, the program that would have no problem compiling in the PropIDE has many errors in flexprop and cannot compile but has zero problems in the Propeller Tool IDE with the exact same code.

    I corrected the us/ms mix up but didn't really change anything as the delay does not matter in the functionality aspect. It instead only makes it easier to read. Still no serial in Spin2 but works just fine in FlexC.

    In FlexProp as Spin2 I cannot directly copy code that works fine in Propeller IDE as Spin2 and expect it to work in FlexProp as Spin2. There are too many errors that were otherwise not there with the other IDE to try and make it work.

    Again, it 100% works just fine in FlexProp if I use C as the language but as Spin2 it does not work at all while still using FlexProp for the programming aspect.

  • @zlantz said:
    PST seems to work just fine with any and all P1 codes... but P2 it just stays blank. If i code a very very basic HelloWorld in FlexC it works with the built in Debug terminal and PST (but not in Spin2 in any fashion). Instead it is just a blank screen the entire time.

    In your FlexC example you used the default baud rate (which is 230_400 for P2) whereas for your Spin2 example you used 115_200 for the baud rate. Try using 230_400 for the baud rate in jSer.start(), or else try changing the PST baud rate to 115_200.

    In FlexProp as Spin2 I cannot directly copy code that works fine in Propeller IDE as Spin2 and expect it to work in FlexProp as Spin2. There are too many errors that were otherwise not there with the other IDE to try and make it work.

    Can you show the code? Or the errors? The most likely cause I can think of is that you're trying to use some library files that may be built in to PropellerTool that aren't in FlexProp. You could try some of the sample code in the "samples" directory of flexprop.

  • JonnyMacJonnyMac Posts: 8,912
    edited 2021-12-19 02:35

    While not a user of FlexProp, I do try to keep my training programs compatible with it so those who can't use Propeller Tool can still participate in training.

    This program runs from both platforms. The only change I made from one to the other is use \n with FlexProp in place of \r in PST (PST adds a CR to the NL).

    I believe FlexProp defaults to 230400 baud -- in fact, I adjusted my presentation code to accommodate that.

    The attached archive was last run in FlexProp so it's setup for that but, as I stated, it works fine in both development tools.

    Note: If you're using FlexProp you can comment out these lines:

      wait_for_terminal(true)
      waitms(100)
    

    They allow the programmer to open and enable PST; the FlexProp terminal will auto-open.

  • This is what I get when I run the jm_serial test... It compiles fine and loads to the flash but the serial terminal remains blank.

    Just like with FlexProp, the terminal opens but nothing comes over...

  • well you try to receive one character then sending out the same string repeatly.

    Have you tried running it and hit enter in the top lines of the terminal?

    Mike

  • RaymanRayman Posts: 13,800

    Oh, it's that Wait_for_terminal(), right?

    You don't need that with FlexProp as the terminal window opens right when the code loads.
    That's an advantage over Prop Tool, IMHO.

  • zlantzzlantz Posts: 136
    edited 2021-12-19 16:39

    @Rayman said:
    You don't need that with FlexProp as the terminal window opens right when the code loads.

    This has made some headway in that now both the flexprop term or serial term will show the output data but I have to use flexprop for serial terminal to work as PropIDE compiled code still do not return data. I have tired sending various characters to no success.

    I would very much prefer to use the PropIDE over FlexProp, I am not too fond of the plain white screen and little code coloring. Makes the code harder to read and follow.

    It is great to see a Spin2 serial working, thanks for all the help on that! Now to figure out how to get the PropIDE to work.

    Many pre-writ codes will compile fine with PropIDE but will fail with many errors in FlexProp so to make the switchover everything has to be re-wrote once more. For instance BinFloat needs modified because the NAN value is not allowed in FlexProp but is with PropIDE. Many unknown problems, not sure how to fix. The code looks right. This is part of the not wanting to migrate into FlexProp, the whole starting over once again thing.

    Assuming I could use PropIDE and had a working serial terminal then my code is nearly complete and everything works fine... but if I try to migrate to FlexProp it has hundreds of errors and is impossible to get to compile.

  • VonSzarvasVonSzarvas Posts: 3,273
    edited 2021-12-19 17:01

    Just to be clear... when you mention "PropIDE", are you meaning "Propeller Tool" or something else (such as Propeller IDE) ?

    For reference for anyone else later, here's the download link for Propeller Tool- currently at version 2.6 : https://www.parallax.com/package/propeller-tool-software-for-windows-spin-assembly-2/

  • zlantzzlantz Posts: 136
    edited 2021-12-19 17:36

    @VonSzarvas said:
    Just to be clear... when you mention "PropIDE", are you meaning "Propeller Tool" or something else (such as Propeller IDE) ?

    For reference for anyone else later, here's the download link for Propeller Tool- currently at version 2.6 : https://www.parallax.com/package/propeller-tool-software-for-windows-spin-assembly-2/

    Yes, v2.5.3. The version that runs both P1 and P2 code, the latest instance I believe it is. Just saw there is a v2.6, installing it now.

    Same problem exists with serial output, but now the PropIDE recognizes the same problems with BinFloat that FlexProp found. NAN and other defined functions are also built into the IDE so its in conflict with itself. Other defined functions like FAbs and FSqrt are also in error. Apparently BinFloat.spin2 does not work with the Spin2 language due to all the conflicts.

  • If you uninstalled the old one after installing the new one, that could've removed the font. Reinstalling the new one should fix that.

  • zlantzzlantz Posts: 136
    edited 2021-12-19 17:55

    @Circuitsoft said:
    If you uninstalled the old one after installing the new one, that could've removed the font. Reinstalling the new one should fix that.

    Yeah I got the font fixed after a frustrating multi-re-install multi-re-boot. Serial terminal from PropIDE still does not work. The new 2.6 version recognizes all the code errors that flexprop found.

    Need floating point math to complete my code but the recommended BinFloat.spin2 is chocked full of errors and neither IDE can compile the code.

    I really want to upgrade to the P2, its just been problem after problem with little to no solutions in site.

  • The Spin2 language was just recently changed to support floating point natively, and some of the new Spin2 keywords conflict with those in BinFloat. Here's a new version of BinFloat with those renamed. The basic operations like F_Add, F_Sub, and so on are redundant now, since Spin2 has +., -., *., and /., but the BinFloat versions are still there (and provide results more in compliance with IEEE than the built in Spin2 ones).

  • @ersmith said:
    The Spin2 language was just recently changed to support floating point natively, and some of the new Spin2 keywords conflict with those in BinFloat. Here's a new version of BinFloat with those renamed. The basic operations like F_Add, F_Sub, and so on are redundant now, since Spin2 has +., -., *., and /., but the BinFloat versions are still there (and provide results more in compliance with IEEE than the built in Spin2 ones).

    Oh my, this solves pretty much everything so long as I use FlexProp instead of PropIDE for programming. Gonna take a little getting used to I suppose. Just bounce back and forth between the two programs.

  • Now to figure out how to get the PropIDE to work.

    It does. Please archive and attach a program that you don't think works so that others can test independently.
    BTW, the latest version of Propeller Tool is 2.6.0. This includes FP and other niceties.

  • JonnyMacJonnyMac Posts: 8,912
    edited 2021-12-19 19:30

    Oh, it's that wait_for_terminal(), right?
    You don't need that with FlexProp as the terminal window opens right when the code loads.
    That's an advantage over Prop Tool, IMHO.

    It is. Since Propeller Tool can communicate with PST, I'm hoping @"Jeff Martin" will add the ability to open and enable PST at a specific baud rate so that we don't have to do it manually. Propeller Tool does that with the DEBUG windows, so it would make sense to have PST behave the same way.

  • zlantzzlantz Posts: 136
    edited 2021-12-19 23:33

    Well at this point I have tried literally everything and only parts of each IDE/language work with the P2 eval board rev c on a windows 10 pc.

    With C, serial terminal and multiple cogs run great but cannot get a basic servo control function to work so that is dead in the water. With Spin2, the serial works in FlexProp but when I try to start a second cog the program hangs forever so that is pretty dead. It is like what works in one language doesn't in the other.

    Haven't tried hooking up to a sensor yet... kind of expect that to be very tedious. Just trying to get the most basic functions working first.

    Never got serial terminal working in PropIDE. I used the earlier presented jm_serial_test.zip file as my test example as it was already shown to work on both systems. It did work in FlexProp but did not work with PropIDE v2.6.0.

    I kinda feel like it is a bit of a bust at this point. Until there are more working examples across multiple languages I think this chip is going to get put on the shelf as its current condition is not usable. Unless there is some underlying system environment variables that need changed or missing system update? The conflict seems to be in the programming software more than the chip.

    I am pretty happy with the P1 as it is a very stable chip that almost every example works for. Its only real downside was the maximum program size and it could be a bit faster. It can easily be programmed from the PropIDE software without any issues including multiple cogs and serial.

    Maybe link two P1's together in place of the P2? Haven't tried that yet... seems a bit overkill.

  • JonnyMacJonnyMac Posts: 8,912
    edited 2021-12-20 00:04

    Never got serial terminal working in PropIDE. I used the earlier presented jm_serial_test.zip file as my test example as it was already shown to work on both systems. It did work in FlexProp but did not work with PropIDE v2.6.0.

    I showed you in my post that holds the code that it works in Propeller Tool (I'm currently using version 2.6.0).

    Well at this point I have tried literally everything and only parts of each IDE/language work with the P2 eval board rev c on a windows 10 pc.

    Except archiving and posting one of your programs for independent testing.

  • Is this the IDE you're trying to use?

    The author stopped development many years ago (sad, it had potential) and I don't think there's a compiler that understands the P2 that it can use. Since you're on Windows 10, use Propeller Tool 2.6.0 (latest).

  • zlantzzlantz Posts: 136
    edited 2021-12-20 00:57

    @JonnyMac said:
    Is this the IDE you're trying to use?

    No... it is the one you are referencing to use. v2.6.0. This PropIDE serial term does not return data but FlexProp using the exact same code works just fine. Can use both the FlexProp terminal and the original Parallax Serial Terminal (F12 in PropIDE) and get serial data so long as I use FlexProp for the programming.

    Is it possible that my P2 eval is damaged some how? This really seems like a software issue as what doesn't work in Spin2 works in C but what doesn't work in C works in Spin2.

    Attached is the Spin2 code I am trying to get working in PropIDE. Does work in FlexProp without any issues so long as the wait for terminal is removed. (jm_serial_test)
    Attached also is a C code for servo output that has working multi-cog and serial but no real way to implement servo output. (C Servo Test)
    Attached also is a Spin2 code to start a second cog. It starts but then the primary hangs forever. Working / not working versions: (Serial Test NotWorks.spin2 and Serial Test Works.spin2)
    (The working version never starts the second cog while the non-working version starts the second cog before the main loop repeat.)

  • @zlantz ,

    you are confusing people.

    There is a Program called PropellerTool which you are using.

    The Serial Part is callt PST

    There is a complete different Program called PropellerIDE, having NOTHING to do with PropTool.

    Please straighten your names out, pretty please

    Mike

Sign In or Register to comment.