Shop OBEX P1 Docs P2 Docs Learn Events
loadp2 update for P2 wireless programming — Parallax Forums

loadp2 update for P2 wireless programming

VonSzarvasVonSzarvas Posts: 3,486
edited 2021-02-27 14:43 in Propeller 2

Hey there!

I'm gearing up to look at extending loadp2 today, to add the wireless programming functionality for P2.

If anyone already did that (or partially worked on anything), I'd be happy to integrate any prior efforts and save time where I can :)

All tips / gotchas / warnings / ideas / etc.. gratefully received !

Related posts :

Comments

  • VonSzarvasVonSzarvas Posts: 3,486
    edited 2021-02-27 11:33

    reserved for results

  • I have been using a C# version for some time now.

    I load the code using base64 encoding over the telnet port.

    Procedurally you code use the code as a base that works but It would take a lot of code to reproduce in C++.

    Mike

    P2Loader

  • Looking at two options

    Seems like PropLoader is a better fit to extend (at least in the first round), as that already supports WiFi discovery and load over serial.

    I'll carry on that path.

  • If you look at the code you will see it's written as C++ code that extends the original P1 code. You could just move the C++ code out of that one and add it to the Loadp2 code.

    Then remove the P1 code and add the P2 stuff.

    Mike

  • VonSzarvasVonSzarvas Posts: 3,486
    edited 2021-02-27 15:24

    Is there any reason to use loadp2 (other than being nice to have all the p2 loader tools in one executable) ?

    There might be something I don't know is important.

  • @VonSzarvas said:
    Is there any reason to use loadp2 (other than being nice to have all the p2 loader tools in one executable) ?

    There might be something I don't know is important.

    Flash programming. The P2 can't do it itself, so loadp2 has a feature where it can prepend the flash writer code (and generally load multiple files at once). It also has extra features like the remote filesystem.

  • The load to address and multi load feature is all a part of the two stage spin program that is loaded as well as the Flash loader.

    That feature is easy enough to add to any new code you come up with.

    Mike

  • @VonSzarvas said:
    I'm gearing up to look at extending loadp2 today, to add the wireless programming functionality for P2.

    Cool, that would be great to have!

    I suspect that the code bases for PropLoader and loadp2 both started from the same source, but both have diverged since then. The serial code is probably pretty similar.

    Is there any reason to use loadp2 (other than being nice to have all the p2 loader tools in one executable) ?

    Besides the P2 support and ability to load multiple files at different addresses, loadp2 also has a file server built in so that programs on the P2 can read files from the host PC. This makes it easy to e.g. copy files from the host to the SD or flash on the P2.

  • Cluso99Cluso99 Posts: 18,069

    Yes, please develop for loadp2. This is where the action is.

  • roglohrogloh Posts: 5,837
    edited 2021-02-27 23:08

    Loadp2 includes a very handy terminal that takes effect immediately after the image is loaded and is booted. Nothing seems to get lost and no special startup waits are needed in the code. This is very handy for debug. Is the same also true with PropLoader?

    EDIT: It does seem to have a terminal built-in at least.

  • Cluso99Cluso99 Posts: 18,069

    Yep! The loadp2 terminal is worth its' weight in gold :)

  • evanhevanh Posts: 16,024

    The terminal sold it for me too. I used Pnut a lot early on for the fast evolution on the FPGAs but hardly at all since.

  • VonSzarvasVonSzarvas Posts: 3,486
    edited 2021-02-28 22:42

    As a first step PropLoader is now allowing Wireless uploads to P2.

    https://github.com/VonSzarvas/PropLoader

    The binary compiled on Ubuntu (and now for Windows too!) is here: https://drive.google.com/drive/folders/16WlpLxg1YEMJXWNoKjrDH6y_bAiWp0r2

    If anyone can compile to Mac I'd be glad to add that to that folder.

    With one WX module on the network, this command will upload/run:
    proploader -D chipver=P2 -D reset=cts -D loader=rom -r ../toggle_control.binary

    List available WX modules with:
    proploader -W

    Add -i to the proploader command if you wish to target a specific WX module IP address.

    As the proploader command automatically sets the reset pin, then there is no need to configure that in the wifi module GUI. Just leave the wifi module at stock settings.
    However, the module will need connecting to your local network if your computer is not joining the wifi module network.

    There will be a QuickByte to explain all this later in the week, along with some spin2 code that will allow you to set the wifi module network credentials without needing to visit the web gui page!

    Low resolution intro video:
    https://drive.google.com/file/d/1UX5BOcMQ7XNBm_A973naZXoMo4f5ZSHb

    This is what I had time for this weekend, and I wanted to start something I could realistically complete. I appreciate moving this into loadp2 would be nice, and having terminal and also flash programming capability. I'm sure that will come later, and hopefully this will be a useful immediate way to program wirelessly from Visual Studio Code. (Earth calling @"Stephen Moraco" )

  • Update !

    Especially for Windows users like @"Ken Gracey"

    1. Download proploader.exe from here : https://drive.google.com/drive/folders/16WlpLxg1YEMJXWNoKjrDH6y_bAiWp0r2
    2. Copy the exe into the same folder as some P2 binary files!
    3. Connect up the hardware (P2 Edge, WX module, WX adapter, JonnyMac, 64019 or Eval RevC)
    4. Open command prompt and type : proploader -D chipver=P2 -D reset=cts -D loader=rom -r <FILENAME.binary>
  • macOS build of proploader, built on macOS Big Sur version: 11.2.2 (20D80)...

  • @VonSzarvas said:
    Update !

    Especially for Windows users like @"Ken Gracey"

    1. Download proploader.exe from here : https://drive.google.com/drive/folders/16WlpLxg1YEMJXWNoKjrDH6y_bAiWp0r2
    2. Copy the exe into the same folder as some P2 binary files!
    3. Connect up the hardware (P2 Edge, WX module, WX adapter, JonnyMac, 64019 or Eval RevC)
    4. Open command prompt and type : proploader -D chipver=P2 -D reset=cts -D loader=rom -r <FILENAME.binary>

    Okay, cue noted! I've been immersed in XBee all day and now it's nighttime. But in a short eight hours I'll be at my desk and trying out the proploader.exe as described.

    Hope to report back to you by dinner time!

    Ken Gracey

  • @dgately said:
    macOS build of proploader, built on macOS Big Sur version: 11.2.2 (20D80)...

    Thank you very much. Now added to the common download folder.

  • Stephen MoracoStephen Moraco Posts: 321
    edited 2021-03-02 01:24

    @VonSzarvas said:
    This is what I had time for this weekend, and I wanted to start something I could realistically complete. I appreciate moving this into loadp2 would be nice, and having terminal and also flash programming capability. I'm sure that will come later, and hopefully this will be a useful immediate way to program wirelessly from Visual Studio Code. (Earth calling @"Stephen Moraco" )

    Yep, I've been following along. Great work. I have all the gear I need to implement and test this. But... I'm buried in the Semantic Highlight capability addition to our VSCode support. After I get a small version of this working (concept proven) then I can return to driving more tools from VSCode.

    Gimme a week or two... or....? ;-)

    If you want to play on macOS or Windows - the example tasks for driving loadp2 from a task are ready for cut-n-paste and running in your own environment. If you have proploader running in your environment it may be easier for you to test using my examples. If you get here first (and I'd welcome the help, of course) then please report your findings here and I'll help by integrating anything you are able to prove.

    FYI- all my examples are using absolute paths for now while we come up with an external tool setup standard/policy for us all to use.

    Stephen

  • VonSzarvasVonSzarvas Posts: 3,486
    edited 2021-03-02 20:24

    Howdy !

    https://drive.google.com/drive/folders/16WlpLxg1YEMJXWNoKjrDH6y_bAiWp0r2

    Added a new folder, "Release 20210302". GitHub also updated.

    This version will run the terminal over WiFi too, tested on Ubuntu and Win10.

    Assuming the "proploader" (linux) or "proploader.exe" (windows) AND "proploader-test.binary" files from that Goo folder are downloaded to your computer, and with hardware setup as shown in this photo, including the P2 "CONTROL" Accessory plugged into P0 to P7, then the command is :

    proploader -T -D chipver=P2 -D reset=cts -r proploader-test.binary

    When Terminal mode starts, press SPACE bar, then follow the instructions (tapping enter after each thing you type in).

    Full credit to David Betz for the propeller-loader and JonnyMac for the SPIN2 serial code in the demo. I've mangled things together from their gifts to the community.

  • dgatelydgately Posts: 1,631
    edited 2021-03-03 19:03

    EDIT: If you have a program already loaded onto the FLASH of the P2 board and that program uses pins that conflict with the WiFi Module pins, you'll have problems loading a program... Two programs that unfortunately were blinking pin 56 or attempting to quickly write to serial in a loop were previously loaded into the FLASH of my 2 P2Eval boards (ARG!). Removing those programs with a program that did not access any pins in the vicinity of 56-63 on the FLASH, fixed the loading via Wifi issue.

    A macOS friendly version of proploader is attached!

    dgately

  • Before RevC of the EVAL, there was no RESet signal at the accessory header, so that would be an issue. You could try pressing the reset button just before hitting enter on the proploader command?

  • @VonSzarvas said:
    Before RevC of the EVAL, there was no RESet signal at the accessory header, so that would be an issue. You could try pressing the reset button just before hitting enter on the proploader command?

    As you can see from my post edit, it was previously FLASH-loaded programs that were effecting proploader. All boards appear happy now!

    Thx

  • Ah, yes!
    P56 and P57 are connected to RESet and PGM pins on the WiFi module. We will remove those on the next rev of the WX Adapter board, and leave the signals available at the SIP pads instead, so "power-users" that need those signals can install the header and use jumpers to bring the signals to the microcontroller board.

    Thanks for the Mac compile,- I've added that to the download folder too.

  • I have no problems loading a program with a program already running from flash that is blinking both pins 56 and 57.

    Actually, I like that so I can see the Propeller board is running prior to loading a program in ram.

    Mike

  • @iseries said:
    I have no problems loading a program with a program already running from flash that is blinking both pins 56 and 57.

    Actually, I like that so I can see the Propeller board is running prior to loading a program in ram.

    Mike

    I believe you are using a custom made board, not the Parallax one which uses P56 and P57 for the RES and PGM pins.

  • Just curious, anybody get this to work with FlexProp?

    Thanks

    Ray

  • ersmith responded to my question about using your program within FlexProp. Not sure if you can help him out or this a Parallax problem to solve.

    Thanks
    Ray


    @Rsadeika said:
    Any idea when WiFi for the P2 will be added for Flexprop? It looks like the new P2 proploader has been available since March.

    https://forums.parallax.com/discussion/173017/loadp2-update-for-p2-wireless-programming


    There two answers to this:

    (1) Since the commands used for loading can be changed in the Commands > Configure Commands... menu, you can already use Wifi: just replace the loadp2 command with whatever command line the P2 proploader needs for WIFI.

    (2) However, be aware that the P2 proploader only supports WIFI (it does not allow serial programming of P2s, as far as I can see). Nor does it support any of the additional features of loadp2, like the file server or loading files in pieces. So it's not really viable as a replacement for loadp2, and until it is, proploader cannot be made the default P2 loader. It would be nice if Parallax would update the loader to at least support serial programming of P2s.

  • Hi Ray,

    The proploader was extended for simple wifi programming functionality for the P2. The other stuff was all well beyond my available time and need. I wanted to contribute something I could deliver in a day, and which I could start using the next day in a new project!

    As for supporting serial programming, as I know loadp2 already supports that, so I wouldn't prefer to duplicate effort in having another serial loader- I'd rather add a macro/hotkey to call the appropriate command line tool, and use loadp2 for serial and proploader for wifi. That's what we did with VSC in mind anyhow. I'm not familiar with flexprop, but it seems ersmith is describing a similar possibility (which I guess makes sense as I think he already supports multiple command line tools for the various languages he supports?).

    Anyway that's what I know about this situation. I just recall that to try and bundle all the functionality into one "all encompassing" loader would have taken more time than was available, and perhaps never gotten finished!

    I'm not sure what Parallax will do in the future, but I'm sure that the issue can be looked at again after the P2 manual is released in a couple months. Ideally for the flexprop community, someone might contribute an extended-with-wifi loadp2 before then. No doubt that's a much simpler task for many here compared to what I could do.

Sign In or Register to comment.