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_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_SNTPClient | SNTPクライアント機能を使用してNTPサーバーからタイムスタンプを取得します |
IP_SpeedClient_TCP | TCPデータパケットの送受信速度パフォーマンスを確認できるサンプルプログラム |
IP_Start | emNet TCP/IPスタックの基本的なスタートアップ手順を示すサンプル |
IP_TCP_TasklessServer | 専用タスク無しで簡単なTELNETサーバー機能を実装します |
IP_VLAN_Start | VLANインターフェースを実装します |
Sample | 説明 |
---|---|
IP_COAP_ClientSample | CoAPクライアントの実装方法を示すデモサンプル |
Sample | 説明 |
---|---|
IP_MQTT_CLIENT_Publisher | MQTT クライアントパブリッシャーの実装方法を示すデモサンプル |
IP_MQTT_CLIENT_Subscriber | MQTT クライアントサブスクライバの実装方法を示すデモサンプル |
Sample | 説明 |
---|---|
IP_FTPClientSample | 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_SNMP_AGENT_Conf.h .... emNet SNMP Agentコンフィグレーション設定ファイル | |- IO | |- IP_ConfigIO.c ....... デバッグコンソールIOインターフェース設定ファイル | |- OS | |- libNo_OSLayer_RXv3_L.lib ....... OSインターフェース設定ファイル | |- SYS .................... SYS インターフェース設定(ソース・ヘッダ)
プロジェクト設定では「\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 Base: Baremetal (No RTOS) ------------------------------------------------ 0:022 emNet - INIT: emNet init started. Version 3.54.1 0:023 emNet - ********************************************************************* 0:024 emNet - * emNet Configuration * 0:025 emNet - ********************************************************************* 0:026 emNet - * IP_DEBUG: 2 0:027 emNet - * Memory added: 40952 bytes 0:028 emNet - * Buffer configuration: 0:029 emNet - * 12 buffers of 256 bytes 0:030 emNet - * 10 buffers of 1516 bytes 0:031 emNet - * TCP Tx/Rx window size per socket: 11680/8760 bytes 0:032 emNet - * Number of interfaces added: 1 0:033 emNet - * Interface #0 configuration: 0:034 emNet - * Type: ETH 0:035 emNet - * MTU: 1500 0:036 emNet - * HW addr.: 00:22:C7:FF:FF:FF 0:037 emNet - ********************************************************************* 0:040 emNet - INIT: Link is down 0:041 emNet - DRIVER: Found PHY with Id 0x22 at addr 0x1 0:046 emNet - INIT: Init completed 2:023 emNet - LINK: Link state changed: Full duplex, 100MHz 2:024 emNet - DHCPc: Sending discover! 2:323 emNet - NDP: Link-local IPv6 addr.: FE80:0000:0000:0000:0222:C7FF:FEFF:FFFF added to IFace: 0 2:328 emNet - NDP: IPv6 addr.: 2400:4050:A0E0:1F00:0222:C7FF:FEFF:FFFF added to IFace: 0 3:583 emNet - DHCPc: IFace 0: Offer: IP: 192.168.1.12, Mask: 255.255.255.0, GW: 192.168.1.1. 4:023 emNet - DHCPc: IP addr. checked, no conflicts 4:024 emNet - DHCPc: Sending Request. 4:047 emNet - DHCPc: IFace 0: Using IP: 192.168.1.12, Mask: 255.255.255.0, GW: 192.168.1.1. 5:053 emNet - Sending PING to IP addr. 192.168.1.3 . 5:055 emNet - ICMP echo reply received! 6:056 emNet - Sending PING to IP addr. 192.168.1.3 . 6:058 emNet - ICMP echo reply received! 7:059 emNet - Sending PING to IP addr. 192.168.1.3 . 7:061 emNet - ICMP echo reply received! 8:062 emNet - Sending PING to IP addr. 192.168.1.3 . 8:063 emNet - ICMP echo reply received! 9:065 emNet - Sending PING to IP addr. 192.168.1.3 . 9:068 emNet - ICMP echo reply received! 10:068 emNet - Sending PING to IP addr. 192.168.1.3 . 10:071 emNet - ICMP echo reply received! 11:071 emNet - Sending PING to IP addr. 192.168.1.3 . 11:074 emNet - ICMP echo reply received! 12:074 emNet - Sending PING to IP addr. 192.168.1.3 . 12:077 emNet - ICMP echo reply received! 13:077 emNet - Sending PING to IP addr. 192.168.1.3 . 13:078 emNet - ICMP echo reply received!
Debug IO Console:
2:024 emNet - DHCPc: Sending discover! 2:323 emNet - NDP: Link-local IPv6 addr.: FE80:0000:0000:0000:0222:C7FF:FEFF:FFFF added to IFace: 0 2:328 emNet - NDP: IPv6 addr.: 2400:4050:A0E0:1F00:0222:C7FF:FEFF:FFFF added to IFace: 0 3:866 emNet - DHCPc: IFace 0: Offer: IP: 192.168.1.12, Mask: 255.255.255.0, GW: 192.168.1.1. 4:023 emNet - DHCPc: IP addr. checked, no conflicts 4:024 emNet - DHCPc: Sending Request. 4:033 emNet - DHCPc: IFace 0: Using IP: 192.168.1.12, Mask: 255.255.255.0, GW: 192.168.1.1. 4:051 emNet - Requesting time stamp from us.pool.ntp.org: 4:296 emNet - Timestamp received: 3920941117 seconds passed since January 1st 1900.
Debug IO Console:
9:061 emNet - --- UTC time: 2024.04.01 06:22:24 --- 14:054 emNet - --- UTC time: 2024.04.01 06:22:29 --- 19:059 emNet - --- UTC time: 2024.04.01 06:22:34 --- 24:052 emNet - --- UTC time: 2024.04.01 06:22:39 --- 29:057 emNet - --- UTC time: 2024.04.01 06:22:44 --- 34:062 emNet - --- UTC time: 2024.04.01 06:22:49 --- 39:055 emNet - --- UTC time: 2024.04.01 06:22:54 --- 44:060 emNet - --- UTC time: 2024.04.01 06:22:59 ---
Debug IO Console:
5:025 emNet - DHCPc: Sending Request. 5:036 emNet - DHCPc: IFace 0: Using IP: 192.168.1.12, Mask: 255.255.255.0, GW: 192.168.1.1. 28:659 emNet - New connection accepted for server on local port 23. 45:672 emNet - New connection accepted for server on local port 23.
パソコン側のDOSプロンプト:
C:\>telnet 192.168.1.12 Hello and goodbye... C:\>telnet 192.168.1.12 Hello and goodbye...
File: IP_NonBlockingConnect.c (パソコンテストサーバーのIPアドレス設定)
#define SERVER_IP_ADDR IP_BYTES2ADDR(192, 168, 1, 252)
パソコン側「SpeedTestServer.exe」ツールを実行します。
Windows └ IP ├ SpeedTestServer ├ SpeedTestServer.exe ..... TCPテストサーバーサンプル
パソコン側「SpeedTestServer.exe」のコンソール:
TCP/IP Echo server V1.00.00. Compiled 11:26:58 on Sep 29 2023. Waiting for client on port 1234 2024-04-01 16:22:10 : Client connected 2024-04-01 16:22:10 : Client disconnected 2024-04-01 16:22:12 : Client connected 2024-04-01 16:22:13 : Client disconnected 2024-04-01 16:22:15 : Client connected 2024-04-01 16:22:15 : Client disconnected 2024-04-01 16:22:30 : Client connected 2024-04-01 16:22:30 : Client disconnected 2024-04-01 16:22:32 : Client connected
Debug IO Console:
4:025 emNet - DHCPc: Sending Request. 4:034 emNet - DHCPc: IFace 0: Using IP: 192.168.1.12, Mask: 255.255.255.0, GW: 192.168.1.1. 4:053 emNet - Connecting using non-blocking socket... 4:060 emNet - Succesfully connected after 6ms and 4 loops! 4:563 emNet - 1 of 1 tries were successful. 6:566 emNet - Connecting using non-blocking socket... 6:571 emNet - Succesfully connected after 4ms and 3 loops! 7:074 emNet - 2 of 2 tries were successful. 9:077 emNet - Connecting using non-blocking socket... 9:082 emNet - Succesfully connected after 4ms and 3 loops! 9:585 emNet - 3 of 3 tries were successful. 11:588 emNet - Connecting using non-blocking socket... 11:593 emNet - Succesfully connected after 4ms and 3 loops! 12:096 emNet - 4 of 4 tries were successful. 14:099 emNet - Connecting using non-blocking socket... 14:104 emNet - Succesfully connected after 4ms and 3 loops! 14:607 emNet - 5 of 5 tries were successful. 16:610 emNet - Connecting using non-blocking socket... 16:615 emNet - Succesfully connected after 4ms and 3 loops! 17:118 emNet - 6 of 6 tries were successful.
Debug IO Console:
4:024 emNet - DHCPc: Sending Request. 4:032 emNet - DHCPc: IFace 0: Using IP: 192.168.1.12, Mask: 255.255.255.0, GW: 192.168.1.1. 4:533 emNet - APP: Connected to 91.121.93.94, port 1883. 5:258 emNet - APP: -------- 5:259 emNet - APP: Message No. 1: 5:260 emNet - APP: Topic : "eMQTT" 5:261 emNet - APP: Payload: "www.SEGGER.com MQTT_HelloWorld_Sample" 6:744 emNet - APP: -------- 6:745 emNet - APP: Message No. 2: 6:746 emNet - APP: Topic : "eMQTT" 6:747 emNet - APP: Payload: "www.SEGGER.com MQTT_HelloWorld_Sample" 8:230 emNet - APP: -------- 8:231 emNet - APP: Message No. 3: 8:232 emNet - APP: Topic : "eMQTT" 8:233 emNet - APP: Payload: "www.SEGGER.com MQTT_HelloWorld_Sample" 9:716 emNet - APP: -------- 9:717 emNet - APP: Message No. 4: 9:718 emNet - APP: Topic : "eMQTT" 9:719 emNet - APP: Payload: "www.SEGGER.com MQTT_HelloWorld_Sample"
Debug IO Console:
4:024 emNet - DHCPc: Sending Request. 4:074 emNet - DHCPc: IFace 0: Using IP: 192.168.1.12, Mask: 255.255.255.0, GW: 192.168.1.1. 4:613 emNet - APP: Connected to 91.121.93.94, port 1883. 4:874 emNet - APP: Received Property IP_MQTT_PROP_TYPE_TOPIC_ALIAS_MAXIMUM for CONNACK with PacketID 0. 4:875 emNet - APP: Received Property IP_MQTT_PROP_TYPE_RECEIVE_MAXIMUM for CONNACK with PacketID 0. 5:133 emNet - APP: Message (Type: SUBACK, Id: 4876) received. Reason Code: IP_MQTT_REASON_SUCCESS. 5:134 emNet - APP: ---- 96:085 emNet - IP_MQTT_CLIENT_Exec: Connection gracefully closed by peer. 96:086 emNet - _Disconnect: closing socket 1 96:087 emNet - APP: Done. 101:346 emNet - APP: Connected to 91.121.93.94, port 1883. 101:603 emNet - APP: Received Property IP_MQTT_PROP_TYPE_TOPIC_ALIAS_MAXIMUM for CONNACK with PacketID 0. 101:604 emNet - APP: Received Property IP_MQTT_PROP_TYPE_RECEIVE_MAXIMUM for CONNACK with PacketID 0. 101:857 emNet - APP: Message (Type: SUBACK, Id: 36069) received. Reason Code: IP_MQTT_REASON_SUCCESS. 101:858 emNet - APP: ---- 191:969 emNet - IP_MQTT_CLIENT_Exec: Connection gracefully closed by peer. 191:970 emNet - _Disconnect: closing socket 2 191:971 emNet - APP: Done. 197:218 emNet - APP: Connected to 91.121.93.94, port 1883. 197:461 emNet - APP: Received Property IP_MQTT_PROP_TYPE_TOPIC_ALIAS_MAXIMUM for CONNACK with PacketID 0. 197:462 emNet - APP: Received Property IP_MQTT_PROP_TYPE_RECEIVE_MAXIMUM for CONNACK with PacketID 0. 197:707 emNet - APP: Message (Type: SUBACK, Id: 855) received. Reason Code: IP_MQTT_REASON_SUCCESS. 197:708 emNet - APP: ----
File: IP_COAP_ClientSample.c (サーバーIPアドレス設定)
#define COAP_PORT IP_COAP_DEFAULT_PORT #define COAP_SERVER "192.168.1.19"
Debug IO Console:
5:024 emNet - DHCPc: Sending Request. 5:033 emNet - DHCPc: IFace 0: Using IP: 192.168.1.12, Mask: 255.255.255.0, GW: 192.168.1.1. 5:039 emNet - Test 0: Sending PING 5:052 emNet - Test 0: Success! 5:053 emNet - Test 1: Sending Discover 5:330 emNet - /obs: Simple observable data. /test: test entry /separate: simple variable with GET with LATE reply /BlockTransfer/ObsData: Observable data block. /ObsSensor: 5:331 emNet - Test 1: Success! 5:332 emNet - Test 2: Sending GET separate 5:357 emNet - 00:00:00 5:358 emNet - Test 2: Success! 5:359 emNet - Test 3: Sending NON GET block of 16 bytes 5:372 emNet - Test data 5:373 emNet - Test 3: Success! 5:374 emNet - Test 4: PUT test 5:399 emNet - Test 4: Success! 5:400 emNet - Test 5: PUT that should fail 5:413 emNet - received error: 4.05 5:414 emNet - Test 5: Success! 5:415 emNet - Test 6: DELETE test 5:428 emNet - Test 6: Success! 5:429 emNet - Test 7: POST test 5:455 emNet - Test 7: Success! 5:456 emNet - Test 8: Observe 5:469 emNet - Obs data 5:470 emNet - GET 1 from Observe completed 15:451 emNet - Obs data 15:452 emNet - GET 2 from Observe completed 25:447 emNet - Obs data 25:448 emNet - GET 3 from Observe completed 35:443 emNet - Obs data 35:444 emNet - GET 4 from Observe completed 45:439 emNet - Obs data 45:440 emNet - GET 5 from Observe completed 45:441 emNet - Test 8: Success!
圧縮・解凍機能のデモサンプル