AnsweredAssumed Answered

Anyone successfully convert the eth_to_serial example to PEx?

Question asked by dave408 on Apr 9, 2015
Latest reply on Jun 4, 2015 by dave408

When I was first finding my way around the Kinetis tools, I used the eth_to_serial as the starting point for one of my applications.  I added tasks and my modbus code to it and it worked out relatively well.  However, I have recently decided that it makes the most sense to leverage PEx.  I drew up a matrix of the tool and feature combinations, and I completed the KSDK+PEx tasks more quickly than the others.  Plus, that's the future of Kinetis development, so it makes sense to stick with it.

 

I forgot who it was here that pointed me to this excellent tutorial on how to add PEx to a bare project (sorry -- probably David or Jorge), but I was able to get my project converted over pretty well.  I added OS_TASKs and started to fill in all of the details.  However, now when I run the project, it only gets part of the way through the RTCS code.  More specifically, when I try to step into ipcfg_bind_staticip(), execution freezes.

 

void ethernet_task(os_task_param_t task_init_data) { #ifdef PEX_USE_RTOS #if RTCSCFG_ENABLE_IP4     IPCFG_IP_ADDRESS_DATA ip_data;     uint32_t ip4_addr = ENET_IPADDR; #endif     uint32_t error;     sockaddr addr;     _enet_address enet_addr = ENET_MAC;     uint32_t retval = 0;     SOCKETS_STRUCT sockets;     uint32_t conn_sock;     uint32_t client_sock;     _task_id rx_tid;     //_task_id                 tx_tid;     FILE_PTR ser_device;     uint32_t option;     rtcs_fd_set rfds;     int32_t err; #if RTCSCFG_ENABLE_IP6     uint32_t n = 0;     uint32_t i = 0;     IPCFG6_GET_ADDR_DATA data[RTCSCFG_IP6_IF_ADDRESSES_MAX];     char prn_addr6[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"]; #endif      sockets.sock4 = 0;     sockets.sock6 = 0;     /* Initialize RTCS */     _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) {         fputs("Fatal Error: RTCS initialization failed.", stderr);         _task_block();     }      // my stuff here     uint8_t mac[6] = {0};     GetSemiUniqueMacAddress( mac);     ExecuteUnitTests();     // end my stuff  #if RTCSCFG_ENABLE_IP4     ip_data.ip = ENET_IPADDR;     ip_data.mask = ENET_IPMASK;     ip_data.gateway = ENET_IPGATEWAY; #endif     /* Initialize ethernet */     error = ipcfg_init_device(BSP_DEFAULT_ENET_DEVICE, enet_addr);     if (error != IPCFG_OK) {         fprintf(stderr, "Fatal Error 0x%X: Network device initialization failed.\r\n", (unsigned int)error);         _task_block();     }  #if RTCSCFG_ENABLE_IP4     /* Bind static IP address */     error = ipcfg_bind_staticip(BSP_DEFAULT_ENET_DEVICE, &ip_data); 

 

And even though I could run before, now I can't because I have the 8192 character limit to overcome.    Will post more info about the freeze later, but I'm still interested to hear if anyone has gotten this conversion to work, or if you can recommend how to do simple sockets with PEx, like a telnet connection.

Outcomes