9 Replies Latest reply on Nov 23, 2018 11:10 AM by nikolaj.kovaliov_2628191

    CYW943907AEVAL1F tcp transmition speed?

    nikolaj.kovaliov_2628191

      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[i] = '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;

       

      }