2328 views|7 replies

9702

Posts

24

Resources
The OP
 

Problems encountered when using IPV6 and AT+CIPSEND in ESP32 AT mode [Copy link]

 

ESP32 is a very good wireless SOC, which can be seen in many mature products. However, I always have trouble using its development environment. In order to reduce the dependence on the ESP32 development environment, you can use the ESP-AT firmware of ESP32. The ESP32 with the ESP-AT firmware can communicate with the microcontroller through the serial port, so that you can develop corresponding applications on the microcontroller you are familiar with.

In some applications that need to communicate through a wide area network, I am more accustomed to using IPV4. However, because IPV4 requires cross-operator routing, an ESP32 module cannot get an IPV4 public IP. If you want to establish a connection with other devices, you can only choose a server to transfer (in some cases, router port mapping is also difficult to achieve). In order to solve the problem of networking and reduce dependence on servers, you can try to use the current main IPV6 protocol. ESP32 also supports IPV6. Below I will share the process of using IPV6 to connect to other devices through ESP-AT.

First, you need to burn the ESP-AT firmware to the corresponding ESP32 module. The corresponding manual: Download Guide - ESP32 - — ESP-AT User Guide latest document (espressif.com) . After downloading ESP-AT, communicate with ESP32 through the microcontroller or USB to serial port, and implement the corresponding functions by sending AT commands.

Here I use USB to serial port to test using serial port assistant on PC. Open the serial port assistant and enter "AT+CIPV6=1" to enable IPV6, and enter "AT+CWJAP="SSID", "password" to connect to the corresponding router. Currently, all new routers support IPV6. You can open www.ip138.com on PC or mobile phone to check whether it supports IPV6. Huawei mobile phones can also check whether there is an IPV6 address in the IP address in "About Phone" -> "Status Information" of the mobile phone. If ESP32 obtains the IPV6 public network address, it will return "WIFI GOT IPv6 GL" after connecting to the router. At this time, enter "AT+CIPSTA?" to see the public network IPV6 address obtained by ESP32.

CIPSTA:ip6gl:The longer one at the end is the public IPV6 address.

After obtaining the public IPV6 address, you can communicate with other devices that support IPV6. ESP32 can act as a server or a client. Here we first test it by configuring ESP32 as a server.

If you want the server to support multiple connections, you can enter "AT+CIPMUX=1" before starting the service. Then enter "AT+CIPSERVER=1,7890,"TCPv6",0" to start the IPV6 TCP Socket server.

After starting the service, you can use the IPV6 TCP Socket client on other devices to connect to the public IPV6 address and port of ESP32 to establish a connection with ESP32.

I have written a client program using Csharp to establish a connection with ESP32 through its public IPV6 address. After the connection is successful, send "www.eeworld.com.cn" and the serial port of ESP32 will output the corresponding information.

If ESP32 wants to send information to other devices, you need to enter the AT+CIPSEND=len command first, where len is the length of the data to be sent. For example, if I want to send "www.eeworld.com.cn", I first enter "AT+CIPSEND=0,18", where the 0 after the equal sign is the number of connected devices when multiple connections are made, and 18 is the length of the data to be sent.

Then send " www.eeworld.com.cn " and you will receive a prompt "Recv 18 bytes SEND OK", indicating that the message was sent successfully. However, the program written in Csharp did not receive the message at this time.

After repeatedly executing "AT+CIPSEND=0,18" and " www.eeworld.com.cn ", all previously unreceived data will be received at once.

Looking at the official documentation of ESP32, you will find a sentence like this: "If all data is successfully sent to the protocol stack (it does not mean that the data has been sent to the other end)"......, that is to say, the previous data may have only been sent to the protocol stack, but it does not specify when it was sent. There is no corresponding instruction on how to force the data to be sent to the other end. This is a pity.

Through the above steps, ESP32 can be connected to other devices through the IPV6 public network address. However, it should be noted that the IPV6 address of individual users is also dynamically allocated, and it will change every once in a while. Therefore, if you want to achieve real interconnection, you still need the cooperation of the server. Of course, it only needs to report the IPV6 address of the server to the client, and does not need to process too much data. In addition to using the server, the exchange of IPV6 addresses can also be exchanged in other ways, such as SMS or email.

This post is from Domestic Chip Exchange

Latest reply

You are allowed to pretend, but don't overdo it.   Details Published on 2023-8-29 13:04
Personal signature虾扯蛋,蛋扯虾,虾扯蛋扯虾
 
 

3414

Posts

0

Resources
2
 

IPV6?

Mobile fixed network is impossible.

This post is from Domestic Chip Exchange

Comments

Doesn't mobile broadband support IPV6?  Details Published on 2023-8-28 10:41
Personal signature

So TM what......?

 

 
 

6742

Posts

2

Resources
3
 

Will IPV6 be updated regularly?

This post is from Domestic Chip Exchange

Comments

meeting  Details Published on 2023-8-28 10:41
 
 
 

9702

Posts

24

Resources
4
 
ljj3166 posted on 2023-8-27 22:31 IPV6? Mobile fixed network said it is impossible.

Doesn't mobile broadband support IPV6?

This post is from Domestic Chip Exchange

Comments

Technically, it is definitely supported. However, individual users can usually get a NAT LAN address, unless they pay extra money to get a dedicated line or spuer pro extreme final VIP.  Details Published on 2023-8-28 13:38
Personal signature虾扯蛋,蛋扯虾,虾扯蛋扯虾
 
 
 

9702

Posts

24

Resources
5
 
wangerxian posted on 2023-8-28 09:27 Will IPV6 be updated regularly?

meeting

This post is from Domestic Chip Exchange
Personal signature虾扯蛋,蛋扯虾,虾扯蛋扯虾
 
 
 

3414

Posts

0

Resources
6
 
littleshrimp posted on 2023-8-28 10:41 Does mobile broadband not support IPV6?

Technically, it is definitely supported. However, individual users can usually get a NAT LAN address, unless they pay extra money to get a dedicated line or spuer pro extreme final VIP.

This post is from Domestic Chip Exchange

Comments

spuer pro extreme final VIP What is this? It's unfathomable!  Details Published on 2023-8-28 19:49
Personal signature

So TM what......?

 

 
 

7422

Posts

2

Resources
7
 
ljj3166 posted on 2023-8-28 13:38 Technically, it is definitely supported. However, individual users can get a NAT LAN address in most cases, unless they pay extra money to get a dedicated line or spuer ...

spuer pro extreme final VIP What is this? It's unfathomable!

This post is from Domestic Chip Exchange

Comments

You are allowed to pretend, but don't overdo it.  Details Published on 2023-8-29 13:04
Personal signature

默认摸鱼,再摸鱼。2022、9、28

 
 
 

3414

Posts

0

Resources
8
 
freebsder posted on 2023-8-28 19:49 spuer pro extreme final VIP What is this? It is unfathomable!

You are allowed to pretend, but don't overdo it.

This post is from Domestic Chip Exchange
Personal signature

So TM what......?

 

 
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list