last update: 2024/04
Demo Sample Application Folder:
Application └ _Exclude ├ IP ..... TCP/IPネットワーク通信機能のデモサンプル
Sample | 説明 |
---|---|
IP_ACD_Start | ACD(Address Collision Detection)機能の動作を確認します |
IP_AUTOIP_Start | AutoIPプロトコールを使用してIPアドレスの自動設定を確認します |
IP_DHCPServer | DHCPサーバー機能の実装方法を示すデモサンプル |
IP_DNSClient | ネットワークホスト名を IP アドレスに解決する方法を示します |
IP_MDNS_ServerSample | mDNSサーバー機能の実装方法を示すデモサンプル |
IP_NETBIOS_Start | NETBIOS Nameサービスクライアント機能を確認します |
IP_NonBlockingConnect | TCPソケットをノンブロッキングモードで実装します |
IP_NTPClient | NTPクライアント機能の実装方法を示すデモサンプル |
IP_Ping | ネットワークPINGテストでICMPプロトコールの動作を確認します |
IP_SendMail | SMTPクライアント機能の実装方法を示すデモサンプル |
IP_SHELL_Start | TELNETサーバー(emNet Shellコンソール)を実装します |
IP_SimpleServer | 簡単なTELNETサーバーを実装します |
IP_SNMP_AGENT_Start | SNMPエージェントの実装方法を示すデモサンプル |
IP_SNTPClient | SNTPクライアント機能を使用してNTPサーバーからタイムスタンプを取得します |
IP_SpeedClient_TCP | TCPデータパケットの送受信速度パフォーマンスを確認できるサンプルプログラム |
IP_Start | emNet TCP/IPスタックの基本的なスタートアップ手順を示すサンプル |
IP_TCP_TasklessServer | 専用タスク無しで簡単なTELNETサーバー機能を実装します |
IP_UDPDiscover | UDPポート経由でターゲットデバイスの情報を確認します |
IP_VLAN_Start | VLANインターフェースを実装します |
IP_TFTPClientSample | TFTPクライアント機能の実装方法を示すデモサンプル |
IP_TFTPServerSample | TFTPサーバー機能の実装方法を示すデモサンプル |
IP_WebserverSample | HTTPサーバーを実装したデモサンプル |
Sample | 説明 |
---|---|
IP_COAP_ClientSample | CoAPクライアントの実装方法を示すデモサンプル |
IP_COAP_ServerSample | CoAPサーバーの実装方法を示すデモサンプル |
Sample | 説明 |
---|---|
IP_MQTT_CLIENT_Publisher | MQTT クライアントパブリッシャーの実装方法を示すデモサンプル |
IP_MQTT_CLIENT_PublisherSubscriber_2Tasks | MQTT クライアントサブスクライバとパブリッシャー機能を同時に動かします |
IP_MQTT_CLIENT_Subscriber | MQTT クライアントサブスクライバの実装方法を示すデモサンプル |
Sample | 説明 |
---|---|
IP_WEBSOCKET_printf_Client | サーバーにタイムスタンプメッセージを発行する簡単なWEBSOCKETクライアントターミナル |
IP_WEBSOCKET_printf_Server | クライアントからタイムスタンプメッセージを受信する簡単なWEBSOCKETサーバートターミナル |
Sample | 説明 |
---|---|
IP_FTPClientSample | FTPクライアントのデモサンプル |
IP_FTPServerSample | FTPサーバーのデモサンプル |
BSP |- BSP_IP.c ..................... LANドライバのボード依存の初期化設定ファイル | |- Setup |- IP_Config_RX72N_ETH.c .... LANドライバインターフェース設定ファイル Config |- IP_Conf.h ............... emNet IPコンフィグレーション設定ファイル |- IP_COAP_Conf.h .......... emNet CoAPコンフィグレーション設定ファイル |- IP_MQTT_CLIENT_Conf.h ... emNet MQTTコンフィグレーション設定ファイル |- FTPC_Conf.h ............. emNet FTPcコンフィグレーション設定ファイル |- SMTPC_Conf.h ............ emNet SMTP Clientコンフィグレーション設定ファイル |- IP_FTP_SERVER_Conf.h .... emNet FTP Serverコンフィグレーション設定ファイル |- IP_SNMP_AGENT_Conf.h .... emNet SNMP Agentコンフィグレーション設定ファイル | |- IO | |- IP_ConfigIO.c ....... デバッグコンソールIOインターフェース設定ファイル | |- OS | |- lib_embOSLayer_RXv3_L.lib ....... OSインターフェース設定ファイル | |- SYS .................... SYS インターフェース設定(ソース・ヘッダ)
Config └ Webserver ├ Webserver_DynContent_2018.c ....... WEBサーバーデモサンプル用コンテンツ
プロジェクト設定では「\Application\_Exclude\IP」フォルダはビルド対象外に設定しています。以下のどちらかの方法で動作確認を行うサンプルアプリケーションを選択します。
各テストアプリケーションの動作確認方法はテストサンプルアプリケーションのヘッダのコメント情報を参照ください。
評価ボードのLANポートをテスト用パソコンに接続して、TCP/IPネットワーク通信が正常にできることを確認してください。
ネットワーク環境に合わせて評価ボード側のemNetスタックのコンフィグレーション設定を編集してください。
File: BSP\Setup\IP_Config_RX72N_ETH.c
#define USE_DHCP 1 // Use DHCP client or static IP configuration. // // The following parameters are only used when the DHCP client is not active. // #define IP_ADDR IP_BYTES2ADDR(192, 168, 11, 8) #define SUBNET_MASK IP_BYTES2ADDR(255, 255, 255, 0) #define GW_ADDR IP_BYTES2ADDR(192, 168, 11, 1) #define DNS_ADDR IP_BYTES2ADDR(192, 168, 11, 1)
Debug IO Console:
SEGGER Software Evaluation Sample Eval Board: RX72N Envision Kit RTOS: SEGGER embOS ---------------------------------------------- 0:021 MainTask - INIT: emNet init started. Version 3.50.5 0:022 MainTask - ********************************************************************* 0:023 MainTask - * emNet Configuration * 0:024 MainTask - ********************************************************************* 0:025 MainTask - * IP_DEBUG: 2 0:026 MainTask - * Memory added: 40960 bytes 0:027 MainTask - * Buffer configuration: 0:028 MainTask - * 12 buffers of 256 bytes 0:029 MainTask - * 10 buffers of 1516 bytes 0:030 MainTask - * TCP Tx/Rx window size per socket: 11680/8760 bytes 0:031 MainTask - * Number of interfaces added: 1 0:032 MainTask - * Interface #0 configuration: 0:033 MainTask - * Type: ETH 0:034 MainTask - * MTU: 1500 0:035 MainTask - * HW addr.: 00:22:C7:FF:FF:FF 0:036 MainTask - ********************************************************************* 0:039 MainTask - INIT: Link is down 0:040 MainTask - DRIVER: Found PHY with Id 0x22 at addr 0x1 0:045 MainTask - INIT: Init completed 0:046 IP_Task - INIT: IP_Task started 2:022 IP_Task - LINK: Link state changed: Full duplex, 100MHz 2:023 IP_Task - DHCPc: Sending discover! 2:051 IP_Task - DHCPc: IFace 0: Offer: IP: 192.168.11.24, Mask: 255.255.255.0, GW: 192.168.11.1. 2:322 IP_Task - NDP: Link-local IPv6 addr.: FE80:0000:0000:0000:0222:C7FF:FEFF:FFFF added to IFace: 0 3:022 IP_Task - DHCPc: IP addr. checked, no conflicts 3:023 IP_Task - DHCPc: Sending Request. 3:039 IP_Task - DHCPc: IFace 0: Using IP: 192.168.11.24, Mask: 255.255.255.0, GW: 192.168.11.1. 3:247 MainTask - Sending PING to IP addr. 192.168.11.11 . 3:328 IP_Task - ICMP echo reply received! 3:448 MainTask - Sending PING to IP addr. 192.168.11.11 . 3:513 IP_Task - ICMP echo reply received! 3:649 MainTask - Sending PING to IP addr. 192.168.11.11 . 3:709 IP_Task - ICMP echo reply received! 3:850 MainTask - Sending PING to IP addr. 192.168.11.11 . 3:897 IP_Task - ICMP echo reply received! 4:051 MainTask - Sending PING to IP addr. 192.168.11.11 . 4:112 IP_Task - ICMP echo reply received! 4:252 MainTask - Sending PING to IP addr. 192.168.11.11 . 4:302 IP_Task - ICMP echo reply received! 4:454 MainTask - Sending PING to IP addr. 192.168.11.11 . 4:531 IP_Task - ICMP echo reply received! 4:655 MainTask - Sending PING to IP addr. 192.168.11.11 . 4:722 IP_Task - ICMP echo reply received! 4:856 MainTask - Sending PING to IP addr. 192.168.11.11 . 4:926 IP_Task - ICMP echo reply received! 5:057 MainTask - Sending PING to IP addr. 192.168.11.11 . 5:066 IP_Task - ICMP echo reply received!
パソコン側に「SpeedTestServer.exe」サーバープログラムを起動して評価ボードのTCP速度パフォーマンスを確認します。
LAN HUB: NETGEAR 100Mbps
File: IP_SpeedClient_TCP.c (サーバーIPアドレス設定)
#define SERVER_IP_ADDR IP_BYTES2ADDR(192, 168, 1, 3)
Debug IO Console:
5:025 IP_Task - DHCPc: Sending Request. 5:035 IP_Task - DHCPc: IFace 0: Using IP: 192.168.1.12, Mask: 255.255.255.0, GW: 192.168.1.1. 5:411 Client - 4194304 Bytes received (without headers) in 360 ms. 5:412 Client - 4659730 Bytes received (with headers) in 360 ms. 5:413 Client - Average transfer speed (without headers): 11650000 Bytes/s 5:414 Client - Average transfer speed (with headers): 12943000 Bytes/s 5:808 Client - 4194304 Bytes sent (without headers) in 392 ms. 5:809 Client - 4659730 Bytes sent (with headers) in 392 ms. 5:810 Client - Average transfer speed (without headers): 10699000 Bytes/s 5:811 Client - Average transfer speed (with headers): 11887000 Bytes/s 6:237 Client - 4194304 Bytes received (without headers) in 375 ms. 6:238 Client - 4659730 Bytes received (with headers) in 375 ms. 6:239 Client - Average transfer speed (without headers): 11184000 Bytes/s 6:240 Client - Average transfer speed (with headers): 12425000 Bytes/s
Debug IO Console:
3:023 IP_Task - DHCPc: Sending discover! 3:056 IP_Task - DHCPc: IFace 0: Offer: IP: 192.168.11.24, Mask: 255.255.255.0, GW: 192.168.11.1. 3:322 IP_Task - NDP: Link-local IPv6 addr.: FE80:0000:0000:0000:0222:C7FF:FEFF:FFFF added to IFace: 0 4:022 IP_Task - DHCPc: IP addr. checked, no conflicts 4:023 IP_Task - DHCPc: Sending Request. 4:040 IP_Task - DHCPc: IFace 0: Using IP: 192.168.11.24, Mask: 255.255.255.0, GW: 192.168.11.1. 4:047 SNTPClient - Requesting time stamp from us.pool.ntp.org: 4:210 SNTPClient - Timestamp received: 3920352099 seconds passed since January 1st 1900.
Debug IO Console:
9:104 NTPClient - --- UTC time: 2024.03.25 10:52:22 --- 14:104 NTPClient - --- UTC time: 2024.03.25 10:52:27 --- 19:105 NTPClient - --- UTC time: 2024.03.25 10:52:37 --- 24:103 NTPClient - --- UTC time: 2024.03.25 10:52:42 --- 29:104 NTPClient - --- UTC time: 2024.03.25 10:52:47 --- 34:105 NTPClient - --- UTC time: 2024.03.25 10:52:52 --- 39:106 NTPClient - --- UTC time: 2024.03.25 10:52:57 ---
Debug IO Console:
4:036 IP_Task - DHCPc: IFace 0: Using IP: 192.168.11.24, Mask: 255.255.255.0, GW: 192.168.11.1. 4:308 MainTask - APP: Connected to 91.121.93.94, port 1883. 5:051 MainTask - APP: -------- 5:052 MainTask - APP: Message No. 1: 5:053 MainTask - APP: Topic : "eMQTT" 5:054 MainTask - APP: Payload: "www.SEGGER.com MQTT_HelloWorld_Sample" 6:545 MainTask - APP: -------- 6:546 MainTask - APP: Message No. 2: 6:547 MainTask - APP: Topic : "eMQTT" 6:548 MainTask - APP: Payload: "www.SEGGER.com MQTT_HelloWorld_Sample" 8:039 MainTask - APP: -------- 8:040 MainTask - APP: Message No. 3: 8:041 MainTask - APP: Topic : "eMQTT" 8:042 MainTask - APP: Payload: "www.SEGGER.com MQTT_HelloWorld_Sample" 9:532 MainTask - APP: -------- 9:533 MainTask - APP: Message No. 4: 9:534 MainTask - APP: Topic : "eMQTT" 9:535 MainTask - APP: Payload: "www.SEGGER.com MQTT_HelloWorld_Sample"
Debug IO Console:
3:023 IP_Task - DHCPc: Sending Request. 3:061 IP_Task - DHCPc: IFace 0: Using IP: 192.168.11.24, Mask: 255.255.255.0, GW: 192.168.11.1. 3:602 MainTask - APP: Connected to 91.121.93.94, port 1883. 3:855 MainTask - APP: Received Property IP_MQTT_PROP_TYPE_TOPIC_ALIAS_MAXIMUM for CONNACK with PacketID 0. 3:856 MainTask - APP: Received Property IP_MQTT_PROP_TYPE_RECEIVE_MAXIMUM for CONNACK with PacketID 0. 4:104 MainTask - APP: Message (Type: SUBACK, Id: 0) received. Reason Code: IP_MQTT_REASON_SUCCESS. 4:105 MainTask - APP: ---- 94:893 MainTask - IP_MQTT_CLIENT_Exec: Connection gracefully closed by peer. 94:894 MainTask - _Disconnect: closing socket 1 94:895 MainTask - APP: Done. 105:146 MainTask - APP: Connected to 91.121.93.94, port 1883. 105:394 MainTask - APP: Received Property IP_MQTT_PROP_TYPE_TOPIC_ALIAS_MAXIMUM for CONNACK with PacketID 0. 105:395 MainTask - APP: Received Property IP_MQTT_PROP_TYPE_RECEIVE_MAXIMUM for CONNACK with PacketID 0. 105:644 MainTask - APP: Message (Type: SUBACK, Id: 0) received. Reason Code: IP_MQTT_REASON_SUCCESS. 105:645 MainTask - APP: ---- 195:656 MainTask - IP_MQTT_CLIENT_Exec: Connection gracefully closed by peer. 195:657 MainTask - _Disconnect: closing socket 2 195:658 MainTask - APP: Done. 205:911 MainTask - APP: Connected to 91.121.93.94, port 1883. 206:168 MainTask - APP: Received Property IP_MQTT_PROP_TYPE_TOPIC_ALIAS_MAXIMUM for CONNACK with PacketID 0. 206:169 MainTask - APP: Received Property IP_MQTT_PROP_TYPE_RECEIVE_MAXIMUM for CONNACK with PacketID 0. 206:425 MainTask - APP: Message (Type: SUBACK, Id: 0) received. Reason Code: IP_MQTT_REASON_SUCCESS. 206:426 MainTask - APP: ----
File: IP_COAP_ClientSample.c (サーバーIPアドレス設定)
#define COAP_PORT IP_COAP_DEFAULT_PORT #define COAP_SERVER "192.168.1.19"
Debug IO Console:
4:026 IP_Task - DHCPc: Sending Request. 4:046 IP_Task - DHCPc: IFace 0: Using IP: 192.168.1.12, Mask: 255.255.255.0, GW: 192.168.1.1. 4:050 MainTask - Test 0: Sending PING 4:051 MainTask - Test 0: Success! 4:052 MainTask - Test 1: Sending Discover 4:063 MainTask - /obs: Simple observable data. /test: test entry /separate: simple variable with GET with LATE reply /BlockTransfer/ObsData: Observable data block. /ObsSensor: 4:064 MainTask - Test 1: Success! 4:065 MainTask - Test 2: Sending GET separate 4:066 MainTask - 00:00:00 4:067 MainTask - Test 2: Success! 4:068 MainTask - Test 3: Sending NON GET block of 16 bytes 4:069 MainTask - Test data 4:070 MainTask - Test 3: Success! 4:071 MainTask - Test 4: PUT test 4:072 MainTask - Test 4: Success! 4:073 MainTask - Test 5: PUT that should fail 4:074 MainTask - received error: 4.05 4:075 MainTask - Test 5: Success! 4:076 MainTask - Test 6: DELETE test 4:077 MainTask - Test 6: Success! 4:078 MainTask - Test 7: POST test 4:080 MainTask - Test 7: Success! 4:081 MainTask - Test 8: Observe 4:083 MainTask - Obs data 4:084 MainTask - GET 1 from Observe completed 14:071 MainTask - Obs data 14:072 MainTask - GET 2 from Observe completed 24:064 MainTask - Obs data 24:065 MainTask - GET 3 from Observe completed 34:057 MainTask - Obs data 34:058 MainTask - GET 4 from Observe completed 44:050 MainTask - Obs data 44:051 MainTask - GET 5 from Observe completed 44:052 MainTask - Test 8: Success!
Debug IO Console:
5:025 IP_Task - DHCPc: Sending Request. 5:035 IP_Task - DHCPc: IFace 0: Using IP: 192.168.1.12, Mask: 255.255.255.0, GW: 192.168.1.1. 14:823 MainTask - Getting with LATE reply. 14:825 MainTask - Getting with LATE reply. 14:826 MainTask - Getting Test. 14:827 MainTask - Putting Test. 14:828 MainTask - Putting Test. 14:829 MainTask - Deleting Test. 14:830 MainTask - Putting Test. 14:832 MainTask - Putting Test. 14:833 MainTask - Getting Observer. 24:834 MainTask - Getting Observer. 34:836 MainTask - Getting Observer. 44:837 MainTask - Getting Observer. 54:838 MainTask - Getting Observer. 54:840 MainTask - Getting Observer.
File: IP_WEBSOCKET_printf_Client.c (サーバーIPアドレス設定)
// // WebSocket sample configuration. // #define SERVER_HOST "192.168.1.19" // Host to connect to.
Debug IO Console:
4:025 IP_Task - DHCPc: Sending Request. 4:034 IP_Task - DHCPc: IFace 0: Using IP: 192.168.1.12, Mask: 255.255.255.0, GW: 192.168.1.1. 4:049 WebSocketClient - APP: Connected to 192.168.1.19:8181. 4:051 WebSocketClient - WebSocket successfully opened.
Debug IO Console:
5:024 IP_Task - DHCPc: Sending Request. 5:033 IP_Task - DHCPc: IFace 0: Using IP: 192.168.1.12, Mask: 255.255.255.0, GW: 192.168.1.1. 60:987 WebSocketServer - WebSocket client connected. 61:979 WebSocketServer - Client: OS time: 9025 63:172 WebSocketServer - Client: OS time: 10226 64:362 WebSocketServer - Client: OS time: 11423 65:552 WebSocketServer - Client: OS time: 12620 66:742 WebSocketServer - Client: OS time: 13817 67:932 WebSocketServer - Client: OS time: 15014 69:122 WebSocketServer - Client: OS time: 16212 70:312 WebSocketServer - Client: OS time: 17409 71:502 WebSocketServer - Client: OS time: 18606
MODBUS通信(TCP経由)