MQX Wi-Fi SoftAP Demo

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MQX Wi-Fi SoftAP Demo

MQX Wi-Fi SoftAP Demo

This MQX demo re-uses the standard MQX web_hvac demo with the GT202 Wi-Fi module setup in SoftAP mode. This example shows MQX RTCS, DHCP server, and web server running in the Kinetis MCU with the Atheros drivers. The client will be able to connect to the Soft Access Point, receive an IP address, and then use a web browser to view the web_hvac web pages.  The User Guide is included in the ZIP file.

Labels (1)
Attachments
Comments

This is really appropriate. I want to get this live on the IoTT asap! Iot.freescale.com

Has anyone made a similar port of this program in order to use instead with K60 and CW10.6?  I have a GT202 and Ethernet on my custom K60 board.  I wish to use the same webpages used to fuel the Ethernet jack via tfs to also fuel the GT202.  My HTTP_task is ported from some freescale example.  If anyone has any pointers how to get the GT202 to work as just another Ethernet interface that can be used with following code, please let me know.

void HTTP_task(uint32_t initial_data)

{

    int32                               error;

    uint32                              server[BSP_ENET_DEVICE_COUNT];

    extern const HTTPSRV_CGI_LINK_STRUCT cgi_lnk_tbl[];

    extern const TFS_DIR_ENTRY           tfs_data[];

    HTTPSRV_PARAM_STRUCT                 params[BSP_ENET_DEVICE_COUNT];

    uint32                              ip_addr[BSP_ENET_DEVICE_COUNT];   

    uint32                              i = 0;

    char*                                indexes[BSP_ENET_DEVICE_COUNT];

    uint8                                  n_devices = BSP_ENET_DEVICE_COUNT;

   

    #if !HTTP_USE_ONE_SERVER

    uint_8 n_servers = BSP_ENET_DEVICE_COUNT;

    #else

    uint8 n_servers = 1;

    #endif

   

    /* Install ramdisk - MFS init */

    //Ram_disk_start();

 

    /* RTCS init */

    rtcs_init();

    ip_addr[0] = ENET_IPADDR;

   

    /* Start HTTP server on each interface */

       for (i = 0; (i < n_devices) && (n_devices != 0); i++)

       {

           indexes[i] = (char*) _mem_alloc_zero(sizeof("\\index_x.html"));

           if (indexes[i] == NULL)

           {

               printf("\n Failed to allocate memory.");

               _task_block();

           }

       }

      

       /* Install trivial file system. HTTP server pages are stored there. */

       error = _io_tfs_install("tfs:", tfs_data);

      

       /* Start HTTP server on each interface */

       for (i = 0; i < n_servers; i++)

       {

           _mem_zero(&params[i], sizeof(HTTPSRV_PARAM_STRUCT));

           params[i].af = HTTP_INET_AF;  //IPv4, IPv6 or from config.h

           #if RTCSCFG_ENABLE_IP6

           /* Set interface number here. Zero is any. */

           params[i].ipv6_scope_id = HTTP_SCOPE_ID;

           #endif

           sprintf(indexes[i], "\\index.html", i);

           params[i].root_dir = "tfs:";

           params[i].index_page = indexes[i];

           params[i].auth_table = auth_realms;

           printf("Starting http server No.%d on IP", i);

           /*

           ** If there is only one server listen on any IP address

           ** so address can change in runtime (DHCP etc.).

           ** Otherwise we will use static IP for server.

           */

           if (HTTP_INET_AF & AF_INET)

           {

               #if RTCSCFG_ENABLE_IP4

               if ((i == 0) && (n_servers == 1))

               {

                   params[i].ipv4_address.s_addr = INADDR_ANY;

               }

               else

               {

                   params[i].ipv4_address.s_addr = ip_addr[i];

               }

               /* Print active IPv4 address */

               printf(" %d.%d.%d.%d", IPBYTES(ip_addr[i]));

               #endif

           }

           if (HTTP_INET_AF & AF_INET6)

           {

               #if RTCSCFG_ENABLE_IP6

               IPCFG6_GET_ADDR_DATA data;

               char prn_addr6[sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")];

              

               ipcfg6_get_addr_info_n(0, 0, &data);

               if(inet_ntop(AF_INET6, &(data.ip_addr), prn_addr6, sizeof(prn_addr6)))

               {

                   /* Print active IPv6 address */

                   printf("%s %s", (HTTP_INET_AF & AF_INET) ? " and" : "", prn_addr6);

               }

               #endif

           }

           /*

           ** Maximum default number of available sockets in RTCS is six.

           ** Maximum of two are used for HTTP server as listening sockets (one for IPv4 and one for IPv6).

           ** So we take two of sockets and use them for sessions.

           */

           params[i].max_ses = 2;

           params[i].cgi_lnk_tbl = (HTTPSRV_CGI_LINK_STRUCT*) cgi_lnk_tbl;

           /* There are a lot of static data in CGIs so we have to set large enough stack for script handler */

           params[i].script_stack = 2000;

           server[i] = HTTPSRV_init(&params[i]);

          

           printf("...");

           if (server[i] == RTCS_ERROR)

           {

               printf("[FAIL]\n");

           }

           else

           {

               printf("[OK]\n");

           }

       }  

   /*******************************

   *

   * START YOUR CODING HERE

   *

   ********************************/  

        

   for (;;) 

   {

       //_task_destroy(t1);

       //_sched_yield();

       _task_block();

      

       /*

       for(;;){

       

       }

       */

   }

}

Hi chinniwhites,

In MQX, you can have multiple ENET devices enabled in the BSP. But I’m not aware of an example that shows that with the GT202 and wired Ethernet.

I suggest you post a new question in the MQX Space so the MQX support staff will be aware of it and can respond.

https://community.freescale.com/community/mqx

Thanks

Hi,

1. I downloaded the soft_web_havc.zip file

2. When I opened opened the driver_plugins, there were files missing like:

a. atheros_wifi_api.h

b. atheros_wifi.h

c. iwcfg.h

d. maybe some others

3. Was this project built and successfully compiled with IAR and working with out errors?

4. My goal is to port this project to the FRDM-K64F using KDS with GT202 shield module

Hi Cliff,

Yes, the project builds and runs with IAR.

The iwcfg.h file is included with the MQX installation. And the other Atheros files you mention come from the patches needed for the GT202 driver. Please refer to the GT202 PDK Quick Start Guide which has the installation steps for the GT202 PDK. After following these steps, you should have all of these files.

http://download.siliconexpert.com/pdfs/2014/10/14/1/56/46/774/shenet_/manual/gt202mqxpdkquickstartan...

Thanks

Hello Derek,

1. I went through the gt202mqx.....configuration.pdf. Down load the needed files. This is for a IAR compiler.

2. I do not have an IAR compiler

3. I am using the  KDS_2.0.0 for develpment

4. What are the steps to the steps to convert from IAR to KDS build, compile, and run on a FRDM-K64F board

5. Has anyone had success with item #4.

6. I have compiled and ran successfully the httpserv demo on the KDS with the FRDM-K64F board. I even added my on web pages.

Thanks

Hi Cliff,

Yes, this SoftAP demo project uses IAR because the GT202 MQX example projects use IAR. I’m not aware of GT202 MQX example projects for other toolchains.

But as you know, MQX includes a FRDM-K64F BSP project for KDS. You can modify that project and add the Atheros driver to the BSP for the GT202. You can use the GT202 example BSP for the FRDM-K22F as a reference. There are also some changes to the provided BSP files needed to integrate the driver. You can find the changes made to the GT202 FRDM-K22F BSP files, compared to the original FRDM-K22F BSP files in the MQX installation. Then make similar changes in your K64 BSP.

The SoftAP application example is based on the web_hvac demo included in MQX. That demo also has a KDS project for the FRDM-K64F. So your application can start with that demo project, and then copy over the source files from the SoftAP demo. With the GT202 driver in your BSP, you can then build this SoftAP application.

Hope that helps. Thanks

Hello Derek,

1. I could not located the MUX web_hvac DEMO project in for KDS_1.1.0.

2. If I go to directory c:\Freescale\KDS_1.1.0\tcpip\rtcs\examples, I find only the httpsrv demo in KDS. It does not use BSP files.

3. If I go to directory c:\FreescaleKDS_1.1.0\rtos\mqx\examples, There is no web_havc demo in KDS.

4. Where do I find this web_hvac  FRDM-K64F BSP project for KDS?

Best Regards,

Cliff

Hi Cliff,

It looks like you are referring to KSDK v1.1.0<http://www.freescale.com/KSDK> below. The Kinetis Software Development Kit (KSDK) is a library of drivers, stacks, and RTOS like MQX. Kinetis Design Studio (KDS)<http://www.freescale.com/KDS> is our toolchain for building Kinetis applications. The example locations you reference below are part of KSDK.

The web_hvac example comes from the MQX installation before MQX was integrated with KSDK. Currently that is MQX v4.1.1 or earlier. When you follow the installation instructions for the GT202 PDK, you will find web_hvac demo installed at \Freescale_MQX_4_1\demo\web_hvac. I believe there are plans to port the web_hvac demo to MQX for KSDK, but it is not included as of the latest KSDK v1.1.0.

However, you should be aware that the GT202 driver has not been ported to KSDK yet. The GT202 driver and PDK were developed with MQX v4.1.0. If you choose to use GT202 with KSDK, you’ll need to port the driver and use the KSDK SPI and GPIO peripheral drivers. Or if you use MQX v4.1, the GT202 driver has already been ported for you.

Thanks

Derek,

I have CW10.6 and I am using MQX4.1 and was creator of this post.

I installed the GT202 MQX driver and I cannot find an updated web_hvac demo in location you described.  I believe it instead to be located under FRDMK22 specific folder that I have yet to locate.

I am using a K60 with MQX4.1 and wish to do what I described in original post.

Can you clearly detail the steps to take to port the atheros drivers for GT202 into my current K60 project?

Hello Derek,

1. I want to take some baby steps. As you can see if all this is integrated in the KSDK it would be much eaiser.

2. The DEMO application I am trying to build on the FRDM-K64 with the GT202 shield attached is the httpsrv. The web_hvac is more complex.

3. I down loaded the the Freescale_MQX_4_0_AR4100P. In the directory Freescale_MQX_4_0_AR4100P/rtcs/demo/atheros_wifi/examples/httpsrv. It contains web_pages, cgi, config, httpsrv, and trfs_data. This is a simple example  I could work with this web demo example for my application.

4. Also in Freescale_MQX_4_0_AR4100P/rtcs/demo/atheros_wifi/source/atheros_wifi contains comman_src(dir), custom_src(dir),include(dir), atheros_stack_offload, atheros_wifi, atheros_wifi_api, and atheros_atheros_internal. Are these the AR4100P drivers the same for the GT202 which uses a QCA4002 chip set?

5. To use the GT202 with the FRDM-K64F it appears that you need to use the SPI0 interface: on the K64F board use J2-12[PTD1](SPI0_CLK), J2-10[PTD3](SPI0_SIN), J2-08[PTD2](SPI0_SOUT), and J2-6[PTD0](SPI0_PCS0).

6. Please advise for next steps?

Thanks,

Cliff

Hi chinniwhites,

Sorry if I wasn’t clear regarding where to find web_hvac. The web_hvac demo is a standard MQX demo included in MQX v4.1.1 and earlier. It is located in \demo\web_hvac. When the instructions for installing the GT202 PDK are followed, one step is installing MQX v4.1.0. After that step, web_hvac demo will now be included in the installation.

When you install the GT202 PDK, it does not modify the web_hvac demo. It is still the original demo provided in the MQX installation. Earlier I was explaining that the SoftAP demo on this page was based of the web_hvac demo, and then modified to use the GT202 module and SoftAP feature. If you would like to see an updated web_hvac for the GT202, you can use this SoftAP demo as an example.

Since this page is in the DemoLab Community space, comments posted here will not be noticed by the MQX support team. If you have any questions specific to this SoftAP demo, let me know. If you have other MQX questions, it’s better if you create a new discussion in https://community.freescale.com/community/mqx

Thanks

Hi Cliff,

Did you make any progress on your own? I find myself in a similar situation. It's kind of frustrating that a board that interfaces directly with a Kinetis development board, running a Freescale OS hasn't been ported for use with the Kinetis Development Studio.

Larry

Hi,

I've downloaded the above softap_web_hvac.zip-file and extracted it to my MQX 4.1.0 folder, opened IAR workbench 7.4, opened the softap_web_hvac_frdmk22f120m- IAR IDE Workspace (MQX 4.1.0 is rebuild completely) and hit the "Make"- button.

Result: Total number of errors: 21!! ooouups!? :-(

Before I start to work manually on the preprocessor contents, did I mad something completely wrong?

Thanks for any answer or help or good idea!!

Best

Thomas

Hi Thomas

Did you follow the steps in the user guide to add the MQX patches needed for the Qualcomm Wi-Fi module?

Hi Derek,

thanks for your response.

I have moved a step further and a step back, because my original approach is to port your application to a solution with the tower system in conjunction with the SX-ULPAN-EVK from silex plus the TWR-K21F120m from Freescale, so a little bit different from the original HW design.

I have rebuild the RTOS for the TWR-K21F120m with all added Atheros Wifi files at the right place.

In the bsp build part everyhing works fine, but for the usbd build part I'm getting the error message: "Error [Pe020]:identifier"_enet_address" is undefined" (5x) with the result, that no usbd.a file is generated, which causes a lot of linker error messages popping up. Any idea or advice?

The compiler build process of your softap_web_hvac demo goes through without any error messages.

What is your general opininion:

Is the way I'm going with my described hardware a good way or will I stuck in the dessert? The SX-ULPAN is a nice and very small WiFi- module for 2.4 GHz and 5 GHz, that's the reason I like it.

Thanks again for a response and an opinion on my approach.

Best

Thomas

Hi Thomas

It sounds like the error you see when building the USB Device library is related to the changes made in the TWR-K21F120M BSP. Since the issue is not specific to the Soft AP demo shared here, I suggest you create a new post in the MQX Community space. That way, the MQX support team will see it as an unanswered question. They won't see the comments added to this page in their support queue.

Here's the link to that space. Thanks

https://community.freescale.com/community/mqx

Derek Snell - sent from my mobile phone

Freescale Semiconductor

Work: (317) 252-5297<tel:(317)%20252-5297>

Cell: (317) 966-3562<tel:(317)%20966-3562>

derek.snell@freescale.com<mailto:derek.snell@freescale.com>

Hi Derek,

I am using IAR 7.40.3

1- I have installed all necessary as said in "Quick Start, Installation and Configuration Guide"

2- After doing this, i have done as said in "SoftAP web_hvac User Guide" Demo instruccion

3- Then I have changed BSP constants as said in "Changes to BSP"

4- Then I have built the demo and finally downloaded it.

5- I configure my terminal program as said in Using SoftAP Demo, point 1

When i run the demo what i see in the terminal program is the following screen capture instead of what it is shown in Using SoftAP Demo, point 2:

pastedImage_15.png

Please, what may i be doing wrong???

I have just seen that in "eninit.c" in the line where /* Initialize the MAC.*/ it goes  through the else

pastedImage_4.png

therefore in the RTCS.c gets stucked in the followiing while1

pastedImage_0.png

Any help will be appreciated

Thanks and best regards.

Hi Cliff

I want to include a GT202 module in my proyect, but I´m having problems. I'm using a FRDMK64F board and MQX 4.1. I use the development environment Kinetis Design Studio 3.0. Did you have lucky whit your migration? Can you help me in the process?

Thanks Cliff

Kevin Carcel

Hello,

So this is a year too late,  but see attached documents on how to use the GT202A softap project on a K64 using CW10.6 and MQX4.1.

SoftAP web_hvac User Guide.pdf

GT202A_MQX4.1_CW10.6_K64.docx  This document goes through changes made to the Atheros BSP driver for CW10.6

gt202a_softap_web_hvac.zip Modified softap webhvac for CW10.6

Cheers,

Ronen

Hello Ronen ,

I am a bit confused with document content. Which patch should I apply ?

On the website listed these 2 :

* GT202 Support Patch for NXP MQX RTOS 4.1 (with FRDM - K22F ) ( v3.0.2 )

* GT202 Support Patch for NXP MQX RTOS 4.1 (with FRDM - K22F ) ( v3.3 )

But I think you're missing something . In docx, you quote the cust_spi_hcd.c file, but did not find the file. Could you be kind enough to help me with more details ?

Grateful!

Orlando

Hi RBORB​,

The step 2a from your document GT202A_MQX4.1_CW10.6_K64.docx  require to remove the R38 resistor. Is this resistor in the FRDM-K64F board or GT-202 (arduino) shield?

Hi Everyone,

Any of you succeed to make this example work using the GT-202 with FRDM-K64F board and Kinetis Studio environment?

Hi RBORB​,

I'm trying to use GT202 with K64F and MQX 4.1.1 and KDS. Can you provide more details on how this integration could be done?

yb

Luis,

R38 from Arduino shield.

And then, solder a wire from J2-4 to the R38 pin which is near the silkscreen "L3".

J2 is the bigger connector (J2 silkscreen on the bottom).

yb

Not for the moment for me, even after a lot of hours (days...) :smileysad:

The demo is perfect with IAR and the FRDM K22, even with .bin rebuilding (throughput_demo).

But after, nothing with FRDM K64, MQX4.1 and CW10.6....

If somebody have beter results, please share :smileywink:

yb

I had the same problem :it depends on which "patch" you install.... You don't have this file with the patch for FRDMK22 (FSLMQX4.1_PATCH_GT202_3.0.2CS.exe and then  Setup_MQX4.1_GT202_3.0.2CS.exe) but I had this file with the QCA4004.MQX.exe patch).

If somebody should share the exact patches which are needed (names and link) and the ordrer to appy them, it will be perfect !

No ratings
Version history
Last update:
‎11-05-2014 07:27 AM
Updated by: