Shop OBEX P1 Docs P2 Docs Learn Events
flexGUI P1 questions — Parallax Forums

flexGUI P1 questions

I know that the P2 forum has a flexGUI thread, which seems to be aimed at P2 users. Not sure how many people are using flexGUI with the P1.

I wanted to use the flexGUI for the Activity WX board in the WiFi mode. I thought the flexGUI had the capability to find the WiFi port. I tried it and it did not find the port. Is there a special setting for doing this.

Thanks

Ray
«13

Comments

  • dgatelydgately Posts: 1,621
    edited 2020-05-17 15:52
    flexgui uses proploader for uploading binaries to the P1... proploader has an option to use the P1's IP number rather than a serial port, for uploading.
    % proploader
    PropLoader v1.0-41 (2020-02-03 15:19:43 g9192230)
    
    usage: proploader [options] [<file>]
    
    options:
        -b <type>       select target board and subtype (default is 'default:default')
        -c              display numeric message codes
        -D var=value    define a board configuration variable
        -e              program eeprom (and halt, unless combined with -r)
        -f <file>       write a file to the SD card
        -i <ip-addr>    IP address of the Parallax Wi-Fi module       <== WiFi-based upload!!!
        -I <path>       add a directory to the include path
        -k              prompt before exiting due to an error
        -n <name>       set the name of a Parallax Wi-Fi module
        -p <port>       serial port
        -P              show all serial ports
    
    flexgui's "Configure Commands" menu will get you to a dialog where you should be able to replace the serial port with "-i 99.99.99.99" (use your P1's IP number) in the Run Command field.
    ...OS_SPECIFIC_PATH_TO_YOUR_SHELL... "%D/PATH_TO_PROPLOADER/proploader" -Dbaudrate=%r -i 99.99.99.99 "%B" -r -t -k
    
    Not tested, but should get you close... My example is on a macOS system. Obviously paths for WIN or Linux will differ.

    dgately
  • On SimpleIDE, which I think uses proploader, all of the ports are listed, than you choose the port you want to use. I thought in FlexGUI it would be working the same way.

    How far has the port of Simpletools for FlexGUI C gotten? I want to do some experiments with FlexGUI, but now I am not sure if I want to use C or Basic.

    Ray
  • Ray,
    I decent chunk of the simpletools lib is there. This is just the stuff from simpletools.h, not all of the Simple Libraries (aka Learn folders). It also has simplei2c, and there is a decent chunk of standard C libraries stuff too (@ersmith has been adding more and more).

    I'll have an update soon that gets more of the simpletools.h stuff converted over. I'm working out P2 conversions of the functions that use P1 counter modules. Stuff like freqout(), square_wave(), etc.

    As I port simpletools stuff to FlexC, I make it work on P1 (easy) and P2 (a bit harder in same cases). So they should work for you on P1.
  • I tried the suggestions made by dgately, no success. To make sure that there is a signal, I use SimpleIDE, and it finds the Activity WX board WiFi address, and able to load the board remotely. Not sure what the next step is.

    Thanks Roy for the effort you are putting in for the addition of simpletools, and other things, to FlexC. Now, if I could get FlexGUI to work with the WX WiFi.

    Ray
  • Ray,

    As a test, can you try proploader itself on a command line (not from within flexgui) with a "-W' option? It should list all WiFi modules that it finds. That's the same mechanism that SimpleIDE uses to display modules in its menu.

  • I was able to test a Compile and Run on P1 as well as Compile and flash, with a simple LED blinker spin program.

    I used these settings in flexgui's Configure Command...:
    Run Command:
    /Users/myUserName/flexgui/bin/mac_terminal.sh "%D/bin/proploader" -i 10.0.0.102 "%B" -r -t -k
    
    Flash Command:
    /Users/myUserName/flexgui/bin/mac_terminal.sh "%D/bin/proploader" -i 10.0.0.102 "%B" -e -r -k
    
    % /Users/myUserName/flexgui/bin/proploader -Dbaudrate=115200 -i 10.0.0.102 /Users/altergator/Desktop/p26.binary -r -t -k; osascript -e 'tell application "Wish" to activate'; exit 0
    Opening file '/Users/altergator/Desktop/p26.binary'
    Downloading file to port 10.0.0.102
    620 bytes sent                  
    Verifying RAM
    Download successful!
    
    % /Users/myUserName/flexgui/bin/proploader -i 10.0.0.102 /Users/altergator/Desktop/p26.binary -e -r -k; osascript -e 'tell application "Wish" to activate'; exit 0
    Opening file '/Users/altergator/Desktop/p26.binary'
    Downloading file to port 10.0.0.102
    620 bytes sent                  
    Verifying RAM
    Programming EEPROM
    Download successful!
    

    I'm using a Mac, so "osascript -e 'tell application "Wish" to activate';" is unique to my set up, so ignore if you are on WIN or Linux...
  • When I do, at the command line, proploader -W, yes it finds the port. But for some reason, it is not finding it from within FlexGUI.

    In the Run command, I am using ' -i ip address'. I also tried, ' -p ip address', this did not work. Not sure why it is not finding it within FlexGUI.

    Ray

  • What is the exact Run Command text that you are using? I think I needed to remove every option except "-i 10.0.0.102 "%B" -r -t -k" <== 10.0.0.102 is my prop's IP, obviously.

    You can copy the exact command that flexgui used to attempt the upload from the Compiler Results area of flexgui's main window... Here's how flexgui interpreted my config (on macOS):
    Finished at Mon May 18 07:56:09 2020
    /Users/myUserName/flexgui/bin/mac_terminal.sh "/Users/myUserName/flexgui/bin/proploader" -i 10.0.0.10 "/Users/myUserName/Desktop/p26.binary" -e -r -k
    
  • OK, something weird is going on.

    At the command line, I type in 'proploader -W', and the first time it shows a blank line, and then the command prompt. The second time I type in 'proploader -W', then it finds the port. It seems like proploader is missing a beat, but the proploader that is being used by SimpleIDE does not seem to skip a beat.

    My box is Windows 10 Pro with the latest updates. Is proploader having a problem with Windows, or is Windows having a problem with proploader. The first time I ran proploader from the command prompt I saw the virus check notification pop up. So, a new little problem to solve.

    Ray
  • It took several attempts for me to get a response from proploader -W, as well. But, once I got a good result, it seems to have stabilized. I'm thinking that was more of an issue with my home WiFi network.

    Could you point the flexgui Run Command to the proploader that is used in SimpleIDE and give it a try? I sync all of my tools to the latest built ones from flexgui's sources, so I use the same proploader version in flexgui & SimpleIDE. I just copy the built binaries from flexgui to where SimpleIDE expects the loader (which is different on macOS, from WIN or Linux). I also have a directory to generically store all my prop tools (/opt/parallax/bin/).
  • FlexGUI 4.1.10 is available now from my Patreon page (link below) and has a "Scan for devices" option which will also look for WiFi boards.
  • Yep, FlexGUI 4.1.10 is not there, maybe it takes awhile for it to show up.

    Ray
  • PublisonPublison Posts: 12,366
    edited 2020-05-18 18:20
    FlexGUI 4.1.10 is available now from my Patreon page

    The Patreon is for early adopters that pay a small fee to get the latest software and to help @ersmith fund the development. You can wait a day or two to get the latest public version. Or you can give a donation. :)
  • Publison wrote: »
    FlexGUI 4.1.10 is available now from my Patreon page

    The Patreon is for early adopters that pay a small fee to get the latest software and to help @ersmith fund the development. You can wait a day or two to get the latest public version. Or you can give a donation. :)
    Or, build it yourself from github... (https://github.com/totalspectrum/flexgui)

  • dgately wrote: »
    Publison wrote: »
    FlexGUI 4.1.10 is available now from my Patreon page

    The Patreon is for early adopters that pay a small fee to get the latest software and to help @ersmith fund the development. You can wait a day or two to get the latest public version. Or you can give a donation. :)
    Or, build it yourself from github... (https://github.com/totalspectrum/flexgui)

    Just trying to get eric some bucks, I just upd my donation. :)
  • Publison wrote:
    Just trying to get eric some bucks, I just upd my donation. :)

    Good deal! I did the same a few weeks back.

    We definitely want to keep Eric happy. He has a metric boatload of time invested in the Flex suite, and its awesome! A wee bit of shilling for him would not be amiss IMHO! :)

  • I went ahead and downloaded FlexGUI 4.1.10. The new scan feature works, but for some reason it still has a hesitation before it finds the WiFi port.

    Back to basics.
    //test1.c
    #include <stdio.h>
    
    void main()
    {
    	usleep(1000);
    	printf("Hello,FleGUI/n");
    }
    
    For some reason I am not seeing "Hello,FleGUI/n".
    Opening file 'E:/programs/flexc/test1.binary'
    Downloading file to port 192.168.45.103
    7924 bytes sent
    Verifying RAM
    Download successful!
    [ Entering terminal mode. Type ESC or Control-C to exit. ]
    ÇÇÇ Ç ÇÇ ÇÇÇÇÇ Ç Ç ÇÇÇÇ ÇÇ ÇÇÇÇÇÇÇ ÇÇÇ ÇÇ
    posixio.c
    usleep.c
    bufio.c
    errno.c
    test1.pasm
    Done.
    Program size is 7924 bytes
    Finished at Tue May 19 17:33:24 2020
    cmd.exe /c start "Propeller Output -i 192.168.45.103" "E:/flexgui/bin/proploader" -Dbaudrate=115200 -i 192.168.45.103 "E:/programs/flexc/test1.binary" -r -t -k
  • dgatelydgately Posts: 1,621
    edited 2020-05-19 22:24
    Something about stdio's printf... I was able to compile & run the following hello.spin program with success, so it's not the WiFi interface. Something about C programs printing?

    flexgui sample spin program:
    '' simple hello world program
    #ifndef _BAUD
    #define _BAUD (__P2__) ? 230_400 : 115_200
    #endif
    
    CON
    #ifdef __P2__
      _clkfreq = 160_000_000
      rx_pin = 63
      tx_pin = 62
    #else
      _clkmode = xtal1 + pll16x
      _clkfreq = 80_000_000
      rx_pin = 31
      tx_pin = 30
    #endif
      baud = _BAUD
    
    OBJ
    #ifdef __P2__
      ser: "spin/SmartSerial"
    #else
      ser: "spin/FullDuplexSerial"
    #endif
    
    PUB hello
      ser.start(rx_pin, tx_pin, 0, baud)
      repeat
        ser.printf("Hello, world!\n")
    

    Run Command:
    /Users/altergator/flexgui/bin/mac_terminal.sh "%D/bin/proploader" -Dbaudrate=%r "%B" -r -t -k -v
    

    Result:
    % /Users/altergator/flexgui/bin/proploader -Dbaudrate=115200 /Users/altergator/flexgui/samples/hello.binary -r -t -k; osascript -e 'tell application "Wish" to activate'; exit 0
    Opening file '/Users/altergator/flexgui/samples/hello.binary'
    Downloading file to port 10.0.0.102
    3072 bytes sent                  
    Verifying RAM
    Download successful!
    [ Entering terminal mode. Type ESC or Control-C to exit. ]
    ?????????????????????????????????????????????????????????????????????????????????????????????????Hello,!
    Hello, world!
    ...
    
    A little glitch in the first print, but it sends the correct text, eventually.

    dgately
  • This works...
    #include "simpletools.h"
    
    int main()                                        // Main function
    {
      while(1)                                        // Main loop
      {
        print("Hello, World!\n");                     // Display text
        pause(200);                                   // Wait 0.5 s before repeat
      }
    }
    
    So, stdio may be suspect?
  • This actually seems to be a problem with PropLoader. The issue goes away if I use propeller-load, or if I add a 10ms delay at the start of main(). I guess there's some delay on the PC side getting ready to read data.
  • The short below seems to work; the minimal pause, on my machine is 17. Now the question is, where is simpletools.h located? Since I replaced stdio with simpletools, maybe stdio is a contributing factor? If simpletools is the answer, what else does simpletools contain that can be used.

    Ray
    //test1.c
    //#include <stdio.h>
    #include "simpletools.h"
    
    
    void main()
    {
    	//usleep(6000);
    	pause(17);
    	print("Hello,FlexGUI\n");
    	
    }
    
  • The wifi loader has to switch from a download connection to a telnet connection and there might be a small delay in that happening. That could be causing your characters to be lost if you try to write to the serial port immediately after boot.
  • I think I found the culprit: it is PropLoader. In the file IP_Loader.spin there's a line that reads:
                                shl     SCLHighTime, #64                             'Prep for brief delay (spec. SCL High must be >= 0.391 µS)
    
    Obviously shifting left by 64 isn't what was desired, since it'll do nothing (the shift count is always modulo 32). Possibly the original intention was shifting left by LOG2(64), but I don't think that's quite long enough. If I change the "64" to "14" (to introduce a nice long delay) then everything seems to work better.

    I've made that change to my copy of PropLoader and flexgui and checked it in to github. I've also attached a Windows binary; if you replace the flexgui/bin/proploader.exe with the one from this .zip it should work better.
  • David BetzDavid Betz Posts: 14,511
    edited 2020-05-20 12:55
    ersmith wrote: »
    I think I found the culprit: it is PropLoader. In the file IP_Loader.spin there's a line that reads:
                                shl     SCLHighTime, #64                             'Prep for brief delay (spec. SCL High must be >= 0.391 µS)
    
    Obviously shifting left by 64 isn't what was desired, since it'll do nothing (the shift count is always modulo 32). Possibly the original intention was shifting left by LOG2(64), but I don't think that's quite long enough. If I change the "64" to "14" (to introduce a nice long delay) then everything seems to work better.

    I've made that change to my copy of PropLoader and flexgui and checked it in to github. I've also attached a Windows binary; if you replace the flexgui/bin/proploader.exe with the one from this .zip it should work better.
    Interesting. That's part of Jeff Martin's fast loader although although I may have broken it when I modified it for proploader. I'm surprised we didn't notice this earlier. Can you send a pull request to Parallax to pull this and any other improvements you've made into the official proploader repository?

  • Excellent! So, now Ray's original code (using stdio.h & printf) works!
  • The only reason that I was using stdio & printf is, because I did not think that print() was available in FlexC. I believe that print() uses a lot less code overhead, so I would prefer to use print() instead of printf().

    When the Eval rev C board becomes available, and I am satisfied with the implementation of WiFi for the P2, then I will be switching over to P2. But, for now, since FlexGUI does not implement CMM, you have to be very code size conscious when working with the P1.

    I am still looking into working with FlexBasic as a quick prototype language. I wonder, when the rest of the simpletools device drivers become available, could they be used with FlexBasic?

    Ray
  • Their seems to be a problem with the 'Scan for ports' selection. I downloaded and I am using the new proploader, now it seems like scan is not finding anything, and maybe not working.

    In the 'Ports' I have the 'Find port automatically' checked. By the way, how would you uncheck the item. Anyway, when I select the Scan, it seems like nothing is occurring.

    Ray
  • Now I have a much bigger problem, the blue LED, on the WX WiFi module, is no longer blinking. I turned the Activity WX board on/off a few times, and the blue LED does not appear. Anybody know what that indicates. It seems like the WX WiFi module(s) are kind of finicky.

    Ray
  • Not sure if I solved the problem or not. I am powering the Activity WX board with the barrel adapter, which is connected to a battery source. The battery source is providing at least 6.5V.

    Since the on/off switch was not doing anything, I pulled the barrel plug, waited a bit, then plugged in the barrel plug, and the WX WiFi came to life. Is their a problem with the Activity WX board and barrel power socket? Not sure as to how or what the explanation is, for what just happened. Anybody experience something like that?

    If the problem is with the barrel power socket and a battery source, then maybe I need some more direction with how to power the Activity WX board when using a battery source.

    Ray
  • Back on tract.

    Compiling both programs, each program size is 7860 bytes. So, it seems like you do not get a program code size savings in either one, so far. I wonder what a test1.spin code size would be. Since I do not use Spin, not sure what the Spin program code would look like, for comparable code match.

    Ray

    This no longer needs a pause.
    7860 bytes
    //test1.c
    //#include <stdio.h>
    #include "simpletools.h"
    
    
    void main()
    {
    	//usleep(6000);
    	//pause(17);
    	print("Hello,FlexGUI\n");
    	
    }
    
    test1.bas
    7860 bytes
    
    print "Hello,FlexGUI"
    
    
Sign In or Register to comment.