ESP-WROOM-32 AT commands firmware

wind_energy
Posts: 28
Joined: Fri Feb 03, 2017 10:36 pm

Re: ESP-WROOM-32 AT commands firmware

Postby wind_energy » Sun Feb 12, 2017 12:02 am

Rudi, can you see what i`m doing wrong?

SoftAP + Station mode

Code: Select all

AT+CWMODE=3


OK
AT


OK

AT+CWSAP?

+CWSAP:"ESP_2CB220","",1,0

OK


AT+CIFSR

+CIFSR:APIP,"192.168.4.1"
+CIFSR:APMAC,"1a:fe:34:2c:b2:20"
+CIFSR:STAIP,"0.0.0.0"
+CIFSR:STAMAC,"18:fe:34:2c:b2:20"

OK

AT+CIPMUX=1


OK
AT+CIPSERVER=1,909


OK

Station mode

Code: Select all

AT+CWMODE=1


OK
AT+CWLAP

+CWLAP:(0,"ESP_2CB220",-9,"1a:fe:34:2c:b2:20",1)

OK

AT+CIFSR

+CIFSR:STAIP,"0.0.0.0"
+CIFSR:STAMAC,"18:fe:34:2c:d8:d0"

OK

AT+CWJAP="ESP_2CB220","",


OK

AT+CIFSR

+CIFSR:STAIP,"0.0.0.0"
+CIFSR:STAMAC,"18:fe:34:2c:d8:d0"

OK

AT+CIPSTATUS

STATUS:2

OK

AT+CIPMUX=1


OK
AT+CIPSERVER=1,909


OK

AT+CIPSTART="UDP","192.168.4.1",909

Link typ ERROR
Regards :D

WiFive
Posts: 3091
Joined: Tue Dec 01, 2015 7:35 am

Re: ESP-WROOM-32 AT commands firmware

Postby WiFive » Sun Feb 12, 2017 2:51 am

Try to set your IP/gateway/netmask on your station/client.

User avatar
rudi ;-)
Posts: 1564
Joined: Fri Nov 13, 2015 3:25 pm

Re: ESP-WROOM-32 AT commands firmware

Postby rudi ;-) » Sun Feb 12, 2017 5:19 am

wind_energy wrote:
Rudi, can you see what i`m doing wrong?
Hi Pawel,

1)
If you use UDP as protokoll
you do not need to set a Server
Server you only create if you use "TCP"
then you must connect the client with AT+CIPSTART="TCP"....

so the command on SoftAP + Station mode

Code: Select all


AT+CIPSERVER=1,909

is not need.

2)

edit: ( UDP-> TCP )
If you only connect one Client to the "TCP SERVER"
you do not need to multiple connection AT+CIPMUX=1
you can use single connection AT+CIPMUX=0

if you use UDP and you want connect more as one Client
you can use multiple connection AT+CIPMUX=1 and you have then ID too,
but you do not really need to do this, you have from each "client" the ip
so you can send to the ip from each "client" or Softap/"server"

if you use on each UDP device the same port
this is no problem too, because you have from each UDP device the ip
if you want to send to more as one UDP device
you can send broadcast messages too

if you want to start more as one UDP services on an UDP device
you can use multiple connection AT+CIPMUX ( it is recommend )
so you can make on ID more as one UDP at one UDP device
ID1 UDP ADC Service
ID2 UDP PWM Service
ID3 TCP HTTPServer Service
and so on


3)
you can not connect by "UDP" to a "TCP" Server

4)
in UDP it is not need for multiple connection ( but you can use it if you want/need)

5)
Use DHCP if you want to set IP auto
You can set IP static too
see example:
Station: AT+CIPSTA
SoftAP: AT+CIPAP


wind_energy wrote:
SoftAP + Station mode

Code: Select all

AT+CWMODE=3


OK
AT


OK

AT+CWSAP?

+CWSAP:"ESP_2CB220","",1,0

OK


AT+CIFSR

+CIFSR:APIP,"192.168.4.1"
+CIFSR:APMAC,"1a:fe:34:2c:b2:20"
+CIFSR:STAIP,"0.0.0.0"
+CIFSR:STAMAC,"18:fe:34:2c:b2:20"

OK

