Any advice for Serial Port Handshake?

backupluis
Posts: 5
Joined: Tue Nov 29, 2016 11:10 am

Any advice for Serial Port Handshake?

Postby backupluis » Sun Feb 05, 2017 11:01 am

My Scenario:

An old home alarm system converted to a new one with a pic micro replacing the old on-board micro.
System is configured by remote controls or by usb interface on the pic.
I made a desktop app and an android app to configure the system.
This was built more than 2 years ago and runs very well.

Now I buy a esp01 module to attach to the alarm system to do things via wifi, like reading reports, configure the system and so on...
I want to use the AT firmware, because it has a lot of things already implemented and don't want to write my own code based on RTOS for this case.

Everything is advanced, at the moment I configure the wifi module via the usb port of the pic, my app send commands via usb and the pic send the command/string to the esp module, get the response from the module and send it back to the app.

Everything goes well except for:
Long responses from esp module, for example scan ap.

My pic has a very little ram memory and I can't buffer a long response from esp module and send it back to app.
So I was searching for some CTS/RTS or XOn/XOff solution but I found nothing, except modules with dedicated pins for cts/rts.

Is there any solution that somebody can tell me for my problem?

My thoughs so far:

* Compile my own at non os with some rewrited commands, for example make a clone of AT+CWLAP like AT+CWLAP_BUFF and write results to a buffer in esp ram memory and then implement another AT command to retrieve the buffer line by line. But I don't know if the at non os source is available, espressif/ESP8266_AT on github have 2 years.

* Cut unused gpiox trace from the connector and solder a wire to some rts/cts pin on esp8266 and enable hardware handshaking.

* Ask to espressif to implement xon/xoff on they next release of at commands.
....

Regards
Luis

User avatar
pratik
Posts: 291
Joined: Wed Jun 29, 2016 7:17 pm
Location: India
Contact:

Re: Any advice for Serial Port Handshake?

Postby pratik » Mon Feb 06, 2017 11:12 am

Hi!

I totally understand your situation. Interfacing ESP8266 running AT commands is tough when you cannot spare over 512 bytes buffer for the responses. You may write a circular buffer if all your critical stuff is going to be short.

However, you can enable flow control by using AT command:
AT+UART_CUR=<baudrate>, <databits>, <stopbits>, <parity>, <flow control>

I think it is possible to add AT commands that send things slower and with software flow control. But do not wait on this to happen officially as hardware flow control is much more convenient and standard. We may not include software flow control in the official release.
You may however do it by adding custom AT commands using nonOS SDK. The AT command source you viewed is too old and discontinued!. Please do not use that for AT commands, you can add custom commands in any SDK such as the latest nonOS SDK 2.0.0.

But simplest solution: Use hardware flow control, use a module such as the ESP-12E. Costs same as an ESP-01, but has all pins extended for use.
Regards,
Pratik Panda
Website: http://www.PratikPanda.com

Custom firmware, Knowledge base and freelancing (ESP8266/ESP32):
http://www.iot-bits.com

Who is online

Users browsing this forum: No registered users and 1 guest