cancel
Showing results for 
Search instead for 
Did you mean: 

Trying to understand and get Nx_TCP_Echo_Client to work on B-L462E-CELL1

JFlowers
Associate III

OK, I have a STM32L462RE Discovery Kit (apparently a.k.a. B-L462E-CELL1).

I am trying to get its sole Demonstration application to work (STM32CubeExpansion_CELLULAR_V7.1.0\Projects\B-L462E-CELL1\Demonstrations\Nx_TCP_Echo_Client), but I can’t even tell how it is supposed to work.

 

I see “TCP_Echo_Client” in its name, so I assume if I have a simple TCP echo server running on my workstation that if I do the appropriate port forwarding through my router along with the appropriate Windows Firewall settings, then I should see the B-L462E-CELL1 connect to my local TCP Echo Server.

 

Is that correct?


Further, I assume that in this file:

STM32CubeExpansion_CELLULAR_V7.1.0\Projects\B-L462E-CELL1\Demonstrations\Nx_TCP_Echo_Client\NetXDuo\App\tcp_echo_client.c

I should change TCP_SERVER_PORT from 7 to whatever TCP port my local TCP Echo server is running on, AND I should change the TCP_SERVER_ADDRESS IP_ADDRESS(52,215,34,155) in that same file from 52,215,34,155 (which implies 52.215.34.155) to whatever my public facing router’s WAN address is.

 

Is that correct?


If all of that is right and my SIM card is working right, which I think it is - I’m see messages like this on bootup: “Network is up with IP 10.228.182.49” on TeraTerm - then I should see “10.228.182.49” (or whatever IP address is given my B-L462E-CELL1 on bootup) connect to my local TCP echo server.


Is that correct?


Further, I assume that on my TeraTerm console connected to the B-L462E-CELL1, that I will see some sort of confirmation that my local TCP Echo server replied back to the B-L462E-CELL1 with the exact same message that the B-L462E-CELL1 originally sent to it (to my local TCP echo server).


Is that correct?


Where do I change the message that the B-L462E-CELL1 sends to my local TCP echo server?


Help, please.

 

14 REPLIES 14
STackPointer64
ST Employee

Hello @JFlowers ,

 


I see “TCP_Echo_Client” in its name, so I assume if I have a simple TCP echo server running on my workstation that if I do the appropriate port forwarding through my router along with the appropriate Windows Firewall settings, then I should see the B-L462E-CELL1 connect to my local TCP Echo Server.


If your router drops ICMP packets by default, then yes you need to allow them in your firewall settings. To verify this, if you possess two devices connected to the same network, try to ping one device from the other using the command below and see if you get a response or not. If you do, no port-forward or firewall configuration are needed.

ping IP_ADDRESS

 In case you wish to run this application in a Wide Area Network, then you are correct port forward and firewall configuration are needed.

 

Further, I assume that in this file:

STM32CubeExpansion_CELLULAR_V7.1.0\Projects\B-L462E-CELL1\Demonstrations\Nx_TCP_Echo_Client\NetXDuo\App\tcp_echo_client.c

I should change TCP_SERVER_PORT from 7 to whatever TCP port my local TCP Echo server is running on, AND I should change the TCP_SERVER_ADDRESS IP_ADDRESS (52,215,34,155) in that same file from 52,215,34,155 (which implies 52.215.34.155) to whatever my public facing router’s WAN address is.


Correct.

 

If all of that is right and my SIM card is working right, which I think it is - I’m see messages like this on bootup: “Network is up with IP 10.228.182.49” on TeraTerm - then I should see “10.228.182.49” (or whatever IP address is given my B-L462E-CELL1 on bootup) connect to my local TCP echo server.


Correct.

 

Further, I assume that on my TeraTerm console connected to the B-L462E-CELL1, that I will see some sort of confirmation that my local TCP Echo server replied back to the B-L462E-CELL1 with the exact same message that the B-L462E-CELL1 originally sent to it (to my local TCP echo server).

Is that correct?

Where do I change the message that the B-L462E-CELL1 sends to my local TCP echo server?


I suggest you refer to UM2426 which is dedicated to explaining in detail the the XCube-Cellular package specifically "How to customize the software?" section and let me if it did help you.

Best regards,

JFlowers
Associate III

This did not work.

 

I successfully ran a TCP Echo server on my local machine and enabled the path through the Internet to it. I turned WiFi off on my cellphone and tested with my cellphone that the TCP Echo server on my local machine was indeed working.

 

I changed the "#define TCP_SERVER_PORT" and "#define TCP_SERVER_ADDRESS IP_ADDRESS" lines in tcp_echo_client.c and re-built Nx_TCP_Echo_Client.bin with STM32CubeIDE.  I dropped Nx_TCP_Echo_Client.bin on the DIS_L462RE drive, allowed it time to install that new FW and then pressed the Reset button on the B-L462E-CELL1 board. 

 

I get traffic like the following in my TeraTerm window, BUT, I get no traffic to my TCP Echo Server on my local machine:

......

......

