CYW943907AEVAL1F tcp transmition speed?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Good day, i have measured TCP transmission speed, and im very surprised.

I got only around 250KB/s, why speed is so slow, I tried 5G and 2.4G WIFI, transfered locally with 1Gb router?

Actually i tried to measure MicroSD speed and got good results.

I think 320-MHz Arm Cortex-R4 should be much faster...

Maybe Im doing something wrong?

Here is my code:

#include "wiced.h"

#define TCP_PACKET_MAX_DATA_LENGTH        1024

#define TCP_CLIENT_INTERVAL               10

#define TCP_SERVER_PORT                   111

#define TCP_CLIENT_CONNECT_TIMEOUT        60000

#define TCP_CLIENT_RECEIVE_TIMEOUT        60000

#define TCP_CONNECTION_NUMBER_OF_RETRIES  10

#define TCP_SERVER_IP_ADDRESS MAKE_IPV4_ADDRESS(192,168,31,10)

static wiced_result_t tcp_client1();

static wiced_tcp_socket_t  tcp_client_socket1;

#define TCP_SERVER_THREAD_PRIORITY          (WICED_DEFAULT_LIBRARY_PRIORITY)

#define TCP_SERVER_STACK_SIZE               (1024*10)

#define BUFFER_SIZE                         512

typedef struct

{

    wiced_bool_t quit;

    wiced_tcp_socket_t socket;

}tcp_server_handle_t;

static wiced_thread_t      tcp_thread1;

static tcp_server_handle_t tcp_server_handle1;

void application_start(void)

{

    wiced_result_t result;

    wiced_init( );

    wiced_network_up( WICED_STA_INTERFACE, WICED_USE_EXTERNAL_DHCP_SERVER, NULL );

    wiced_tcp_create_socket( &tcp_client_socket1, WICED_STA_INTERFACE);

    wiced_tcp_bind( &tcp_client_socket1, TCP_SERVER_PORT );

    wiced_rtos_create_thread(&tcp_thread1, TCP_SERVER_THREAD_PRIORITY, "speed_test", tcp_client1, TCP_SERVER_STACK_SIZE, &tcp_server_handle1);

    WPRINT_APP_INFO(("\ntcp speed task created!"));

    while(1);

}

wiced_result_t tcp_client1( void* arg )

{

    wiced_result_t           result;

    wiced_packet_t*          packet;

    char*                    tx_data;

    uint16_t                 available_data_length;

    const wiced_ip_address_t INITIALISER_IPV4_ADDRESS( server_ip_address, TCP_SERVER_IP_ADDRESS );

    int                      connection_retries;

    char data_buffer[BUFFER_SIZE];

    uint32_t i = 0;

    wiced_time_t    scan_start_time;

    wiced_time_t    scan_end_time;

    UNUSED_PARAMETER( arg );

    connection_retries = 0;

    do

    {

        result = wiced_tcp_connect( &tcp_client_socket1, &server_ip_address, TCP_SERVER_PORT, TCP_CLIENT_CONNECT_TIMEOUT );

        connection_retries++;

    }

    while( ( result != WICED_SUCCESS ) && ( connection_retries < TCP_CONNECTION_NUMBER_OF_RETRIES ) );

    if( result != WICED_SUCCESS)

    {

        WPRINT_APP_INFO(("Unable to connect to the server! Halt.\n"));

    }

    if (wiced_packet_create_tcp(&tcp_client_socket1, TCP_PACKET_MAX_DATA_LENGTH, &packet, (uint8_t**)&tx_data, &available_data_length) != WICED_SUCCESS)

    {

        WPRINT_APP_INFO(("TCP packet creation failed\n"));

        return WICED_ERROR;

    }

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

    {

        data_buffer = 'w';

    }

    wiced_time_get_time(&scan_start_time);

    i = 0;

    while(1){

    wiced_tcp_send_buffer( &tcp_client_socket1, &data_buffer[0], BUFFER_SIZE);

    i++;

    if(i >= 250){

    i = 0;

    wiced_time_get_time(&scan_end_time);

    WPRINT_APP_INFO(("\nspeed: %d KBs", (int)(((BUFFER_SIZE*250000) / 1024) / (int)(scan_end_time - scan_start_time))));

    wiced_time_get_time(&scan_start_time);

    }

    }

    wiced_tcp_disconnect(&tcp_client_socket1);

    return WICED_SUCCESS;

}

0 Likes
1 Solution

Based on my understanding, the TCP client application is a very basic application where you simply open a socket ,send the data, receive a response and disconnect; this will then repeat every 2 seconds. In contrast, It's my understanding that iperf will perform the data transfer in a single connection.

Essentially, the objective of the TCP client application is not really for performance measurement, but to demonstrate how to both use the WICED TCP client & how to communicate with a TCP server.

Again, we believe that the iperf client will send data over single connection, and the implementation will be more robust then our TCP client application.

View solution in original post

0 Likes
9 Replies
ToIn_1742091
Level 5
Level 5
10 solutions authored 5 solutions authored First solution authored

I think it is better to describe your setup what you are communicating with and how, so that people can do the same test. How about trying iperf on test.console? A few MB/s is possible on 2.4GHz. What is your target throughput?

Anonymous
Not applicable

Hi,

Thank you for your answer.

With test.console and iperf I got 108 Mbit on 5Ghz and 45 Mb on 2.4Ghz.

Is there an example of FTP for example or other protocol to test?

With previous example I used my own server to test the speed.

Maybe with Iperf device uses different sending function than this:

wiced_tcp_send_buffer( &tcp_client_socket1, &data_buffer[0], BUFFER_SIZE);

Thanks.

0 Likes
RaktimR_11
Moderator
Moderator
Moderator
500 replies posted 250 replies posted 100 replies posted

Generally, we recommend to use iperf for TCP, UDP throughput. Indeed iperf uses different sending function than the wiced level TCP APIs.

Do you mean a normal application code using wiced API cannot reach the throughput as iperf does?

Then what is the expected best throughput using wiced API?

AFAICT, 45Mb v.s. 250KB is a huge gap.

0 Likes
Anonymous
Not applicable

I need to do more test to be more precise with my tests.

Because i write my own tcp server, not sure if its written right.

Will check it later.

Im thinking writing my own ftp client to check what speeds I will get.

Will post results later..

Is it possible somehow to use Iperf functions?

Thanks.

0 Likes
RaktimR_11
Moderator
Moderator
Moderator
500 replies posted 250 replies posted 100 replies posted

I am not sure about using Iperf functions. During our testing, we used the TCP Stream APIs (Detailed help article: TCP stream API ) to measure throughput between two 43907 platforms and the throughput was found to be 14.6 MBps

Based on my understanding, the TCP client application is a very basic application where you simply open a socket ,send the data, receive a response and disconnect; this will then repeat every 2 seconds. In contrast, It's my understanding that iperf will perform the data transfer in a single connection.

Essentially, the objective of the TCP client application is not really for performance measurement, but to demonstrate how to both use the WICED TCP client & how to communicate with a TCP server.

Again, we believe that the iperf client will send data over single connection, and the implementation will be more robust then our TCP client application.

0 Likes
Anonymous
Not applicable

Good day,

I did some testing with filezilla ftp server and got some not bad results. I got around 3.2MB/s

wifi.jpg

0 Likes
Anonymous
Not applicable

With bigger buffer buffer, In 1st example i used 1kb buffer, in second example i used 4kb data buffer, got better (4.3 MB data rate).

4_2_speed.jpg

0 Likes