FlexBASIC P2 WiFi
Rsadeika Posts: 3,693
Since I am starting to use the P2 WiFi, I am wondering how the 'mount "/host", _vfs_open_host()' command would work? If I ever get the telnet to work properly, how would that work with '/Mount "/host", ...'.
I don't know what you're asking here. The _vfs_open_host() works over the "serial" connection (from the Prop's point of view) on pins 63 and 62. It will continue to work fine if that serial connection is in turn forwarded via telnet to the PC host, as long as that host is running the file server (built in to proploader). That's the default setup for the WiFi.
If you set up your own telnet connection different from the default one, then you'll have to arrange to have a file server running on the other end of the telnet connection.
I went ahead and did an up date of the latest flexprop, for my Raspberry Pi PC Desktop system. I noticed that some thing is changing the name of my WiFi module.
Below is a copy of what my WiFi settings are set at after flexprop does a scan for ports. Is flexprop doing some other subtle changes each time it does a scan for ports? As of this moment flexprop, when I do a compile and run, it cannot find the port. Not sure if the WiFi module is now mangled in some way.
You don't have the newest version of flexprop. Delete all of your config files and start again:
then follow the instructions in the README.md for building on Linux.
WARNING: type the rm commands I gave above exactly as shown; in particular make sure there's no space before the `*' symbol.
You can fix the name change with the web interface of the WiFi module.
Something weird is going on.
My system, P2 Edge rev B with a WiFi card, when I add, to my program, pinlo 56 and pinlo 57 and then do a Compile and flash, it is doing something to the WiFi card.
Normal scenario, with the WiFi card plugged in, the blue LED will be flashing. When I do the Compile and flash, with the pinlo commands in the program, and then turn the P2 Edge system back on, the blue LED is no longer flashing which means the system is no longer working. Is this some kind of hardware issue that I am having with my system, and is this a problem with other peoples P2 Edge rev B with WiFi card setups.
As I mentioned in another thread, using the WiFi is a very frustrating situation. Is it the hardware or is it the software, or is it a little of both.
The projects that I have in mind, will be using the WiFi capabilities. I am not sure what direction to go now. I hate the idea of switching over to the RPi, and dumping the P2.
Maybe Parallax should think about a P2 Edge that has the WiFi, uSD built in, and all of the connection problems worked out, so you do not have to rely on too many dip settings to get things too work properly, this is just an idea.
After spending the morning getting a Pi to reliably delay mounting an NFS drive until AFTER the wifi connection is up I feel your pain the same but different. But I digress...
I am now seriously considering pulling the P2 Edge setup from my project and replacing it with an Activity Board WiFi setup. I can always use the P2 Edge setup in some other project that does not require WiFi.
If I do the switch, I know that I will be running into memory constraints with the P1. At the moment, with the P2 Edge setup, my program is up to 70K in size. Not sure as to how I will make it fit in less than 32K, will coding every thing in PASM make it fit?
I have used FlexBASIC with the Activity Board WiFi, and I know that works, as expected. I have a lot to think about at the moment, which way should I go.
Wait... you're saying you can't make a P2 work where a P1 does now?
Yes, from a WiFi perspective.
I probably misunderstand the issue but there are alternative wireless modules.
I am trying a small test program:
mount "/host", _vfs_open_host() ' Mount FS
open "/host/global.txt" for append as #3
I have done a Compile and flash, using serial. I switched over to WiFi, and started up the P2. Where should I be looking for the global.txt file. My host is the Linux system.
I have been using a the Wifi module with my p2 rev b Edge for over a year now and have no issues. I can load programs over the Wifi and connect it as a terminal.
I also have an SD card attached as well. That works great. I however do not use plan 9 as I don't see the purpose. I write to the SD card either from my PC or from the P2 by moving the card between them.
I'm not sure this will work very well from flash -- the _vfs_open_host() call will have to communicate with the loader program, so that will have to be running when you boot. The global.txt file will end up in whatever directory you launch the loader from.
Since I use the GUI exclusively, not sure what other things I could do within the GUI to have a loader launch from within flash.
So, at the moment it narrows down the usage to the uSD, but that is very limiting, from perspective. I guess if there was an editor program the ran from within a FlexBASIC program, you could theoretically create and manipulate files on the uSD. But, still, when using the WiFi setup you would not be able to upload a file(s) to the host system.
On the SimpleIDE program, it has the capability to interact with a WEB browser for control of a program from the browser, not sure if FlexBASIC will going that way anytime soon.
I was looking at possibly using Python socket to maybe make use of the WiFi aspect to handle the file(s) need, but as I have read, in order to make it work efficiently, you would have to set up some kind of server/client mode, which I think that FlexBASIC cannot do.
So what you want to do is compile some data onto the SD card and then at some point ftp that file to a host computer for processing using BASIC.
The Wifi module also has webserver and a way for you to define URL's that can interact with the P2 to provide data to the request.
You can also open sockets and udp connections to send data between programs connected to the Wifi network or over the internet for that matter.
Now, what I normally do is, start up with the WiFi, and then, in the Special, I start up FlexProp ANSI Terminal. That seems to be working fairly well, as a connection to the WiFi.
I wonder if there could be some way of modifying the Terminal to achieve the usage of 'mount "/host", _vfs_open_host()'. It would be even more interesting to see if the FlexProp ANSI Terminal, could be made as a stand alone, and be able to connect to the WiFi. Then it could be expanded on to do other things. Just thinking at the moment.
Are there any Parallax WiFi experts here?
I was looking at the Parallax WiFi firmware pdf, and I noticed that their is a way to use things like 'POST' and 'GET', and other stuff. Anybody know how this could be implemented using FlexBASIC. Maybe some simple examples, if possible, could be a help.
Get and Post deal with the browser side of the Wifi module and can be used to pass information to a program listening on the serial connection.
It's been a long time since I wrote a basic program, CBASIC, RBASIC, ZBASIC or even VB-BASIC.
The Wifi module has to have commands turned on and then you tell it what path you want to listen for:
Then you would use:
It will return a value that indicates the type of request that is active and you need to retrieve those values and send a reply before the browser times out the connection.
I will not be doing any P2 stuff for awhile. Last night I saw smoke arise from my P2 Edge setup, by mistake, power source was not 5V. The Activity Boards are something like 6-26V, the P2 Edge should be something similar, to ward off power supply issues.
I have some FLiP modules, so I will be doing some P1 projects for awhile.
The new P2 edge modules now except 5 - 16v if that helps.
You are in good company, Ray. I smoked a Rev B eval board under similar circumstances. My mistake was not remembering that my bench supply (at the time, since replaced) defaulted to 12.0 volts. You could adjust voltage up or down from there, but it always started at 12v with the output set to "off". Without thinking, I punched the "output on" button without resetting the voltage. Needless to say, I gained some experience with SMD rework that day. After a few mis-starts and re-re-replaced components, the reworked board eventually worked and it remains on the bench to this day as my "beater" board.