ATCModem:NetworkState (CS) = REGISTERED_HOME_NETWORK
ATCModem:+CREG: lac=9997 =0x270d
ATCModem:+CREG: ci=197108497 =0xbbfa311
ATCModem:NetworkState (EPS) = REGISTERED_HOME_NETWORK
ATCModem:+CEREG: tac=9997 =0x270d
ATCModem:+CEREG: ci=197108497 =0xbbfa311
ATCModem:+CEREG: act=7
ATCModem:NetworkState (CS) = REGISTERED_HOME_NETWORK
ATCModem:+CREG: lac=9997 =0x270d
ATCModem:+CREG: ci=197108497 =0xbbfa311
Cellular interface:
> IP Address: 10.224.94.248
Network is up with IP 10.224.94.248
SNTP Time Sync... 1.pool.ntp.org
SNTP Time Sync... 2.pool.ntp.org
SNTP Time Sync... 3.pool.ntp.org
SNTP Time Sync... 0.pool.ntp.org
SNTP Time Sync... 1.pool.ntp.org
SNTP Time Sync... 2.pool.ntp.org
SNTP Time Sync... 3.pool.ntp.org
SNTP Time Sync... 0.pool.ntp.org
SNTP Time Sync... 1.pool.ntp.org
SNTP Time Sync... 2.pool.ntp.org
SNTP Time Sync... 3.pool.ntp.org
SNTP Time Sync... 0.pool.ntp.org
SNTP Time Sync... 1.pool.ntp.org
SNTP Time Sync... 2.pool.ntp.org
SNTP Time Sync... 3.pool.ntp.org
SNTP Time Sync... 0.pool.ntp.org
SNTP Time Sync... 1.pool.ntp.org
SNTP Time Sync... 2.pool.ntp.org
SNTP Time Sync... 3.pool.ntp.org
SNTP Time Sync... 0.pool.ntp.org
SNTP Time Sync... 1.pool.ntp.org
SNTP Time Sync... 2.pool.ntp.org
SNTP Time Sync... 3.pool.ntp.org
SNTP Time Sync... 0.pool.ntp.org
SNTP Time Sync... 1.pool.ntp.org
SNTP Time Sync... 2.pool.ntp.org
SNTP Time Sync... 3.pool.ntp.org
SNTP Time Sync... 0.pool.ntp.org
SNTP Time Sync... 1.pool.ntp.org
SNTP Time Sync failed.

 

 

 

 

 

 

 

STackPointer64
ST Employee

Hello,

The SNTP time sync problem is often associated with your application's inability to retrieve NTP server from your ISP's DHCP server, so it switches to manually configurated NTP servers in the application. To solve this, you could try and change the servers' addresses hardcoded in your application in an array called sntp_servers found in app_netxduo.c to ones located in your regions (you could look this information up in your favorite search engine).

 

Some other time, this is due to an optimization issue while compiling the code, you could try and check the optimization level by following these steps:
  • Right click your project name => Properties => C/C++ Build => Settings => In the Tool Settings Tab look for MCU GCC Compiler => Click on Optimization => Select None (-O0) for both Debug and Release Config.

Best regards,

JFlowers
Associate III

Hi STackPointer64,

All of your comments are very helpful and much appreciated.

I will try your ideas tonight.  I'm not sure they will fix my original problem, but I'm certain they will help on my journey.

 

 

 

 

JFlowers
Associate III

No luck. This did not work either.

 

I set the optimization to None for both Debug and Release new builds and tried the new FW on the board. I still get "SNTP Time Sync failed", if I let it run long enough.

 

I did not change the sntp_servers[] entries. Instead, I checked to see if the existing sntp servers are available at all via:

w32tm /stripchart /computer:X.pool.ntp.org /dataonly
and
sntp commands.

 

0.pool.ntp.org
1.pool.ntp.org
2.pool.ntp.org
3.pool.ntp.org

All responded and showed no errors.

 

However, this "SNTP Time Sync failed" is the least of my worries right now.

This sample code is still not connecting to my TCP Echo Server.

 

JFlowers
Associate III

Should this exact same sample application (STM32CubeExpansion_CELLULAR_V7.1.0\Projects\B-L462E-CELL1\Demonstrations\Nx_TCP_Echo_Client) and exact same FW binary (Nx_TCP_Echo_Client.bin) work on a P-L496G-CELL02 too, without me having to recompile/rebuild it?

 

JFlowers
Associate III

> In case you wish to run this application in a Wide Area Network, then you are correct port forward and firewall

> configuration are needed.

 

I don't see or understand how we can run this application in a Local Area Network.  The cellular connection is always going to be coming from the outside (WAN), right?

 

---

 


I suggest you refer to UM2426 which is dedicated to explaining in detail the the XCube-Cellular package specifically "How to customize the software?" section and let me if it did help you.

 

This document (UM2426) seems to re-enforce my thinking on how this Sample Application is supposed to work.

 


Hello, 

I don't see or understand how we can run this application in a Local Area Network.  The cellular connection is always going to be coming from the outside (WAN), right?


Apologies for the oversight! You’re right, I was focused on the fact that the project is a TCP echo client and overlooked the cellular aspect.

Since the SNTP issue is resolved, the most probable problem could be that your firewall/router is blocking the incoming connection from the TCP echo client. Could you verify that the port used is properly forwarded in your router and the Inbound rules allow for communication through that port. Check also if there is possibly any other service utilizing that port in your network.

Best regards,