Skip navigation
Home > All Places > WICED Studio Wi-Fi/Combo > WICED Studio Wi-Fi/Combo Forums > Blog > 2018 > July

TCP stream API

Posted by PriyaM_16 Moderator Jul 29, 2018

WICED provides multiple APIs to implement a TCP connection. This blog discusses the TCP stream_read/write APIs which are more convenient for receiving/sending a large chunk of data.

The usual flow of sending TCP packets is: packet creation-> write data into packet-> set the end of the data portion-> send the packet -> delete the packet.

This method of sending TCP packets turns out to be cumbersome for large chunk of data as one has to go back and forth between packet creation and deletion. The TCP stream APIs provide a better way to stream successive data without worrying about the packet boundaries. The TCP stream APIs takes care of creating the packet and sending it unless the entire buffer is sent. The following diagram gives a simple overview of differences between existing APIs and stream APIs:


Please refer the wiced_tcpip.h file in 43xxx_Wi-Fi\include dir for description of the provided TCP APIs. Some of the stream APIs are listed below:

wiced_result_t wiced_tcp_stream_init( wiced_tcp_stream_t* tcp_stream, wiced_tcp_socket_t* socket );

wiced_result_t wiced_tcp_stream_write( wiced_tcp_stream_t* tcp_stream, const void* data, uint32_t data_length );

wiced_result_t wiced_tcp_stream_write_resource( wiced_tcp_stream_t* tcp_stream, const resource_hnd_t* res_id );

wiced_result_t wiced_tcp_stream_read( wiced_tcp_stream_t* tcp_stream, void* buffer, uint16_t buffer_length, uint32_t timeout );

wiced_result_t wiced_tcp_stream_read_with_count( wiced_tcp_stream_t* tcp_stream, void* buffer, uint16_t buffer_length, uint32_t timeout, uint32_t* read_count );

wiced_result_t wiced_tcp_stream_flush( wiced_tcp_stream_t* tcp_stream );


Please find attached the tcp_client application modified to use the wiced_tcp_stream_write() API.

This blog dicusses the download procedure on CYW43907 using external JTAG device - Jlink Segger in WICED SDK 6.2 and future releases.  Blog Downloading and debugging CYW43907 using Jlink Segger is valid only for SDKs prior to WICED SDK 6.2.


The hardware connections to connect CYW943907AEVAL1F's JTAG with j-link are tabulated below:



Segger jlink





































The switches in SW4 on CYW943907AEVAL1F need to be closed to use an external JTAG. (By default the switches are open)



To Download the application, we need J-Link tool: Please download J-Link tool from SEGGER website and install it. As CYW4390x was not a part of the supported devices list of SEGGER J-LInk, we need to make use of flashloader tool from SEGGER to drive the sflash of CYW4390x. Please copy flashloader_CYW4390x_QSPI.elf as attached here to the Devices/Cypress/ folder in Segger Installation directory (should look something like this: C:\Program Files (x86)\SEGGER\JLink_V640\Devices\Cypress). Modify JLInkDevices.xml in the same directory for adding CYW4390x in support list.




        <ChipInfo Vendor="Cypress" Name="CYW43907" Core="JLINK_CORE_CORTEX_R4" WorkRAMAddr="0x004A0000" WorkRAMSize="0x00100000" JLinkScriptFile="Devices/Broadcom/BCM43907.JLinkScript" />

        <FlashBankInfo Name="QSPI Flash" BaseAddr="0x14000000" MaxSize="0x08000000" Loader="Devices/Cypress/flashloader_CYW4390x_QSPI.elf" LoaderType="FLASH_ALGO_TYPE_OPEN" />





For programming the image via J-Link connector, the JLink path need to be declared in WICED build string. Add the path of JLink.exe from the downloaded J-Link tool.


Example: For downloading test.console application, make the target as follows

test.console-CYW943907AEVAL1F JTAG=jlink-native  JLINK_PATH="C:/Program\ Files\ \(x86\)/SEGGER/JLink_V630c/" JLINK_EXE="JLink.exe" download run


To debug through J-Link, you need to create your own J-Link debug configuration in WICED Studio, details about which can be found out in the attached document.


     The difference between Signal mode and Direct mode is: we only need to connect the EVB with the test AP created by AP, then AP will have a menu to test TX and RX related. Its aim is to figure out if the actual running power is matching what you want, RX path has no RF de-sense in a normal running mode.   If signal mode passed all the RF standard, we can have a confidence that current RF path include TX and RX, current RF configuration like NVRAM have no critical issues.  We can move the product into next long-run function tests.


  • Which EVB is for the tests?

