Pages: 1 [2]   Go Down
Author Topic: Serial Library requiring a lot of memory?  (Read 1072 times)
0 Members and 1 Guest are viewing this topic.
Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17259
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
and the USB connection as well gets allocated a serial port and pulls in more resources from the USB libraries).

On a mega board? I could see USB stuff possibly required for a Leonardo type board but why would a bog standard Uno or Mega board require anything to do with USB in a sketch compilation?

Lefty
Logged

Global Moderator
Dallas
Online Online
Shannon Member
*****
Karma: 197
Posts: 12742
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
This project is for an home automation system I am working on.

In that case, you should be considering RS-422, RS-485, Ethernet, CANBUS, LINBUS, etcetera instead of TTL-serial.
Logged

Offline Offline
Sr. Member
****
Karma: 9
Posts: 254
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
and the USB connection as well gets allocated a serial port and pulls in more resources from the USB libraries).

On a mega board? I could see USB stuff possibly required for a Leonardo type board but why would a bog standard Uno or Mega board require anything to do with USB in a sketch compilation?

Lefty

Yes sorry, my mistake, there's only 512 bytes allocated to buffers, still it makes up the majority of the RAM that is allocated by the serial library.
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

If you want, you can edit HardwareSerial.cpp and HardwareSerial.h and either change the buffer size (very easy), or turn off some of the serial ports (a bit harder but still relatively easy).

Quite right. Those calculations show where the memory is going. You can just "comment out" the declarations for Serial1, Serial2, Serial3 to save the memory their buffers use.

It's a pity the Serial library doesn't do a "new" to allocate the memory (eg. in Serial.begin) but that's life.
Logged

Pages: 1 [2]   Go Up
Jump to: