MQX4.0 and TWR-WIFI-AR4100 patch?

cancel
Showing results for 
Search instead for 
Did you mean: 

MQX4.0 and TWR-WIFI-AR4100 patch?

4,000 Views
fireblade
Contributor I

i just obtained a TWR-WIFI-AR4100 and instructions says to install an "enablement patch for MQX" but there are only versions for MQX 3.6.2 and 3.7 listed in downloads (http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=TWR-WIFI-AR4100&fpsp=1&tab=Design_Too...)

does this mean that it is already enabled in MQX4.0 or that no patch exists?

Tags (2)
25 Replies

397 Views
denisnechitailo
Contributor I

At the Downloads page (http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=TWR-WIFI-AR4100&fpsp=1&tab=Design_Too...), for some reason, I do not see any TWR-WIFI-AR4100 patches for the MQX at all.

Guys, can you confirm the files are removed? Or, do I do anything stupid?

0 Kudos

397 Views
sNilesh
Contributor III

Hi Denis,

We have all the patches and MQX versions with us. Let me know if oyu required it,

we can share with Drop-box.

Do you have AR4100P or AR4100 only ? Kindly confirm.

Regards,

Nilesh

0 Kudos

396 Views
denisnechitailo
Contributor I

Thanks! It would be really nice if you could share the code. I have no chips on hand yet, but think that they will be AR4100/6302 (i.e. without the integrated stack).

Just do not have too much info about these chips (will have to sign the NDA with Qualcomm), but hope for a better result than we got with the SIPs from TI and Nanoradio.

Thank you,

0 Kudos

396 Views
sNilesh
Contributor III

Hi,

Great , if no stack then it is AR4100. Which IDE are you going to use ?

Meantime we upload all the version and send you link for download.

Thanks,

Nilesh

0 Kudos

396 Views
sNilesh
Contributor III

Hello,

I may need you e-mail ID. Kindly let me know so i can share with it.

Regards,

Nilesh

0 Kudos

396 Views
sNilesh
Contributor III

Hello ,

Check if you can download it from here : https://www.dropbox.com/s/sa766llgi6fwxfn/TWR_WIFI_AR4100_MQX3_8_0_Patch.exe

Regards,

Nilesh

0 Kudos

396 Views
denisnechitailo
Contributor I

Thanks a lot! At least now I can see what I will have to deal with (possibly, by using the CW IDE), even before starting.

0 Kudos

396 Views
sNilesh
Contributor III

Hi Denis,

Great !! This is just Atheros Driver Patch . You must need to download CW IDE as well as the MQX3.8 too. Let me know if you not able to find out MQX3.8. For CW IDE , i think CW10.4 only available on Freescale website. If you need older versions let me know. I will upload it.

Regards,

Nilesh

0 Kudos

397 Views
Martin_
NXP Employee
NXP Employee

Actually, patch exists only for MQX 3.6.2 and MQX 3.7, No official patch for MQX 4.0 at the moment.

What can be done is to take MQX 3.7 patch for TWR-WIFI-AR4100 and integrate the source code files into MQX 4.0. This solution uses the MQX 4.0 I/O SPI driver to communicate with the Wi-fi chip. Some time ago I did this work for TWR-K60D100M, I describe my steps here.

1)
Download and install TWR-WIFI-AR100 patch for MQX 3.7. This doesn't require to have MQX 3.7 installed and I would recommend to use an empty directory for the installation path, as the source code files of the patch would be isolated from MQX 3.7 source code files.

If MQX 3.7 is installed, no problem, the patch can be installed to this folder too; the patch source files are listed then in the text file "atheros_manifest.txt".

2)
copy all files and subfolders from:
C:\Freescale\Freescale MQX 3.7\Mqx\source\io\enet\atheros_wifi\*.*

copy to:
C:\Freescale\Freescale MQX 4.0\Mqx\source\io\enet\atheros_wifi\*.*

3)
overwrite file. from:
c:\Freescale\Freescale MQX 3.7\mqx\source\io\enet\enet_wifi.h

to:
c:\Freescale\Freescale_MQX_4_0\mqx\source\io\enet\enet_wifi.h
(we need

#define ENET_MEDIACTL_VENDOR_SPECIFIC                            _IO(IO_TYPE_MEDIACTL_WIFI,0x81)

4)
copy from:
c:\Freescale\Freescale MQX 3.7\mqx\source\io\enet\phy\atheros_phy.c
c:\Freescale\Freescale MQX 3.7\mqx\source\io\enet\phy\atheros_phy.h

copy to:
c:\Freescale\Freescale_MQX_4_0\mqx\source\io\enet\phy\atheros_phy.c
c:\Freescale\Freescale_MQX_4_0\mqx\source\io\enet\phy\atheros_phy.h

5)
clone BSP of your board. for example I use MQX 4.0 bsp clone tool to clone twrk60d100m BSP into twrk60d100m_atheros.

6)
CW 10.3 (or 10.2 if you wish), drag & drop the .wsd file of the new BSP to the CW 10.x Projects window.
c:\Freescale\Freescale_MQX_4_0\config\twrk60d100m_atheros\cw10\twrk60d100m_atheros.wsd

7)
Add the new folder files (from steps 1) to 4) above) to the bsp build project.
(in CW 10.3, we can just drag atheros_wifi folder and drop into bsp->Peripheral IO Drivers->enet. I choose the option to "Link to files and recreate folder structure with virtual folders" relative to MQX_ROOT_DIR.


Add the following C compiler include search paths into the C compiler properties:

"${MQX_ROOT_DIR}/mqx/source/io/enet/atheros_wifi"
"${MQX_ROOT_DIR}/mqx/source/io/enet/atheros_wifi/include"
"${MQX_ROOT_DIR}/mqx/source/io/enet/atheros_wifi/include/AR6002"
"${MQX_ROOT_DIR}/mqx/source/io/enet/atheros_wifi/custom_src/include"
"${MQX_ROOT_DIR}/mqx/source/io/enet/atheros_wifi/custom_src/stack_custom"
"${MQX_ROOT_DIR}/mqx/source/io/enet/atheros_wifi/common_src/include"
"${MQX_ROOT_DIR}/mqx/source/io/enet/atheros_wifi/common_src/stack_common"
"${MQX_ROOT_DIR}/mqx/source/io/enet/atheros_wifi/common_src/wmi"

9)
in user_config.h for the new BSP,
c:\Freescale\Freescale_MQX_4_0\config\twrk60d100m_atheros\user_config.h

define the following definitions:

#define BSPCFG_ENABLE_GPIODEV 1 #define BSPCFG_ENABLE_SPI2    1 #define BSPCFG_ENABLE_ATHEROS_WIFI 1 #define RTCSCFG_ENABLE_IP_REASSEMBLY 1 #define RTCSCFG_ENABLE_IGMP      1


10)
in BSP init_enet.c we need to add 2nd enet device:

#if BSPCFG_ENABLE_ATHEROS_WIFI #include <atheros_wifi.h>  #include <atheros_phy.h> #endif /* BSPCFG_ENABLE_ATHEROS_WIFI */

#if BSPCFG_ENABLE_ATHEROS_WIFI

const ENET_IF_STRUCT ENET_1 = {      &ATHEROS_WIFI_IF,      &ATHEROS_PHY_IF,      1,      1,      0, };

ATHEROS_PARAM_WIFI_STRUCT atheros_wifi_param = { BSP_ATHEROS_WIFI_SPI_DEVICE,     BSP_ATHEROS_WIFI_GPIO_INT_DEVICE,     BSP_ATHEROS_WIFI_GPIO_INT_PIN,     BSP_ATHEROS_WIFI_GPIO_PWD_DEVICE,     BSP_ATHEROS_WIFI_GPIO_PWD_PIN }; #endif /* BSPCFG_ENABLE_ATHEROS_WIFI */

additions to the ENET_PARAM_STRUCT struct:

#if BSPCFG_ENABLE_ATHEROS_WIFI     {      &ENET_1,        // # Default WiFi Device parameter      Auto_Negotiate,      0,

     BSPCFG_TX_RING_LEN,   //  # NOT USED IN ATHEROS WIFI      BSPCFG_TX_RING_LEN,   //  # NOT USED IN ATHEROS WIFI      ENET_FRAMESIZE,       //  # NOT USED IN ATHEROS WIFI           BSPCFG_RX_RING_LEN,   //  # NOT USED IN ATHEROS WIFI      BSPCFG_RX_RING_LEN,   //  # NOT USED IN ATHEROS WIFI      ENET_FRAMESIZE,       //  # NOT USED IN ATHEROS WIFI      BSP_CONFIG_ATHEROS_PCB,   //  # rx PCBs           0,          0 ,      (pointer)&atheros_wifi_param       }, #endif  /* BSPCFG_ENABLE_ATHEROS_WIFI */

11)
in BSP init_spi.c
-----------------------------------
change _bsp_spi2_init structure Baudrate from 10000000 to 20000000

12)
in BSP twrk60d100m_atheros.h
-----------------------------------
change BSP_ENET_DEVICE_COUNT to