// NOT NEED see (2) if you use Single connection in UDP
// AT+CIPMUX=1


OK

// NOT NEED see (1) if you use "UDP"
// AT+CIPSERVER=1,909


OK
the rest of SoftAP is ok.
now Station:

see comments in the "at code"..


wind_energy wrote: Station mode

Code: Select all

AT+CWMODE=1


OK
AT+CWLAP

+CWLAP:(0,"ESP_2CB220",-9,"1a:fe:34:2c:b2:20",1)

OK

// ** the first will you inform that you have no ip get...cause you are not connected with the SoftAP..

AT+CIFSR

+CIFSR:STAIP,"0.0.0.0"
+CIFSR:STAMAC,"18:fe:34:2c:d8:d0"

OK

AT+CWJAP="ESP_2CB220","",


OK

// if you get an OK for join in the AP
// then usually the next try to get local IP must be possitive..
// you can try to check if your SoftAP DHCP is switch on
// you can try to check if your Client DHCP is switch on

AT+CIFSR

+CIFSR:STAIP,"0.0.0.0"
+CIFSR:STAMAC,"18:fe:34:2c:d8:d0"

OK

AT+CIPSTATUS

STATUS:2

OK

AT+CIPMUX=1


// you do not need a second server ;-)
// if you want send bidirektional you can use one server
// the server has a local port example 909
// the client has a local port this is auto done by the client..
// ..

OK
// not need..
// AT+CIPSERVER=1,909


OK

// now comes the "big" mistake
// you have start on Station AP a "TCP" server with AT+CIPSERVER=1,909
// and you try now with your client to connect the "TCP" server with an "UDP" protokoll

AT+CIPSTART="UDP","192.168.4.1",909

Link typ ERROR



try this if you want use UDP
-----------------------------------

on SoftAP + Station ESP32 Modul
Your Port: 909

on Station ESP32 Modul
Your Port: 808 ( you can use 909 too, but here only for better see what is going on )

on each "close" the port would be change, so you can do:
You want not change the ports in next time, so you can use the "parameter" 0,
The Parameter comes later here, only just in time for your eyes.


// SoftAP + Station
AT+CWMODE=3

// DHCP on for SoftAP
// each connected Client will get auto an IP
AT+CWDHCP=3

// Check Your SoftAP
// ok...
AT+CWSAP?
+CWSAP:"ESP_2CB220","",1,0


// Change and Set Your SoftAP with encryption und hidden SSID
// <ssid>,<pwd>,<channel>,<encryption>,<maxconn>,<ssidhidden>
AT+CWSAP="pawelnetwork","not4uPassort",1,4,10,1

// you can check your ips
// ok...
AT+CIFSR

+CIFSR:APIP,"192.168.4.1"
+CIFSR:APMAC,"1a:fe:34:2c:b2:20"
+CIFSR:STAIP,"0.0.0.0"
+CIFSR:STAMAC,"18:fe:34:2c:b2:20"

OK


// now remember you, SoftAP/SVR port (909) , Station/Client Port (808) and UDP
// so simple start a "UDP" network on your StationAP, local port is 909, and remote(client side) port will be 808
// the ip address you must use from the client, usually StationAP is 192.168.4.1 and the client becomes 192.168.4.2
// you must check it
// the last parameter is "do not change the ports after close, and reconnect"
// note: in UDP you must give the first port parameter for the remote, the second is for local
// so for SoftAP (909) is valid

AT+CIPSTART="UDP","192.168.4.2",808,909,0

// your "UDP" (server) network is ready on StationAP side

// **********

// now Station
// Station Mode ..
AT+CWMODE=1

// join to SoftAP

AT+CWJAP="pawelnetwork","not4uPassort"

// you can check your client IP
// usually comes the next after the SoftAP Ip ( 192.168.4.1 ...192.168.4.2 ...192.168.4.3 and so on )
AT+CIFSR

+CIFSR:STAIP,"192.168.4.2"
+CIFSR:STAMAC,"18:fe:34:2c:d8:d0"