I choose 43340 because it has 2.4G and 5G together.

  • How to set 8860C before test.

       1. Set the static IP address


    2.  configuration .


Which means creating a AP at 153 channel with 6M rate and power is -15dbm.

After AP created we use command to join the AP, then we can do the test .



  • Which application is needed for the tests?

I used the command console for the test because we can use a lot of embedded commands to join a specific AP and do some command input. 

And we are using the normal firmware for the test, please see the command output.

         test.console-BCM943340WCD1 download run


  • Which commands are needed before the tests?

After connection established “scan_suppress 1” , “roam_disable ” are preferred .

PM = 0 is good to be set also.

In command console:

Usage: scan_disable <1 = disable scan|0 = enable scan>

> scan_disable 1

If you didn’t have this command, please add it according another blog.


  • How to change country for a test ?

Please input “set country ”, then get channel , choose one channel to do connection with the AP created by instrument.

     > get_country

         Country is US (US/0)

     > set_country CN/0

     > get_country

         Country is CN (CN/0)

     > get_channels

          1  2  3 4  5  6  7  8 9  10  11 12  13  149 153  157  161 165  >

  • TX test results



The Tx power test determines if transmitter path can work normally with a specific power like 18dbm at 11b 11M rate.  The RX sensitivity test determines if the receiver path can receive a relatively weak signal such as -85 db at 11b 11M rate.


We usually recommend that the customer use a certified partner module since the module partner themselves have already performed all the testing before releasing into the broad market. This Help Article was created to show a basic test procedure which allows the customer to determine if the issue encountered is on the RF hardware or software side.



Test machine Instructions :

MT8860C : 802.11b/g/a, 2.4G, 5G

MT8862A : IEEE802.11a/b/g/n/ac , 2.4G and 5G

IQ2010 :  802.11 a/b/g/n , 2.4G, 5G

IQxel :  802.11 a/b/g/n/ac ,  11AC HT80 and HT160

I will use MT8860C with CYW43340WCD1-EVB to show the test process.


Test Prepare:

please also read the application notes from WICED studio in detail.

  1. Read the doc from SDK release, WICED Manufacturing Test User Guide
  2. Wl tool, \43xxx_Wi-Fi\libraries\test\wl_tool\wl43340B0.exe
  3. Firmware, \43xxx_Wi-Fi\resources\firmware\43340\43340B0-mfgtest.bin
  4. NVRAM, \43xxx_Wi-Fi\platforms\BCM943340WCD1\wifi_nvram_image.h
  5. Script , \43xxx_Wi-Fi\libraries\test\wl_tool\scripts

Sometimes you need to update mfgtest.bin or modify NVRAM for the test, please find them in above place. Test scripts already integrate some test command lists, you can take them as a reference , sometimes we need to change some items for a test like rate, channel .


Test steps:

  1. test.mfg_test-BCM943340WCD1 download run
  2. After application is download and run, please use below command to make sure wl tool and serial port run well.

If you meet this issue, it means serial port is occupied. Please disable the log UART com and input the command again.


Make sure you will see a WLTEST string in the output.

3. connect the board to MT8860C by RF cable .

4.  Connect to MT8860C ,After scan complete, click Connect


5. Configure MT8860C into direct mode and the channel , rate needed.

The picture means 802.11g , channel 1 /2.4G, rate 54M, Direct mode


6. Set MT8860C attenuation.

Change the channel , and add the Path loss you assumed.  We often set to 1db or 1.5db with RF cable connected.


7. Change the script to be compliant with MT8860C setting, please see the compare.

Please see the script, we often change comport,  target WL tool,  band , channel info,  rate info.

if you meet test command problems , please raise case to us.


8.  If we set the power into 14dbm, please see the results.


9.  EVM results spec table.

You can get more from spec or Module maker, thanks.

802.11b /11Mbps : 16 dBm ± 1.5 dB @ EVM -9dB

802.11g /54Mbps : 15 dBm ± 1.5 dB @ EVM -25dB

802.11n /65Mbps : 14 dBm ± 1.5 dB @ EVM -28dB


10. RX sensitivity record

11b,  11Mbps PER @ -85 dBm,

11b,  1Mbps PER @ -90 dBm,


11g,  54Mbps PER @ -72 dBm,

11g,  6Mbps PER @ -86 dBm,


11n,  MCS=7 PER @ -69 dBm,

11n,  MCS=0 PER @ -85 dBm,

Filter Blog

By date:
By tag: