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.
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
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.