#define BSP_ENET_DEVICE_COUNT    (MACNET_DEVICE_COUNT +(BSPCFG_ENABLE_ATHEROS_WIFI?1:0))

add:

#define ATHEROS_WIFI_DEFAULT_ENET_DEVICE    1

#if BSPCFG_ENABLE_SPI2 /* in file name, number after : is the mask for chip select. chip select 0 in this case. */ #define BSP_ATHEROS_WIFI_SPI_DEVICE                 "spi2:1" #else #error "SPI2 must be defined in user_config.h" #endif #define BSP_ATHEROS_WIFI_GPIO_INT_DEVICE            "gpio:input" #define BSP_ATHEROS_WIFI_GPIO_INT_PIN               (GPIO_PORT_A|GPIO_PIN_IRQ_FALLING|GPIO_PIN27) #define BSP_ATHEROS_WIFI_GPIO_PWD_DEVICE    "gpio:write" // corresponds to B23 on elevator #define BSP_ATHEROS_WIFI_GPIO_PWD_PIN    (GPIO_PORT_E|GPIO_PIN28)

13)
in atheros low level, we need to add couple of minor modifications:
c:\Freescale\Freescale_MQX_4_0\mqx\source\io\enet\atheros_wifi\custom_src\hw_interface\cust_hw_api.c

on lines 112 adn 157 add the source code line:

fflush(GET_DRIVER_CXT(pCxt)->spi_cxt);

remove lines 265-268 ioctl(SPI_SET_CS). it is not needed.

14)
in file:
C:\Freescale\Freescale_MQX_4_0\mqx\source\io\enet\atheros_wifi\custom_src\driver\cust_driver_netbuf.c

on line 52
change from:

a_netbuf_ptr->native.FREE = (_pcb_free_fn)freefn;

change to:

a_netbuf_ptr->native.FREE = (PCB_FREE_FPTR)freefn;

15)
Ready to build BSP and other MQX libs.

16)
After build, copy two header files

copy from:
"c:\Freescale\Freescale_MQX_4_0\mqx\source\io\enet\atheros_wifi\custom_src\include\a_types.h"
c:\Freescale\Freescale_MQX_4_0\mqx\source\io\enet\atheros_wifi\atheros_wifi_api.h

copy to:
"c:\Freescale\Freescale_MQX_4_0\lib\twrk60d100m_atheros.cw10\debug\bsp\a_types.h"
"c:\Freescale\Freescale_MQX_4_0\lib\twrk60d100m_atheros.cw10\debug\bsp\atheros_wifi_api.h"

At this point we should be fine to make a Wi-fi application. For this we can use c:\Freescale\Freescale_MQX_4_0\rtcs\examples\httpsrv\

Import this project into your workspace.
c:\Freescale\Freescale_MQX_4_0\rtcs\examples\httpsrv\cw10\httpsrv_twrk60d100m_atheros\
after import, set its build configuration to Int_Flash_Debug.

Attached are the httpsrv example demo files with Atheros Wifi.
It runs two http servers.
One over Ethernet on 192.168.1.200
Second over Wi-fi on 192.168.1.201
Wi-fi access point name is "atheros_demo"

Tried on TWR-K60D100M, TWR-SER, TWR-WIFI-AR4100, with CW 10.3 IDE to build MQX 4.0 and twrk60d100m_atheros BSP. "ttyd:" = RS232 on TWR-SER used as default MQX IO channel (BSP_DEFAULT_IO_CHANNEL).

397 Views
chinniwhites
Contributor II

I have K60D100M, TWR-SER, and TWR_WIFI_AR4100 just like you.  I have freshly installed CW 10.6, MQX 4.0.2, and atheros_4.0.2 patch.  I would love to get webserver running on both interfaces as you do in the above but I dont know how many how these steps actually still apply after installing atheros_4.0.2 patch.  I have tried loading in almost all of the atheros demo examples and can get none of them to work correctly.  For example, on throughput demo, I can find no SSID of LINK4S4, and when I do ipconfig via shell prompt - it shows the correct ip address but link is down.  Web_hvac demo runs when USE_DEMO_WIFI is 0 and webserver runs on Ethernet port.  When I switch to USE_DEMO_WIFI is 1, then no such luck.  Shell prompt states webserver is running but when I do ipconfig, link is down.  Please help!

0 Kudos

397 Views
sNilesh
Contributor III

Hello Martin,

We have done all the steps with : MQX4.0 and Atheros patch.We have executed all the steps given , but when reached to step no. 15 , we have build error. May i know what is the cause and not able to see the error too.

