Shop OBEX P1 Docs P2 Docs Learn Events
ESP8266 115200 Baud Issues — Parallax Forums

ESP8266 115200 Baud Issues

ProcessingData...ProcessingData... Posts: 208
edited 2014-10-09 05:12 in Propeller 1
I have a couple of ESP8266 modules, and I am trying to make them work with the Propeller.

I am able to get most of the responses from the module, as shown below:
Starting Up Terminal
AT




OK


AT+RST




OK






 ets Jan  8 2 boot mode:(3,6load 0x40100000m 16


tail 12


chksum 12 room 4


loan 3168, room 12


tail 4


chksum e8c60, len 4956, room 4


tail 8


chksum




ready


AT+CWMODE=1
no change


AT+CWJAP="blackbox","BlackBox44"




OK


AT+CIFSR
192.168.254.18


AT+CIPMUX=0




OK


AT+CIPSTART="TCP","taylorcoffelt.com",80
Starting Up Terminal
AT




OK


AT+RST




OK






 ets Jan  8 2 boot mode:(3,6load 0x40100000m 16


tail 12


chksul 12 room 4


loen 3168, room 12


tail 4


chksum e8c60, len 4956, room 4


tail 8


chksum




ready


AT+CWMODE=1
no change


AT+CWJAP="blackbox","BlackBox44"




OK


AT+CIFSR
192.168.254.18


AT+CIPMUX=0




OK


AT+CIPSTART="TCP","retro.hackaday.com",80




OK


Linked


AT+CIPSEND=18


GET / HTTP/1.0\r\n
usy






SEND OK






+IPD,323:HTTPuest


Server: n: Thu, 09 Oct 2


Content-Type:ent-Length: 172ose






<html>


 Bad Request</tody bgcolor="whh1>400 Bad Requ>


<hr><center>ter>


</body>


</html>






OK






OK


Unlink

However, the responses are mangled sometimes, as shown in the log.

My code is shown below:
{Object_Title_and_Purpose}




CON
        _clkmode = xtal1 + pll16x                                               'Standard clock mode * crystal frequency = 80 MHz
        _xinfreq = 5_000_000




        baud  = 115200
        RXPIN = 1
        TXPIN = 0
                     
OBJ
  
  serial        : "FullDuplexSerialPlus"
  term          : "FullDuplexSerialPlus"
  stringEngine  : "StringEngine"


PUB main | i,j,request


serial.start(RXPIN, TXPIN, 00, baud)
term.start(31,30,0,115200)




waitcnt(clkfreq*4+cnt)
term.str(string("Starting Up Terminal",13))


sendCommand(string("AT"))
getResponse


'repeat
sendCommand(string("AT+RST"))
getResponse


sendCommand(string("AT+CWMODE=1"))
getResponse


sendCommand(string("AT+CWJAP=",34,"SSID",34,",",34,"Passwd",34))
getResponse


  
sendCommand(string("AT+CIFSR"))
getResponse


sendCommand(string("AT+CIPMUX=0"))
getResponse


sendCommand(string("AT+CIPSTART=",34,"TCP",34,",",34,"retro.hackaday.com",34,",80"))
getResponse


request := string("GET / HTTP/1.0\r\n")
sendRequest(request)
getResponse


repeat


PRI getResponse | i, a


  serial.rxflush
          
  i:= serial.rx
  repeat while i <> -1
    term.tx(i)
    i:= serial.rxtime(5000)


  return true


PRI waitFor(char) | i


  serial.rxflush


  i:= serial.rx
  repeat while i <> char
    term.tx(i)
    i := serial.rxtime(5000)
    if i == -1
      sendCommand(string("AT+CIPCLOSE"))
      term.str(string("Connection Timeout"))
      abort


  return true 
PRI sendCommand(strng) | i


  repeat strsize(strng)
    term.tx(byte[strng])
    serial.tx(byte[strng++])
      
  term.tx(13)
  serial.tx(13)
  serial.tx(10)
   
  return true


PRI sendRequest(request)


  term.str(string("AT+CIPSEND="))
  term.dec(strsize(request))
  term.tx(13)
  term.tx(10)


  serial.str(string("AT+CIPSEND="))
  serial.dec(strsize(request))
  serial.tx(13)
  serial.tx(10)


  waitFor(">")
  sendCommand(request)  



Any ideas as to why the responses would be mangled?

Comments

  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2014-10-08 20:47
    Sounds like the Propeller isn't keeping up with the data stream from the module. Try one of the buffered 2K or 4K versions of FullDuplexSerial.

    Also, my Bluetooth terminal program *might* be useful in getting started with these. I originally wrote a simple terminal program on my system to talk to the module.

    https://www.dropbox.com/s/mm5b663t5u9w7k6/Bluetooth_Helper.zip
  • ProcessingData...ProcessingData... Posts: 208
    edited 2014-10-08 20:51
    Thanks, @Oldbitcollector.
    Are those on the Obex?

    And I'll check out the Bluetooth terminal program.
  • msrobotsmsrobots Posts: 3,709
    edited 2014-10-08 21:29
    To me It looks as If your responses are truncated at the front.

    comment out the serial.rxflush part, just for a try. It may delete needed chars in the buffer.

    Enjoy!

    Mike
  • ProcessingData...ProcessingData... Posts: 208
    edited 2014-10-09 05:12
    Thank you both for your input and help! I got it working last night. The Rx.flush actually helped clean out any straggling newlines that were sent. I modified the 2k FullDuplexSerial that was in the zip that @oldbitcollector posted, and with that modification, it finally worked.

    I'll post the code after I've cleaned it up a bit.
Sign In or Register to comment.