Git Product home page Git Product logo

atproto's Introduction

Build status

AT protocol library and firmware

This is an attempt to implement DCE and DTE sides of an AT protocol, mostly based on Recommendation V.250. The code has two parts: a platform-independent code for basic DCE/DTE functions, and target-specific commands that control WiFi, TCP/IP, etc. The main target for DCE is an ESP8266 chip, but it is easy to add other targets as well, or pull the platform-independent code into another project.

The AT commands supported by the ESP8266 target are described here.

What works so far:

  • DCE (i.e modem side) only. Haven't started working on DTE (host) side.
  • Parsing and handling of basic and extended syntax commands and S-parameters
  • Response formatting option (ATV)
  • Echo (ATE)
  • Result code suppression (ATQ)
  • Baud rate setting (AT+IPR) saved to flash
  • Reset (ATZ)
  • Chip id (AT+GSN) and version (AT+GMR) queries
  • Wifi commands (CWLAP, CWJAP, CWSAP, CWSTAT, CWLIF)
  • Wifi connection status reports (+CWSTAT:)
  • Commands to get IP and MAC address for AP and STA (CIPAP?, CIPSTA?, CIPAPMAC?, CIPSTAMAC?)
  • Domain names resolution (CIPRESOLVE)
  • TCP/UDP socket context create/release (CIPCREATE, CIPCLOSE)
  • TCP/UDP client connect/disconnect (CIPCONNECT, CIPDISCONNECT)
  • Send/receive data (CIPSENDI, CIPRD)

Next up:

  • TCP/UDP server
  • MQTT
  • Pass-through mode for TCP/UDP connections
  • More unit tests
  • Handling of malformed input (besides returning ERROR)
  • DTE part of the business

Many commands that return ERROR print error reason when debug output is enabled. To enable debug output, issue AT+IDBG=1 command.

Prebuilt firmware for ESP8266

If you don't want to go through the build process described below (though I advise you do), get the prebuilt binaries on my website.

Make

ESP8266

  • Install/compile the toolchain. Check the ESP8266 community wiki for instructions.
  • Get the ESP8266 SDK version 0.9.3.
  • Adjust XTENSA_TOOCHAIN, XTENSA_LIBS, SDK_BASE, ESPTOOL directories in target/esp8266/target.mk
  • Apply the diff in target/esp8266/c_types.h.diff to include/c_types.h in the SDK so that it doesn't redefine types from stdint.h.
  • Run make clean all TARGET=esp8266
  • The firmware will be generated in bin/0x00000.bin and bin/0x40000.bin

Host

There are some unit tests for target-independent code that run on PC. Doing make test will build the tests and run them. Don't forget to make clean before you make test if you have built for ESP8266 before that, or the linker will complain about unsupported object file format.

License

BSD. See the LICENSE file.

I use Catch for unit tests (it's in include/catch.hpp), see header for it's own license.

atproto's People

Contributors

igrr avatar jaseg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

atproto's Issues

AT&F1 not clears all settings

Hi,

AT&F1 does not wipe everything, WiFi config is not wiped. After issuing AF&F1 I get "OK" then I cycle power but I get +CWSTAT:1 and +CWSTAT:5 ..

I'm running fw: 0.1 rev. b59a35d

Socket Client - Can't send hex 0x00

Hi Igrr,

On socket client, using +CIPSENDI, It works for 0xFF, 0x01, etc. But i got an error if i try to send 0x00, as you can see in the code below:

AT+CIPSENDI=0,"\xFF"

OK

+CIPSENDI:0
AT+CIPSENDI=0,"\x01"

OK

+CIPSENDI:0
AT+CIPSENDI=0,"\x00"

ERROR

Thanks again

add handshake RTS/CTS

i would like to suggest to add a possibility (AT command) to enable or disable an hardware handshake with 2 GPIO : RTS and CTS pins
most of the module provide at least GPIO0 and GPIO2.
by default, handshake is disable. after boot of the module, we can enable the handshake.
GPIO0 stay an input : CTS pin => if active, the ESP8266 can send the message to the CPU

i don't know if it is easily doable with the actual SDK ?

regards

Clear data on ESP Easy everytime new firmware uploaded

My main issue is that I cannot reset data to default regardless which firmware is uploaded.

It allays comes with same setting, and unable to reset it to default, or upload config file.

I think it would be a good practice to overwrite data every time new firmware is updated (uploaded).

Watchdog reset after changing baud rate from 9600 to 115200

Happens when building against 0.9.2, was ok with 0.9.1.

AT+IPR?

+IPR:9600
AT+IPR=?

+IPR:(0),(9600,19200,38400,57600,74880,115200,230400,460800,921600)
AT+IPR=115200
¨�‰ú@›zHzńśT¶ůÄĄ
+CWSTAT:1

+CWSTAT:5
AT+IPR?

+IPR:9600

No ready after boot

Hi,

I just flashed your latest bin fw ( 8f6aadf 2014-11-18 ) into esp module but now there is no "ready" text after successful boot.
I tried at all baud rates that comes to my mind (9600,14400,19200,28800,38400,57600,115200,128k,256k) but just there is no "ready" text...

So, I got hit with idea: add to header/welcome/greeting text some more info in recognizable way that this is message (unsolicited result??) from boot :

<cr>+boot:v:atproto:[BuildDate]:[commit_id]<cr>
ready<cr>

Explanation:
+boot - no need to explain :)
v - stands for Version info
Other fields explains itself 😄

e.g.:

<0>l`����nnŽ�l��nrŽ’’n�ŚŽ�l�r’’n�ŚŽ�l<cr>
+boot:v:atproto:20141118:8f6aadf<cr>
ready<cr>

Personally I would love to get sth like that below, but this is my crazy, personal wishful thinking 😝 and this goes off from official AT - before and after "ready" should be CR, but not in my case:

<cr>
+boot:v:atproto:20141118:8f6aadf<cr>
+boot:n:0032fd4b<cr>
+boot:ready<cr>

n - is for S/N and mac (are the same)

Full factory reset command

Hi,

I have replaced my router (and chaged my ISP ) few days ago, and I have new wifi SSID ofc... I have powered ESP module (with orginal fw) and I could not list WLAN networks (module just hungs-up on CWLAP)...
So I thought would be very convenient to have command that could do a full factory reset: reset stored SSID(+passwd for them), CWMODE, CWSAP, etc. - all settings that can be changed by user to "factory default".
Now we have ATF but it reset only few options for serial interface, it could do a full factory reset, or create new command?

Uploading the code

Hi
Bear in mind I'm a PC user - so compiling the code is giving me problems.. I thought I'd try out the binaries from your site - using ESP8266flasher.exe I tried them one after the other. There is an address setting in the program but it does not seem to do anything. I've used it several times to upload the official code to the ESP-01 board no problem... but here I've tried uploading both of your bin files - and all I get when I connect a terminal to the board is a continuous string of garbage characters. Any thoughts?

Sending data with CIPSENDI into a disconnected context causes reset

On of the issues I've seen with other software is resetting..

So I tried your latest software - I have to say, this already looks better than others I've seen as you can resolve domain names - thats' great.

So I hooked the board to my router - no problem - set it up as a listener on port 4000, no problem and had my Android App start firing commands at it and manually firing stuff back at the APP - for a minute it looked good - the app responded... but if you look at below... that looks remarkably like a reboot to me!! Any ideas?

+CIPDR:4,92
AT+CIPSENDI=4,"1\r\n0x00" OK

+CIPSENDI:4

+CIPDR:4,96

+CIPRECONNECT:4,-11

+CWSTAT:3
ERROR

+CWSTAT:5
ERROR

CIPNOTACCEPT

+CIPDR:4,100
AT+CIPSENDI=0,"1\r\n0x00" OK
AT+CIPSENDI=0,"1\r\n0x00" OK
AT+CIPSENDI=0,"1\r\n0x00" OK
AT+CIPSENDI=0,"1\r\n0x00" OK

+CIPDISCONNECT:4

CIPNOTACCEPT
AT+CIPSENDI=0,"1\r\n0x00"
+CIPDR:4,104

c_GORSvfJSzbFjSvbn|
+IREADY:"atproto","0.1","b59a35d"

+CWSTAT:1

Yepp.. definitely - connected again - saw some commands coming in - I was a bit slow at sending something back - and as you can see the APP has connected again - till all 4 connections used.. and smack in the middle- the little WIFI board has rebooted. Surely it should not do this..

+CIPDISCONNECT:4

+CIPDISCONNECT:4

+CIPDISCONNECT:4

CIPNOTACCEPT

+CIPDR:4,16

+CIPDISCONNECT:4

+CIPDISCONNECT:3

CIPNOTACCEPT

+CIPDR:3,4

+CIPDISCONNECT:3

CIPNOTACCEPT

+CIPDR:3,8
AT+CIPSENDI=3,"1\r\n"
c_GORSvfJSzbFjSxbn|
+IREADY:"atproto","0.1","b59a35d"
AT+CIPSENDI=3,"1\r\n"
+CWSTAT:1

+CWSTAT:5

Rename +CWSTAT command

Currently there is a +CWSTAT? command (which responds with +CWSTAT:<code>) and an unsolicited result code with the same name. Need to resolve this ambiguity, probably by renaming the command (someone might be already using the URCs, and it's easier to detect that the command is broken than to detect a renamed URC).

wdt_reset after closing server and receiving data

As martinayotte (from ESP8266 Forum @ Post ) noticed, that after closing server by CIPCLOSE , and sending data to closed server causes watchdog to bite 😉 esp and reboot him.
I do confirm this issue. I run a test, and sent data after AT+CIPCLOSE=6 and there is log from terminal:

+CWSTAT:1

+CWSTAT:5
AT+IDBG?

+IDBG:0
AT+IDBG=1

OK
AT+GMR

0.1 rev. 00eefbd

OK
AT+GMM

Chip: ESP8266EX
Firmware: https://github.com/igrr/atproto

OK
AT+GMEM

38296
data  : 0x3ffe8000 ~ 0x3ffe8a54, len: 2644
rodata: 0x3ffe8a60 ~ 0x3ffeab4c, len: 8428
bss   : 0x3ffeab50 ~ 0x3fff2010, len: 2330
OK
AT+CIPSTA?

+CIPSTA:"192.168.2.14"
AT+CIPLISTEN="TCP",2222

+CIPLISTEN:6,2222,2048

+CIPACCEPT:0,"192.168.2.26"

+CIPDR:0,29

+CIPDISCONNECT:0
AT+CIPRD=0

+CIPRD:0,29

This TCP server is working :)

OK
AT+CIPCLOSE=6

OK
Fatal exception (29): 
epc1=0x4000df98, epc2=0x00000000, epc3=0x00000000, excvaddr=0x0000000c, depc=0x00000000

 ets Jan  8 2013,rst cause:4, boot mode:(3,6)

wdt reset
load 0x40100000, len 23716, room 16 
tail 4
chksum 0xd5
load 0x3ffe8000, len 2644, room 4 
tail 0
chksum 0x80
load 0x3ffe8a60, len 8428, room 8 
tail 4
chksum 0x72
csum 0x72

+CWSTAT:1

+CWSTAT:5

AT+CIPSTA not saved permanently

Huuurraaa, banzai, all hail the igrr 😀
Now we (or me at least 😄) got most awaited feature!
Works almost perfect, except that ip address is not set back to defined after reboot 😟

Trying to read a not used ID server cause reset

Hi Igrr,

First of all, thanks for your hard work!

I found a issue in my bench tests, that i want to share with you.

If I try to read an ID already not used, i got a reset.

I know... I can't read an ID not used, but i think that is a small bug.

Thanks a lot

AT+CIPSTA?

+CIPSTA:"10.1.68.192","255.255.255.0","10.1.68.1"
AT+CIPLISTEN="TCP",10000,2048

+CIPLISTEN:6,10000,2048

+CIPACCEPT:0,"10.1.70.126"

+CIPDR:0,6

+CIPDR:0,8
AT+CIPRD=0

+CIPRD:0,8

123456


OK

+CIPDISCONNECT:0
AT+CIPRD=0

+CIPRD:0,0



OK
AT+CIPRD=1
Fatal exception (28):
epc1=0x40247b76, epc2=0x00000000, epc3=0x00000000, excvaddr=0x00000014, depc=0x00000000

 ets Jan  8 2013,rst cause:4, boot mode:(3,7)

wdt reset
load 0x40100000, len 24112, room 16 
tail 0
chksum 0x7c
load 0x3ffe8000, len 2692, room 8 
tail 12
chksum 0xdc
ho 0 tail 12 room 4
load 0x3ffe8a90, len 8728, room 12 
tail 12
chksum 0x6a
csum 0x6a
rl

AT+CIPSTA - IP address type [feature request]

Hi,

I just finished compiling command set of atproto into spreadsheet (Excel/Calc) and I noticed, that we don't know if CPISTA returned IP address is assigned by DHCP server or set manually. So I would suggest adding field to response CIPSTA which allow to identify source of module IP address: (DHCP or static). I would suggest numerical value:
0 - for DHCP (like CIPSTA set command - 0 to get IP from dhcp server)
1 - for static IP address

MQTT implementation

Just wondering if this is still on the TODO list? Or perhaps how far, if in progress?

Not rushing, just asking :)
Great work btw!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.