For your reference image is attached.

Regards,

Nilesh

0 Kudos

397 Views
fireblade
Contributor I

ive done that and all seams to compile correctly

but when run it seems to get stuck somewhere inside ipcfg_init_device for the atheros device,

0 Kudos

397 Views
Monica
Senior Contributor III

Christopher, have you had any breakthroughs?

Keep us posted! :smileywink:

Regards!

0 Kudos

397 Views
Martin_
NXP Employee
NXP Employee

Which TWR processor board do you use ? When I was debugging the spi communication, I found the first spi transaction occurs in Hcd_Init() in the source file:
c:\Freescale\Freescale_MQX_4_0\mqx\source\io\enet\atheros_wifi\common_src\hcd\spi_hcd.c


There is a call to DoPioWriteInternal(), which is the first spi communication with the Wi-fi chip out of reset. Shortly after that there is

status = DoPioReadInternal(pCxt, ATH_SPI_WRBUF_SPC_AVA_REG, &pDCxt->hcd.WriteBufferSpace);


Debug this code to make sure the SPI communication is working, WriteBufferSpace should read EXPECTED_MAX_WRITE_BUFFER_SPACE. If it doesn't, the spi communication is not functioning. Put oscilloscope probes to spi bus signals and see if there is everything as it should be.


In the source code, double check if you have modified all steps for spi chip select:

- the chip select 0 is in the spi file name: "spi2:1"

#define BSP_ATHEROS_WIFI_SPI_DEVICE                 "spi2:1"

- completely remove a call to

ioctl (pCustCxt->spi_cxt, IO_IOCTL_SPI_SET_CS, &input))

from Custom_HW_Init()

0 Kudos

397 Views
aisebastian
Contributor II

Hello again, Martin

Sorry for late reply and thank's for your prompt response; I switched everything to MQX4.0 to be on par with these instructions and followed them exactly. the ipcfg_init_device still returns A4FF. Is there any jumper setting that I need to change, or anything else? I tried with the httpd demo with your modified files.

I have yet to inspect the signals with an osciloscope. Do you have any further hints as to what might go wrong?

P.S. The ENABLE_GPIODEV generates a preprocessor error, instructing me to use the LWGPIO driver instead. I tried commenting out the preprocessor error and removing the GPIODEV_ENABLE and neither worked.

Thanks,

Sebastian

0 Kudos

397 Views
Martin_
NXP Employee
NXP Employee

Sebastian, comment out the preprocessor error. Because you have to enable BSPCFG_ENABLE_GPIODEV in user_config.h, because the wi-fi stack uses this driver.

on the thread below, another user gives feedback that he has the code working. he had to remove SD card from the slot on his hardware. also suggested to test at 10 MBits first, then 20 MBits.

https://community.freescale.com/message/327111#327111

0 Kudos

397 Views
aisebastian
Contributor II

Thanks again for your quick reply.

So, I disabled the preprocessor error, and enabled GPIODEV in user_config.h.

I also removed TWR-SER from the setup, now I only have AR4100 on top and K60F120M in the second position.

The SDCARD problem appears when the J12 from the AR4100 is set to 2-3 (Tower System GPIO3 will control reset/power down of AR4100), because GPIO3 is connected to PTE28, which is also the SD Card Detect pin. But I don't have a card inserted. I also changed the

#define BSP_ATHEROS_WIFI_GPIO_INT_PIN               (GPIO_PORT_A|GPIO_PIN_IRQ_FALLING|GPIO_PIN27)  

in your example to

#define BSP_ATHEROS_WIFI_GPIO_INT_PIN               (GPIO_PORT_B|GPIO_PIN_IRQ_FALLING|GPIO_PIN7)

Because on K60F120M the IRQ_A is PTB7, and the J16 is set on the AR4100 (Tower System IRQ_A will connect to AR4100 SPI_INT).

I tried with baudrates 10000000 and 20000000 and I got the same result: error 0xA4FF. There must be something I'm missing, but I can't figure out what.

Thanks,

Sebastian

0 Kudos

397 Views
aisebastian
Contributor II

I redid all the steps and it seems to work now. I must have broke something while tinkering with the bsp and demo app. Now it works perfectly. Thank you all for your help

0 Kudos

397 Views
ThomNet
Contributor III

Hi Sebastian,

are you using a DHCP server with your application?

Regards

Thomas

0 Kudos

397 Views
aisebastian
Contributor II

Hi Thomas,

Yes, and it works. I am also using wpa2/tkip, no issues. It works on both button reset and power cycle

Sebastian

0 Kudos