// set up your client for the "UDP" network
// now remember you, SoftAP/SVR port (909) , Station/Client Port (808) and UDP
// so simple start a "UDP" network on your Sation (client), local port is 808, and remote(SoftAP, "Server" side) port will be 908
// the ip address you must use from the SoftAP, usually is 192.168.4.1 ..
// you must check it
// the last parameter is "do not change the ports after close, and reconnect"
// and here same
// note: in UDP you must give the first port parameter for the remote, the second is for local
// so for Station (808) is valid

AT+CIPSTART="UDP","192.168.4.1",909,808,0

// your "UDP" (server) network is ready on Station ( client ) side


// now you can start
// if you want start first to try one message to the other so try on SoftAP
// you use single connection so set it:

AT+CIPMUX=0

// now send 7 chars
AT+CIPSEND=7

hello_1

// now you have send from SoftAP to the Station, you must see on Station Terminal your message

// now send from Station to SoftAP
// single connection

AT+CIPMUX=0

// now send 7 chars
AT+CIPSEND=7

hello_2

// now you have send from Station to the SoftAP, you must see on SoftAP Terminal your message

mode_0.png
mode_0.png (27.34 KiB) Viewed 7169 times


// edit typo: no -> now
// now start transparent mode on each side
// each character you send from one you will see in the other

// SoftAP
AT+CIPMODE=1

// Station
AT+CIPMODE=1

// SoftAP
// now push your data to Station bidirectional
// each char you put you send to the connected esp


// Station
// now push your data to SoftAP bidirectional
// each char you put you send to the connected esp



// you stop the transmission by sending "+++"
// you must do this without delays and spaces and CR and LF

Code: Select all

esp_at_port_write_data( (uint8_t *) "+++", strlen("+++"));


// if you want to start your transmission again
// so select transparent 1 mode or normal mode 0
// AT+CIPMODE=1
// or
// AT*CIPMODE=0

// if you want close the "UDP" network
// SoftAP
AT+CIPCLOSE

// Station
AT+CIPCLOSE
mode_1.png
mode_1.png (19.32 KiB) Viewed 7169 times


question if you have , write here :)
let me know how you get on

best wishes
rudi ;-)
Last edited by rudi ;-) on Tue Feb 14, 2017 11:57 am, edited 2 times in total.
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

User avatar
rudi ;-)
Posts: 1564
Joined: Fri Nov 13, 2015 3:25 pm

Re: ESP-WROOM-32 AT commands firmware

Postby rudi ;-) » Sun Feb 12, 2017 5:31 am

WiFive wrote:Try to set your IP/gateway/netmask on your station/client.

Code: Select all

AT+CWJAP="ESP_2CB220","",


OK
AT+CIFSR

+CIFSR:STAIP,"0.0.0.0"
+CIFSR:STAMAC,"18:fe:34:2c:d8:d0"

OK

looks like a smal bug:
"OK" comes but AT+CWJAP parameter command is wrong with this parameters
cause AT Command is wrong with this parameter,
there is no IP :ugeek:

DHCP,GW is standard active

best wishes
rudi ;-)
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

wind_energy
Posts: 28
Joined: Fri Feb 03, 2017 10:36 pm

Re: ESP-WROOM-32 AT commands firmware

Postby wind_energy » Sun Feb 12, 2017 9:30 am

Rudi ;) Yours posts are very very helpfull! Now I do understand far better then before :) Your posts are a good lessons not only for me.
I`m glad, you are here :) tomorrow I`ll try again :) Best regards ! :)

User avatar
rudi ;-)
Posts: 1564
Joined: Fri Nov 13, 2015 3:25 pm

Re: ESP-WROOM-32 AT commands firmware

Postby rudi ;-) » Sun Feb 12, 2017 1:45 pm

;-)

hi pawel
if you not trust DATA Packet sends/received
things further for your way, if you not have know:

UDP is fast - but not sure, that all data packets send/received
and they are not sorted, it can be, that a packet you send before a next packet
received later as the next packet.

you can use own increment ID for each packet and build on receiver site at this increments your data
if one is wrong or missed, you can send back that sender must send again and so on...
but then UDP is not fast.. ( this work do TCP auto..)

TCP is small slower, but if data packets hang or not successfull send/received
there is auto controll for this in the TCP protokoll, and the packets are incremented in right structure ( First in Firt out )

"UDP" vs. "TCP"

