Dear Team,
I need to receive data from TCP socket at defined port, and also need to send data to known IP address/port through TCP socket.
With help of sample code pack I am able to get IP through DHCP, and ping to another machine on same network or on internet.
Referring sample code : EK-RA6M3: r20an0560eu0144-ek-ra6m3-exampleprojects\ek_ra6m3\ethernet\ethernet_ek_ra6m3_ep\e2studio
However I am not able to integrate FreeRTOS portal code for creating socket, send data and receive data:
TCP Networking Tutorial - Creating, Configuring and Binding TCP Client and Server Sockets (freertos.org)
TCP Networking Tutorial - Send Data Using a TCP Socket (freertos.org)
TCP Networking Tutorial - Receiving Data Using a TCP Socket (freertos.org)
Also I am not able to find sample RA code to implement these functionality.
As socket is more practical way to send data to PCs running desktop applications (not web based) I am very keen to make my code work in this way.
Hoping for you kind help to implement same.
Thanks in advance.
Kind regards,
Nilesh A Korde
Hello,
Thanks for reaching out Renesas Engineering Community.
Please let me inform you that unfortunately we do not have any official example of how to create a TCP socket and send data through it for RA MCUs. But all these functions that are mentioned in the links you shared with us are integrated into FSP and you an find them as soon as you add the FreeRTOS+TCP stack in FSP Configurator environment. If you search through the generated files in your project you will see that all these necessary functions to create a socket, bind to it and send data through it, are generated in your project as you can see in file
FreeRTOS_Sockets.c
So they can easily be used from you in FSP. I think that since your question is related to FreeRTOS software and APIs it would be better to search in FreeRTOS for documentation and example of how to do that.
In case you have a project and some sample code already we would appreciate it if you could share it with us to take a look. And check where is your code actually failing.
Thank you!
Best Regards,
IK
ethernet_ek_ra6m3_ep_e2studio.zip
Dear IK,
Thanks for your guidance for moving ahead, however I have hit roadblock. Attached code.
Result: Failing to receive data from client, and thus also could not respond to client IP. Application freezing.
Application:
Gets IP from DHCP (works),
pings IP (works),
behaves as server mode where it opens socket to listen to port (fails),
and when request is received it echoes data back to incoming request ip (not able to get till here).
I have build application as suggested which is building correctly, and does not give errors while running. However, it freezes at FreeRTOS_accept. This application is executed on RA6M3 and build on sample from code pack ethernet/ek_ra6m3_ep/e2studio
Ethernet code is modified in file src/net_thread_entry.c where after ping, vCreateTCPServerSocket() function is called. This function creates socket, binds it at 5000 port, puts it in linsten mode. After this, when socket is put to wait for accept (FreeRTOS_accept) incoming connection, application freezes.
Please guide me to achieve this feature.
Thanks,Nilesh A Korde
Dear Support Team,
Let me know if any additional information is required.
Thanks,