[Nov 16] Arch Linux mainline XFCE (20181104) / NetBSD ([201811111550Z) - 1080P Pinebook |[Nov 13] Slackware Aarch64 Miniroot & XFCE (20181101) / NextCloudPi (11-04-18) / Armbian Debian Stretch Desktop & Armbian Ubuntu Bionic (5.65) - Rock64 |[Nov 12] Q4OS ( 2.4-r5) - 1080P Pinebook / Pinebook |[Nov 09] KDE Neon ( 20181104-1500) - 1080P Pinebook / Pinebook /Arch Linux (20181104) - Pinebook

Project Inspiration | Get Started | IRC Logs | Forum Rules/Policy


Using WiFi API
#1
I am trying to use the WiFi api to connect the PADI to an access point. So far I have not had much luck, the documentation is a little difficult to follow and I have been unable to find an example that I can make work. My current program seems to get stuck when I call wifi_on() My program should print out a value on success or failure but instead it seems to hang. 

Has anyone had success using the WiFi api, or any ideas what might be going wrong? I have successfully used GPIO and Serial, I am using serial currently for simple debugging.

Note: I found an example that looks promising in the component/common/example/wlan_senario but I dont know how to compile and run this example on the padi. I am also confused by the printf statements in the program, where would these messages be printed to when using the PADI?

Any help would be appreciated

Thanks,
Dan
Reply
#2
many times the printf sends info to serial device[what you use for serial info] but as far as padi you would do best to track down mark and the quickest method is to use the irc chat channel for pine64. easiest way is to click on chat on top of this page, otherwise use chat client.
Reply
#3
Update: I have made some progress getting the WiFi api to work/using it, I can scan for networks with the API and connect to a secured access point. I am now running into an issue when trying to get a DHCP IP address.

I have a couple notes in case anyone sees this post and is trying something similar:
1. printf outputs to the UART_LOG serial port NOT the UART2 port that the quick start guide suggests to connect to. I probably should have realized/tried this earlier, but in case anyone else cant figure out where the debug output goes it is the UART_LOG port on the padi pinout diagram.

2. It seems WiFi API calls need to be made from within a task, I don't know if this is something obvious that I missed, but when trying to figure out why code from wifi examples was resulting in a stack overflow while the actual example code ran fine I discovered that the example code was executed from within a vTask. Once I executed my code in a vTask it mostly worked.

I am currently stuck while using LwIP to get a DHCP address, getting some message about being unable to allocate a pbuf for the packet. I will post more details or any solution I find after I have some more time to debug the issue.
Reply
#4
Progress Update: We have successfully acquired a DHCP IP address form our router, the issue we ran into with LWIP was that we were missing some initialization functions.

To connect to a wifi network we use the following initialization functions before starting the virtual task from the example sources:
//Initialize console
console_init();
//Initialize LwIP
LwIP_Init();
//Initialize wifi manager
wifi_manager_init();

Now that we are connected and have an IP the next step is to transmit some data over the network. There are a few examples in the 4.0 ameba SDK, but I have been unsuccessful in finding them in the 3.5 SDK. I would use the 4.0 SDK, but for some reason the network adapter seems to shut off when connecting to the Access Point. I am however able to successfully scan nearby networks. For now the plan is to try and port some relevant examples from the 4.0 sdk to the 3.5 sdk. If anyone has input on why we might be having issues with connecting to a network using code that works on the 3.5 sdk in the 4.0 sdk please let me know. Ill try to continue posting updates because it seems like there isn't much documentation for loading code to the PADI and maybe in the future someone will run into similar issues.
Reply
#5
I am looking for a small, inexpensive board to be used as a WiFi mesh node, which can also support a simple web server (just file serving only, but with upload capability). Is the PADI a good fit for this project?
Reply
#6
(07-28-2018, 02:28 PM)RWK Wrote: I am looking for a small, inexpensive board to be used as a WiFi mesh node, which can also support a simple web server (just file serving only, but with upload capability).  Is the PADI a good fit for this project?

My guess would be that the PADI is too resource constrained for your application. It should be possible to use as a basic webserver and I think there are examples in the SDK, file upload also sounds reasonable. The main problem I see would be that the resources are limited. From the specs you get 1MB ROM, 512KB RAM and 1MB FLASH. If you plan to store files locally then they will have to fit in the available resources. It is possible to add additional memory over an expansion bus, but I suspect a board like the Raspberry Pi Zero W might be more appropriate for your application. I do not know much about mesh networking so I am not sure if the PADI can support that.
Reply
#7
(10-20-2017, 08:37 AM)Dan Wrote: Progress Update: We have successfully acquired a DHCP IP address form our router, the issue we ran into with LWIP was that we were missing some initialization functions.

To connect to a wifi network we use the following initialization functions before starting the virtual task from the example sources:
//Initialize console
console_init();
//Initialize LwIP
LwIP_Init();
//Initialize wifi manager
wifi_manager_init();
Hi Dan,
have you managed to compile the standard `main.c' and get a working WiFi? When I do compile it and upload it to the board, it boots fine, can reboot too, but I never manage to get WiFi going. `ATWS' just doesn't print a line other than that it started its task and `ATPN=...' does give a MAC address it tries to associate with (so something must go right!) but can't connect to it either.
I tried to use your top on uninitialized functionality but when I add any of the LwIP init() or wifi_manager_init(), the AT command prompt on UART_LOG is just accepting input and printing '#' but not executing a single command.
As for the version of the toolkit, I downloaded the one from the PINE64 website just recently.

Do you have any tips for me to get WiFi working? Have you ever managed to keep the AT prompt? Or should I just abandon it and program/debug it over SWD and forget about that prompt.


With regards,
Reinoud
Reply
#8
(10-20-2017, 08:37 AM)Dan Wrote: Progress Update: We have successfully acquired a DHCP IP address form our router, the issue we ran into with LWIP was that we were missing some initialization functions.

To connect to a wifi network we use the following initialization functions before starting the virtual task from the example sources:
//Initialize console
console_init();
//Initialize LwIP
LwIP_Init();
//Initialize wifi manager
wifi_manager_init();
Can you please share the work so far? I.e. having a template that will setup WiFi, logs in and gets an DHCP? That would make all the difference to my project, and saves heaps of time.
If you're interested, i'm flashing my PADI using the SWD debugger independent of the makefile/gdb connection hack and without needing the OTA
Thanks in advance,
Reinoud
Reply
#9
I have had a similar problem. In my case, padi would connect to AP, but won't get IP address and then disconnect after a timeout. It was a LWIP configuration, within SDK has got some settings that were causing the chip to not get IP address from my DHCP server. I don't remember what I had change to make it working.

Start with a fixed IP and if everything is fine then you know, it's the same issue, LWIP config.
Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  Wifi problem at 166Mhz mirecta 5 396 11-14-2017, 02:32 PM
Last Post: Dan

Forum Jump:


Users browsing this thread: 1 Guest(s)