flexBASIC P2 WiFi
Rsadeika
Posts: 3,837
in Propeller 2
I am now going to see how far I can get with flexBASIC WiFi.
I plugged in the WiFi module, and got the IP address, and now what?
I checked the Ports for P2, in flexprop, the WiFi IP does not show up. Is there any other way of connecting to the IP address and communicating with the P2. I was thinking along the lines of maybe using Telnet, to gain access. Anybody have any ideas?
Thanks
Ray
Comments
I am getting this in the flexprop terminal, anybody know what this is.
Ray
Yes I know what it is, a P2 serial response character is failing to arrive and the code is timing out. A recent change to timeout computations in loadp2 might possibly have caused it if earlier versions of loadp2 were previously working okay.
What type of system are you running, Windows or Mac or Linux, and is this the P2-EVAL system or a P2-Edge? I know I used to see differences between them in the past related to timeouts (even though they both use the FT231X chips if you have a recent PropPlug).
Also check your DIP switches are setup correctly for serial access and try removing any SD card if one is fitted.
Also AFAIK flexprop doesn't support Wifi at this time (certainly its loadp2 does not). You still need a serial/PropPlug type of interface to work with loadp2. EDIT: It looks like flexprop actually now includes proploader which does support Wifi, though perhaps that's only for P1 use.
Somewhat relatedly I've not been able to get PropTool on Windows to recognize an ESP-03 loaded with the VonSzarvas wx Wifi firmware either, even though the web interface is responding and presenting the HTML pages, however it is still early days. So I'm not sure what software is needed for using it for download/debug etc, and it could be just TELNET for a console. You might need the alternative propeller-load tool which I think is meant to support Wifi.
Yes, I have a P2-Edge setup and I am using Linux(Raspberry Pi). Flexprop does support WiFi for the P1, but I guess Parallax has not gotten around to having WiFi for everything.
Ah yes, VonSzarvas wx Wifi firmware. I wonder why that has not been adapted for flexprop? Aside from the VonSzarvas wx Wifi firmware, I wonder if there is any other way of getting access to the WiFi via flexBASIC P2. At this point, I do not need the capability to program the P2 via WiFi, I just need someway to use the WiFi.
I also have the uSD module plugged in, I wonder if that is creating a problem.
Ray
Well I had many problems with downloading serially to the P2-Edge with older versions of loadp2 which drove me crazy and prompted me to dig down into it with the logic analyzer and make those recent changes to timeouts which fixed it for me on my Mac. (OS X 10.10). If you were using an older version of loadp2, you could try the latest loadp2 to see if it helps. You can get it from github here https://github.com/totalspectrum/loadp2 and compile for Linux.
You could try removing the microSD card on your P2-Edge (must be a new rev C) to see if that improves anything and lets you download serially.
For the uSD problem, I had it plugged into P24 - p31 bank. I unplugged and plugged it into p16 - p22 bank, here it now does not cause the problem.
As for the WiFi, I thought by creating a comm, telnet.startx(62, 63, 0, 115200), flexBASIC would be connecting to the WiFi module, and allowing some kind of comms between flexBASIC and a telnet connection. So far I am getting nothing on the telnet side. Should the baud rate be something other than 115200.
I am using putty which does not allow a BAUD setting, or at least I did not notice it. Missing something on that point?
Ray
I see a baud setting in putty
https://www.eye4software.com/hydromagic/documentation/articles-and-howtos/serial-port-logging/images/putty_serial.png
I tested a small example flexBASIC program on P2 Edge & a Parallax Wifi module (hooked up to P56-P63 socket). After fiddling with telnet mods a bit (needed character mode and setting CRLF option), I got comms both ways between the P2 and a telnet session running on macOS (in the UNIX Terminal app)...
telnet settings used:
Start with this simple example... Once that works, start adding SD and other features.
On the WiFi module through the web page there are baud rate setting that would be used between the P2 and the WiFi Module. From the telnet or putty session there would be no baud rate as it is not a serial connection and does not have one.
The WiFi module is doing the conversion from telnet to serial on the P2 and the baud rate must match which defaults to 115200 on the WiFi module.
Mike
I got back to working with the Edge WiFi, and I noticed the blue LED was not flashing on the WiFi ESP8266 . So, something went wrong. I think I should be buying the Parallax WX WiFi ESP8266 SIP modules by the bushel basket. Not even sure if the one I have is now fixable. Their has to be a better solution for this.
Ray
Are you using: P2 WX Adapter Add-on Board
SKU 64007? Or wiring the module with jumper wires? What is your full setup? I did buy 3 or 4 of the modules & adapters as I always assume that I’ll kill at least one😳
Yes I am using the P2 WX Adaptor Board. I found another WiFi SIP module, plugged it in, and I get a solid blue LED. Last time I used it, it was working.
Now I am starting to wonder if the P2 Edge mini breakout board has a problem with it. I did mention that I was having a problem with uSD module, after I moved it to different socket the problem got fixed. Not sure what I will be doing next.
Ray
Ray
Now that you’re getting the blue LED, try the code from post #9…
Nope, it is a solid blue LED and not a flashing blue LED. A 192.168.4.1 does not come up, and whatever I had as an IP address does not show up either. So, this other WiFi SIP that I am trying is not functioning correctly, either.
There are three items that are in play, the Edge mini board, WX Adaptor Board, and the WiFi SIP itself. I have to figure out how to check each item to see if it is working properly. I probably do not have the correct equipment for doing this.
Ray
With an IP of 192.168.4.1 you unit is in SoftAP mode and not in Station mode to connect up to your home network.
Mike
Hmm... My blue LED blinks twice quickly, waits about 2 seconds then repeats the 2 blinks, continuously. When I type text in telnet or the flexprop console, the input & output LEDS quickly blink.
BTW: the module has a yellow power LED on the left side. Is that lit on yours? And, are you powering the P2 Edge with 5 volts?
dgately
Solid Blue LED indicates the unit is in SoftAP mode. In Station Mode the LED blinks.
Mike
Mike, I always set mine to STA+AP mode... Is that appropriate for most use?
Just to verify that it is just the WiFi SIP module, I plugged it into a breadboard, and powered it up with 5.0 V. Same result, solid blue LED.
Since it is in SoftAP, then it should be accessible via 192.168.4.1, but all of my different WiFi devices are not making contact with the WiFi SIP. It seems like my WiFi SIP module is stuck in SoftAP, and the unit is not turning on a WiFi signal. Not sure how to get around that, would be nice it it had a reset button.
Ray
Interesting thing has occurred, the original WiFi SIP, where the blue LED was not turning on, now it has a flashing blue LED.
I was getting ready to put it in my non functional units box, when I decided to plug it into the breadboard, with the 5.0 V power source. When the blue LED started to flash I then plugged into the WiFi adapter board, powered up the P2 Edge mini board, and the WiFi SIP is still flashing the blue LED.
I am now scratching my head trying to figure out, what is going on, is the P2 Edge mini board having some kind of power issues. No idea what so ever.
Ray
I sort of got the telnet part working.
The spin/SmartSerial.spin works, but when you add:
open SendRecvDevice(@teln.tx,@teln.rx) as #3
the telnet does not respond. Since I do not have access to an input #x, I need an RxStr. Below, is a PUB that works in P1 but it does not work in P2.
This is a snippet from the Martin Hebel Extended FullDuplexSerial.spin, but it does not work in P2. Can anybody can fix the problem so it will work with P2.
Ray,
Try this (not fully tested but it does allow string input from the telnet session):
I am having a very hard time dealing with telnet. I only have two choices, TeraTerm or putty, and both are very hard to deal with, at least for me.
Now I am wondering if their is another way that is available?
Ray
how about windows telnet?
Part of windows (you may need to check the checkbox in windows features)
Mike
You can run telnet on your Raspberry Pi…
Then:
I am having some trouble with the program below. It seems to not run with the warnings being shown.
I am not sure if the program is not running because of the warnings or because the program is not correct. Not sure what to make of
warning: assignment to const item. I do not know how to get around this.
Ray
Although I like to work towards solving the warnings eventually, this is just a prototype example to make sure your WiFi module is able to communicate with a telnet session. This example worked with the setup I described several posts back. I actually tested using a MacBook Pro to get it running. But, I also ran telnet on a Raspberry Pi just to be sure I could communicate via WiFi from there as well!
I assume the output you pasted here is from the flexprop main window. What shows up in your flexprop terminal when you run this?
This is interesting, on my setup, it seems like nothing is working as expected. But on your MacBook it seems to be working as expected. Not sure what to make of this. I must be doing something terribly wrong.
I will keep hacking at this, but it seems like this is not worth the effort, I mean working with telnet, for this situation.
I did a simple program, just using ser.rx(), and that does seem to work.
I updated flexprop to 5.9.4, could their be some problem there.
Ray
I don't think flexprop is the problem (it compiles other code, I assume? It loads the P2 board & runs other binaries?). i.e. if you can compile/load/run the simple blink1.bas or blink1.spin2 example from flexprop's samples directory, flexprop is good to go.
Are you setting up (plugging in) the WiFi module as shown in the images I posted? When powered are you able to bring up the WiFi Module's webpage in a web browser that is on the same network? (my network IPs are something like: 10.0.0.nnn, where 'nnn' is unique to a particular WiFi Module). If so, what are the modules settings?
Steps to debug just the ability for telnet to find and communicate with the WiFi Module:
1. Ability of flexprop to compile/load/run code samples
2. WiFi Module is powered and the blue LED is blinking (if lit but not blinking, it is in AP-ONLY mode, which is not what you want)
3. The WiFi Module has an IP number other than 192.168.4.1 (meaning it is in a 'STA' mode or 'STA+AP' mode)
4. The WiFi Module's webpage is accessible in a web browser. You may need to use 192.168.4.1 to initially get to the Module's webpage, but change to STA or STA+AP mode and setup the module to gain a local IP number.
5. Use telnet (on macOS or Linux... Not sure about WIN) $ telnet the.local.IP.number
6. If telnet appears to have found the module, type some text and see if the module's rx & tx LEDs flash
If you can get that far, you can start to debug the .spin2 code!
Thanks dgately, for all the information and assistance. Hopefully I will get there at some point.
Ray