Anyone successfully convert the eth_to_serial example to PEx?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Anyone successfully convert the eth_to_serial example to PEx?

Jump to solution
1,377 Views
dave408
Senior Contributor II

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.

Labels (1)
0 Kudos
Reply
1 Solution
984 Views
dave408
Senior Contributor II

I solved this issue in the lwIP case before by creating a new project, and then copying over the code.  Then I manually resolved all of the missing include files.

While that worked for me in KDS 2.0, once I moved to KDS 3.0 I couldn't get my project working anymore due to a hard fault.  This ongoing discussion is covered in a different post Adding HardFault handlers in KDS3/KSDK1.2? so I will close this discussion as I have proven that it's possible to get the example code working under a new PEx project.

View solution in original post

0 Kudos
Reply
4 Replies
984 Views
soledad
NXP Employee
NXP Employee

Hello dave408,

Did you check the httpsrv example located at the path : C:\Freescale\KSDK_1.1.0\tcpip\rtcs\examples\httpsrv?


Have a great day,
Sol

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply
984 Views
dave408
Senior Contributor II

I just confirmed that httpsrv does not use PEx.  As far as I could tell, there are no usable examples with RTCS or lwIP with PEx and MQX Standard.

0 Kudos
Reply
985 Views
dave408
Senior Contributor II

I solved this issue in the lwIP case before by creating a new project, and then copying over the code.  Then I manually resolved all of the missing include files.

While that worked for me in KDS 2.0, once I moved to KDS 3.0 I couldn't get my project working anymore due to a hard fault.  This ongoing discussion is covered in a different post Adding HardFault handlers in KDS3/KSDK1.2? so I will close this discussion as I have proven that it's possible to get the example code working under a new PEx project.

0 Kudos
Reply
984 Views
dave408
Senior Contributor II

Yes, one of my two ethernet projects is based on it, but I don't recall that it used PEx.  I'll double check, thanks.  If it does use PEx I will feel really silly.  :smileyhappy:

0 Kudos
Reply