if you have problems with SoftAP WEP/WPA/WPA2, you can try for first steps an Open Network
if communication then stable, you can try step by step to go on for secure Network and change open to encrypted..hidden

next step you can then use not UDP, not TCP, you can try a SSL connection too.
( from myself not tested just in time )


AT+CIPSTART Establishes TCP connection, UDP transmission or SSL connection.
ESP32_AT_SSL.jpg
ESP32_AT_SSL.jpg (233.44 KiB) Viewed 7146 times
have phun!

best wishes
rudi ;-)
Last edited by rudi ;-) on Sun Feb 12, 2017 1:51 pm, edited 1 time in total.
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

User avatar
rudi ;-)
Posts: 1564
Joined: Fri Nov 13, 2015 3:25 pm

Re: ESP-WROOM-32 AT commands firmware

Postby rudi ;-) » Sun Feb 12, 2017 1:49 pm

append:
---------
you can use UART for AT Commands , you can also use SPI, Socket
taken from overview:

It supports custom AT commands based on the lib and related APIs, and ones can also define input and output medium, like uart, spi, socket, bt, etc.

The demo is the AT command set based on uart.You can replace uart driver with other drivers whichever you want to use.But you have to make some changes in at_task.c. In addition,you can add some custom AT command in at_custom_cmd like AT+CIUPDATE if necessary.


nice sunday!

best wishes
rudi ;-)
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

wind_energy
Posts: 28
Joined: Fri Feb 03, 2017 10:36 pm

Re: ESP-WROOM-32 AT commands firmware

Postby wind_energy » Tue Feb 14, 2017 12:35 am

Rudi all works perfectly !! :) :D :D MANY THANKS !!!! :D :D :D Now it is piece of cake :) All thanks to you :D :D
Best regards and meet you soon because it is not the end :)

Luca_Guazzaroni
Posts: 4
Joined: Thu Feb 23, 2017 1:12 pm

Re: ESP-WROOM-32 AT commands firmware

Postby Luca_Guazzaroni » Fri Feb 24, 2017 2:44 pm

Hello!

I've been trying to use the AT command firmware https://github.com/espressif/esp32-at with no results.

i use the following configuration:

Component Config -> AT (using a usb-serial adapter)
*uart port number for AT command = 1
*uart rx pin for AT command = 16
*uart tx pin for AT command = 17

Serial Flasher config
*Flash SPI mode: DIO
*Flash SPI Speed: 40MHz
*Flash size = 4Mbit

also i tried with
Component Config -> AT
*uart port number for AT command = 1
*uart rx pin for AT command = 16
*uart tx pin for AT command = 17

also with no result. With no result, i mean that i send command with no reply from the esp

con you tell me what i'm doing wrong?
PD: the chips aint damaged because it works with the hello world example

thank you!!

User avatar
rudi ;-)
Posts: 1564
Joined: Fri Nov 13, 2015 3:25 pm

Re: ESP-WROOM-32 AT commands firmware

Postby rudi ;-) » Sat Feb 25, 2017 9:22 am

Hi Luca,
Luca_Guazzaroni wrote:

Component Config -> AT (using a usb-serial adapter)
*uart port number for AT command = 1
*uart rx pin for AT command = 16
*uart tx pin for AT command = 17
have you switched your usb serial adapter to 3.3V?
have you connected cross?
ESP32(uart rx -> usb-serial adapter(uart tx pin)
ESP32(uart tx -> usb-serial adapter(uart rx pin)
and have you connect
ESP32(GND) -> usb-serial adapter ( GND)

Luca_Guazzaroni wrote: also i tried with
Component Config -> AT
*uart port number for AT command = 1
*uart rx pin for AT command = 16
*uart tx pin for AT command = 17

also with no result. With no result, i mean that i send command with no reply from the esp
ok, no reply from esp,
do you see the boot message in your terminal?
see you the ready
uart_at_ready.png
uart_at_ready.png (1.94 KiB) Viewed 7041 times

which terminal program you use?
after send command, example
AT+GMR
the send command must followed by return \r and newline \n character
uart_at.png
uart_at.png (43.69 KiB) Viewed 7041 times
hope this helps

best wishes
rudi ;-)
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

Who is online

Users browsing this forum: No registered users and 47 guests