-
-
Notifications
You must be signed in to change notification settings - Fork 19.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove MarlinSerial #2945
Remove MarlinSerial #2945
Conversation
This is more a HowTo than a must be done. @Wackerbarth askend for it. |
"@Wackerbarth askend for it." -- @AnHardt -- Please reword this. As written, I don't understand what you mean. |
Maybe i misinterpreted #2839 (comment) |
Specifically :
|
@AnHardt -- I don't think that your "solution" addresses my concern. The difficulty is that the stepper ISR runs far too long when in the mode that performs very rapid movements by performing multiple steps in response to a single timer interrupt. To accomplish this, the ISR must test to see if there is a character available in the UART and, if there is, transfer it to the received character queue. The code to perform that test is not compatible with the Arduino hardware serial code from the IDE 1.5 era. There have been some subsequent changes to that Arduino code which may make it possible to rewrite the process to use the current Arduino core. However, I haven't had the opportunity to dig into it sufficiently to see if we can do so with both the MEGA2560 and the AT90USB1286 cores. (PS: I also note that the displayed patch includes a number of changes that appear to be related to a different issue) |
Replace it by original Arduino HardwareSerial The maximum working BAUDRATE is 115200 then. 250000 skips incoming chars occasionally. The stepper interrupt takes to long and the 'hack' is removed, because the Arduino HardwareSerial does not have the needed function. To set the SERIAL_RX_BUFFER_SIZE and SERIAL_TX_BUFFER_SIZE you need a platform.local.txt or a similar system to set compiler options. ``` compiler.c.extra_flags='-D SERIAL_RX_BUFFER_SIZE=128 -D SERIAL_TX_BUFFER_SIZE=32' compiler.cpp.extra_flags='-D SERIAL_RX_BUFFER_SIZE=128 -D SERIAL_TX_BUFFER_SIZE=32' ``` Placing the defines 'inside' the sketch does not work because of Marlin.ino.cpp includes the HardwareSerial. An alternative would be to change all possibly involved HardwareSerial.h files - what's not what we want. Compiled with the cinfig. in the main-directory. MarlinSerial (before): Der Sketch verwendet 50.270 Bytes (19%) des Programmspeicherplatzes. Das Maximum sind 253.952 Bytes. Globale Variablen verwenden 2.846 Bytes (34%) des dynamischen Speichers, 5.346 Bytes für lokale Variablen verbleiben. Das Maximum sind 8.192 Bytes. HardwareSerial (after): Der Sketch verwendet 51.794 Bytes (20%) des Programmspeicherplatzes. Das Maximum sind 253.952 Bytes. Globale Variablen verwenden 2.968 Bytes (36%) des dynamischen Speichers, 5.224 Bytes für lokale Variablen verbleiben. Das Maximum sind 8.192 Bytes. This change uses 1524byte Progmem and 122byte RAM more than the version with MarlinSerial. Tested with unmodified ARDUINO 1.6.7 core files. In older versions the definition of the buffers may not work. (needs arduino/Arduino@d259512) Tested only with Arduino Mega 2560. Needs more testing.
45bb160
to
a6d826b
Compare
Is this PR still wanted? It implies that 250K is no longer supported. But documentation like the Marlin page on RepRap wiki list 250K baud as the standard speed. Should we just update documentation and switch to 115K everywhere? I am happy to merge this if MarlinSerial is not needed. Is it already removed from MarlinDev? |
Thanks for asking. I don't think so. |
Replace it by original Arduino HardwareSerial
The maximum working BAUDRATE is 115200 then. 250000 skips incoming chars occasionally. The stepper interrupt takes too long and the 'hack' is removed, because the Arduino HardwareSerial does not have the needed function.
To set the SERIAL_RX_BUFFER_SIZE and SERIAL_TX_BUFFER_SIZE you need a platform.local.txt or a similar system to set compiler options.
Placing the defines 'inside' the sketch does not work because of Marlin.ino.cpp includes the HardwareSerial. An alternative would be to change all possibly involved HardwareSerial.h files - what's not what we want.
Compiled with the config. in the main-directory.
MarlinSerial (before):
Der Sketch verwendet 50.270 Bytes (19%) des Programmspeicherplatzes. Das Maximum sind 253.952 Bytes.
Globale Variablen verwenden 2.846 Bytes (34%) des dynamischen Speichers, 5.346 Bytes für lokale Variablen verbleiben. Das Maximum sind 8.192 Bytes.
HardwareSerial (after):
Der Sketch verwendet 51.794 Bytes (20%) des Programmspeicherplatzes. Das Maximum sind 253.952 Bytes.
Globale Variablen verwenden 2.968 Bytes (36%) des dynamischen Speichers, 5.224 Bytes für lokale Variablen verbleiben. Das Maximum sind 8.192 Bytes.
This change uses 1524byte Progmem and 122byte RAM more than the version with MarlinSerial.
Tested with unmodified ARDUINO 1.6.7 core files. In older versions the definition of the buffers may not work. (needs arduino/Arduino@d259512)
Tested only with Arduino Mega 2560.
Needs more testing.