telnet server works over WiFi but not over Etherent

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

telnet server works over WiFi but not over Etherent

1,110件の閲覧回数
arielablumer
Contributor III

Hi,

I have a K66 based platform running  MQX 4.2.

I'm running  a telnet server for dumping logs. It somehow works well over WiFi (I get telnet disconnections) and doesn't work at all over Ethernet (no TCP connection is established),

I've seen the corresponding about improving telnet performance and tried some of the advices but still WiFi dump keeps disconnecting.

Any idea how to improve the WiFi or activate the Ethernet link?

Thanks,

Ariela

0 件の賞賛
返信
5 返答(返信)

935件の閲覧回数
arielablumer
Contributor III

I just noticed that printf via telnet uses one packet per character, this explains the difficulty in maintaining a telnet connection.

Is there a way to change this behavior and send a bunch of characters together?

0 件の賞賛
返信

935件の閲覧回数
danielchen
NXP TechSupport
NXP TechSupport

One customer proposed a good idea to redirect printf to telnet at below link, you can have a look.

https://community.nxp.com/message/104414 

Regards

Daniel

0 件の賞賛
返信

935件の閲覧回数
arielablumer
Contributor III

Hi Daniel,

I found the reason for telnet not working via Ethernet, it was a matter of telnet priority. Once using the default one (6) it started working.

Thanks,

Ariela

0 件の賞賛
返信

935件の閲覧回数
danielchen
NXP TechSupport
NXP TechSupport

Great! Thanks for sharing.

Regards

Daniel

0 件の賞賛
返信

935件の閲覧回数
danielchen
NXP TechSupport
NXP TechSupport

Hi Ariela:

Please refer to the demo web_hvac in the MQX installation folder, a network interface was initialized in this demo.

C:\Freescale\Freescale_MQX_4_2\demo\web_hvac

Please see rtcs.c

 I also copied here

void HVAC_initialize_networking(void)
{
    int32_t       error;
    _enet_address enet_address;

    #if DEMOCFG_USE_POOLS && defined(DEMOCFG_RTCS_POOL_ADDR) && defined(DEMOCFG_RTCS_POOL_SIZE)
    /* use external RAM for RTCS buffers */
    _RTCS_mem_pool = _mem_create_pool((void *)DEMOCFG_RTCS_POOL_ADDR, DEMOCFG_RTCS_POOL_SIZE);
    #endif

    /* runtime RTCS configuration for devices with small RAM, for others the default BSP setting is used */
    _RTCSPCB_init = 4;
    _RTCSPCB_grow = 2;
    _RTCSPCB_max = 20;
    _RTCS_msgpool_init = 4;
    _RTCS_msgpool_grow = 2;
    _RTCS_msgpool_max  = 20;
    _RTCS_socket_part_init = 4;
    _RTCS_socket_part_grow = 2;
    _RTCS_socket_part_max  = 20;

    error = RTCS_create();
    if (error != RTCS_OK)
    {
        printf("RTCS failed to initialize, error = 0x%X\n", error);
        _task_block();
    }
    
    ENET_get_mac_address (DEMOCFG_DEFAULT_DEVICE, ENET_IPADDR, enet_address);
    error = ipcfg_init_device (DEMOCFG_DEFAULT_DEVICE, enet_address);
    if (error != RTCS_OK)
    {
        printf("IPCFG: ENET init failed. Error = 0x%X\n", error);
        _task_block();
    }    

    #if DEMOCFG_USE_WIFI
    {
        iwcfg_set_essid (DEMOCFG_DEFAULT_DEVICE,DEMOCFG_SSID);
    
        if ((strcmp(DEMOCFG_SECURITY,"wpa") == 0) || strcmp(DEMOCFG_SECURITY,"wpa2") == 0)
        {
            iwcfg_set_passphrase (DEMOCFG_DEFAULT_DEVICE,DEMOCFG_PASSPHRASE);
        }
        
        if (strcmp(DEMOCFG_SECURITY,"wep") == 0)
        {
            iwcfg_set_wep_key (DEMOCFG_DEFAULT_DEVICE,DEMOCFG_WEP_KEY,strlen(DEMOCFG_WEP_KEY),DEMOCFG_WEP_KEY_INDEX);
        }
        iwcfg_set_sec_type (DEMOCFG_DEFAULT_DEVICE,DEMOCFG_SECURITY);
        iwcfg_set_mode (DEMOCFG_DEFAULT_DEVICE,DEMOCFG_NW_MODE);
        iwcfg_commit(DEMOCFG_DEFAULT_DEVICE);
    }
    #endif  

    #if RTCSCFG_ENABLE_IP4
    {
        IPCFG_IP_ADDRESS_DATA ip_data;

        ip_data.ip = ENET_IPADDR;
        ip_data.mask = ENET_IPMASK;
        ip_data.gateway = ENET_IPGATEWAY;

        error = ipcfg_bind_staticip (DEMOCFG_DEFAULT_DEVICE, &ip_data);
        if (error != RTCS_OK)
        {
            printf("\nIPCFG: Failed to bind IP address. Error = 0x%X", error);
            _task_block();
        }
    }
    #endif

    #if DEMOCFG_ENABLE_WEBSERVER
    {
        uint32_t server;
        extern const HTTPSRV_CGI_LINK_STRUCT cgi_lnk_tbl[];
        extern const HTTPSRV_SSI_LINK_STRUCT fn_lnk_tbl[];
        extern const TFS_DIR_ENTRY tfs_data[];
        HTTPSRV_PARAM_STRUCT params;
        
        error = _io_tfs_install("tfs:", tfs_data);
        if (error) printf("\nTFS install returned: %08x\n", error);

        /* Setup webserver parameters */
        _mem_zero(&params, sizeof(HTTPSRV_PARAM_STRUCT));
        #if RTCSCFG_ENABLE_IP4
        params.af |= AF_INET;
        #endif
        #if RTCSCFG_ENABLE_IP6
        params.af |= AF_INET6;
        #endif
        params.root_dir = "tfs:";
        params.alias_tbl = http_aliases;
        params.index_page = "\\mqx.shtml";
        params.cgi_lnk_tbl = cgi_lnk_tbl;
        params.ssi_lnk_tbl = fn_lnk_tbl;
        params.script_stack = 2500;

        server = HTTPSRV_init(&params);
        if(!server)
        {
            printf("Error: HTTP server init error.\n");
        }
    }
    #endif
    #if DEMOCFG_ENABLE_FTP_SERVER
    {
        FTPSRV_PARAM_STRUCT  params = {0};
        uint32_t             ftpsrv_handle;
        #if RTCSCFG_ENABLE_IP4
        params.af |= AF_INET;
        #endif
        #if RTCSCFG_ENABLE_IP6
        params.af |= AF_INET6;
        #endif
        params.auth_table = (FTPSRV_AUTH_STRUCT*) ftpsrv_users;
        params.root_dir = "c:";

        ftpsrv_handle = FTPSRV_init(&params);
        if (ftpsrv_handle != 0)
        {
            printf("FTP Server Started. Root directory is set to \"%s\", login: \"%s\", password: \"%s\".\n",
                params.root_dir,
                ftpsrv_users[0].uid,
                ftpsrv_users[0].pass);
        }
        else
        {
            printf("Failed to start FTP server.\n");
        }
    }
    #endif

    #if DEMOCFG_ENABLE_TELNET_SERVER
    {
        TELNETSRV_PARAM_STRUCT telnet_params = {0};

        telnet_params.shell_commands = (void *) Telnetsrv_commands;
        telnet_params.shell = (TELNET_SHELL_FUNCTION) Shell;
        TELNETSRV_init(&telnet_params);
    }
    #endif

    #if DEMOCFG_ENABLE_KLOG && MQX_KERNEL_LOGGING
    {
        RTCSLOG_enable(RTCSLOG_TYPE_FNENTRY);
        RTCSLOG_enable(RTCSLOG_TYPE_PCB);
    }
    #endif
}

Regards

Daniel

0 件の賞賛
返信