Skip to content
This repository has been archived by the owner on Jul 21, 2021. It is now read-only.

Arduino Serial Monitor hangs after 384 characters #464

Open
technoblogy opened this issue Mar 19, 2019 · 10 comments
Open

Arduino Serial Monitor hangs after 384 characters #464

technoblogy opened this issue Mar 19, 2019 · 10 comments
Assignees

Comments

@technoblogy
Copy link

I'm developing an application with the MXChip IoT DevKit using the Arduino IDE to interface with the board via the Serial Monitor.

However, after transferring 384 characters the Serial Monitor hangs up, and appears to crash the Arduino IDE, requiring a restart.

It can be demonstrated using the following program:

void setup() {
  Serial.begin(9600);
}

void loop (void) {
  if (Serial.available() > 0) Serial.print((char)Serial.read());
}

If you upload this program, then copy a block of text of more than 384 characters and paste it into the Serial Monitor input field, and press return, only the first 384 characters are displayed and the Serial Monitor hangs up, preventing any further input.

I'm using the Arduino IDE 1.8.7 on a MacBook Pro with High Sierra.

PS I'm not sure if this is the right place to report this issue, but I can't find an specifically Arduino-related forum.

@dooriya dooriya self-assigned this Mar 20, 2019
@dooriya
Copy link
Member

dooriya commented Mar 20, 2019

It works well in Windows with your sample code
serial-port-win
, will try to repro in macOS.

@dooriya dooriya added the P2 label Mar 20, 2019
@technoblogy
Copy link
Author

technoblogy commented Mar 20, 2019 via email

@dooriya
Copy link
Member

dooriya commented Mar 22, 2019

The root cause is that the underlying serial port software (screen) we depends on in macOS has limited read buffer. So if you want to read a long string from serial port, you need to split it into chunks.

@technoblogy
Copy link
Author

Thank you for your reply. This is a bit of a showstopper for my application: I want to port my Lisp interpreter, uLisp, to the AZ3166. You interface to the Lisp REPL using the Arduino Serial Monitor:

http://www.ulisp.com/show?19XT

On other Arduino platforms this works fine; you can paste in Lisp programs and execute them. However, on the AZ3166 as soon as you try to paste in any significant program the Arduino IDE crashes or hangs up.

Why is this not a problem on other Arduino platforms?

Can I rewrite the serial interface to remove the restriction?

Any other suggestions? Thanks,David

@technoblogy
Copy link
Author

Any more suggestions about this issue?

@github-actions
Copy link

This issue has no recent activities, please take a look and provide updates for it.

@technoblogy
Copy link
Author

Is there any progress on this?

As I said in a previous post, this isn't a problem with most other platforms supported by the Arduino IDE (for example, ATSAMD21, ATSAMD51, ESP32, nRF52840). My test program works fine on those.

It therefore must be possible to implement Serial in a way that doesn't impose a 384-character limit. Is there some way I can contribute to fixing this?

@technoblogy
Copy link
Author

@dooriya any progress on this?

I tried increasing the buffer size by editing the line in BufferedSerial.h from:

BufferedSerial(PinName tx, PinName rx, uint32_t buf_size = 128, uint32_t tx_multiple = 4, const char* name=NULL, int sample_rate = 115200);

to:

BufferedSerial(PinName tx, PinName rx, uint32_t buf_size = 1024, uint32_t tx_multiple = 4, const char* name=NULL, int sample_rate = 115200);

but it didn't seem to help. Any other suggestions?

@hellyzh
Copy link

hellyzh commented May 15, 2020

Normally the input will be shorter than 384 characters. You may need to split long string to chunks and limit each input to 384 characters as a work-around.

@technoblogy
Copy link
Author

technoblogy commented May 15, 2020

Thank you for the reply.

My input is not normally shorter than 384 characters, as I'm uploading Lisp programs, and I can't easily break them into chunks. One program may be more than 384 characters. So this essentially makes the MXChip IoT DevKit unusable for my application.

As I mentioned in an earlier message this isn't a problem with most other platforms supported by the Arduino IDE (for example, ATSAMD21, ATSAMD51, ESP32, nRF52840).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants