Hardware Buffer Size change at Adruino Mega2560

Hallo,

I would like to use a ESP8266 WIFI Modul with the WeeESP8266 Wifi Libery and my Arduino Mega 2560 and it does not work... I think, that the Hardware Buffer Size is to small and I can't find how I can set is to a minimul of 256.

I hope everyone can help me with my problem...

Best greetings,

Steven

I would be surprised if it is necessary to increase the HardwareSerial input buffer (assuming that is what you mean.

Post your code so we can understand your problem.

You may find some useful ideas in serial input basics.

...R

I only read that the wifi modul need more then 64...

Here is my code:

#include "ESP8266.h"
ESP8266 wifi(Serial1);

#define SSID        "HomeNet"
#define PASSWORD    "HomeNetWlan"


void setup(void)
{
    Serial.begin(9600);
    Serial.print("setup begin\r\n");

    Serial.print("FW Version: ");
    Serial.println(wifi.getVersion().c_str());
    
    
    if (wifi.setOprToStation()) {
        Serial.print("to station ok\r\n");
    } else {
        Serial.print("to station err\r\n");
    }

    if (wifi.joinAP(SSID, PASSWORD)) {
        Serial.print("Join AP success\r\n");
        Serial.print("IP: ");       
        Serial.println(wifi.getLocalIP().c_str());
    } else {
        Serial.print("Join AP failure\r\n");
    }
    
    Serial.print("setup end\r\n");
}

void loop(void)
{
}

stefanmahr:
I only read that the wifi modul need more then 64...

Can you post a link to the source document?

I'm not familiar with the ESP8266 library. Where does that come from? Does it have any example code?

...R

It is also possible to use it with AT Commands, but then the code would be really really long... so I would like to use this libery.

Here is the link with all informations about it:

This is what they say about the buffer size:

The size of data from ESP8266 is too big for arduino sometimes, so the library can't receive the whole buffer because the size of the hardware serial buffer which is defined in HardwareSerial.h is too small.

It would be a long job to sudy the code in that library - but I suspect it is poorly written.

The Github page tells you how to change the HardwareSerial library to increase the buffer size. However you should know that the same size is used for the output buffer so, between them they will be tying up 512 bytes of precious RAM.

If you change the code in the library copy of HardwareSerial it will apply to all of your Arduino projects. If you make a copy of the library under anothe name I'm not sure how you would include it because HardwareSerial is included automatically.

...R