Is there difference of Softserial between MEGA and Mini?

HI~
I am doing simple communication project with Lora module.
but i had a problem about disappear string message.
The problem is like below

v. first of all, i transmit data with String
v. pars of the code is as follows :

String start_d(int addr, int num, int sensor, int start) {
// addr : 0x00 ~ 0xff
// rx addr : 1004
String AT ="AT+SEND=1004";
int stx = 0x02;
int d_len =0;
String data_p = (String)stx + ":" + (String)addr + ":" + (String)num + ":" +(String)sensor + ":" + (String)start;
d_len = data_p.length();
// delay(300);
String msg = AT + "," + (String)d_len + "," + data_p + "\r"; 
return msg;
}
​
void setup() { 
          ....
if(addr_i == ADDR) {
  start_msg = start_d(ADDR, num, 0x00, START);
  // delay(300);
  //RYLR896Serial.println(start_msg);
  //delay(300);
  start_msg= start_d(ADDR, num, 0x00, START);
  DebugSerial.print("msg : ");
  DebugSerial.println(start_msg);
         ....
}

v. Problem is that DebugSerial is disappear in my Mini board like this : 'msg : '

v. But working well DebugSerial in Mega board. : 'msg : AT+SEND=1004,~~'

Is it due to the difference about spec? between Mega and Mini?
How do send string data in Mini like the code above?

The Arduino Mini with a ATmega168 or a ATmega328 ?
It might not have enough sram for the sketch.

Hi~
My mini board use a ATmega328.

Is there any relationship between sram and serial communication?

Please post complete code or a representative example that exhibits the behaviour. Use of String (capital S) can result in unexpected behaviour due to memory leaks. As the Mega has more memory, it might not exhibit the problem or at a later stage.

Why use Software serial on a Mega with 3 extra hardware serial ports?

groundFungus:
Why use Software serial on a Mega with 3 extra hardware serial ports?

I think op wants to use the mini and just tested with the Mega.

Oh sorry, DebugSerial use a serial2 in Mega. This is to performance test between mini and mega serial. Because i want use a mini board.
And full code repeats like code above

tarzanbs:
And full code repeats like code above

That does not mean anything. Without seeing what you exactly do, I think nobody can help.

Code is repeated to transmit string data like start_d and packet_d, done_d. But debugserial message disapear in start_d, packet_d, done_d in case of mini board.

Someone more familiar with the String class will need to clarify this, but is it even possible to return a local String variable from a function? I know if it were a local char array it would go out of scope when the function exited.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.