-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Added TX Interrupt/DMA based serial writing #2840
Conversation
Well done, thanks! I got the BTT TFT35V3.0.1(GD32F207 @ 120MHz), it's about 35% faster than the BTT TFTV3.0 (STM32F207 @ 120MHz). |
I noticed that you already started to deal with the priorities in loopProcess and it's friends. I think that a lot of tasks in
Usually front ends are given a constant guaranteed amount of attention by guaranteeing a number of updates per second. |
Some features are split in a back end task and front end task. I agree with you to provide different priorities to some back end task. Currently I would avoid to make (rework) too much other things. I would simply integrate the improvements on buzzer. |
I would recommend to make the changes of this PR as narrow as possible to reduce the risks. Possibly the writing mode should be user configurable so there is no risk of running into issues because there is a safe fallback. This would impact FW size a bit. I believe the smallest available flash size is 224KB, currently we are around 193KB, so we have some headroom for a useful feature like this. Did you try the buzzer implementation? If so, don't forget to disable loopBuzzer in loopFrontEnd. My ESP3D 2.1.x is a bit modified (for the M43 response and general faster response times):
|
Do you mean to make it configurable at runtime (configured in
Not yet tried your buzzer implementation. I would possibly provide it in the PR related to other improvements.
My ESP3D is now perfectly working. It is able to receive the entire M43 output (more than 14K) with no lost at all. This night I will make some testing reducing the RX cache size to 2048 instead of 4096. |
Agree, that not very efficient, but it's a safe way to get started. And don't forget, it's only 1 check per message, not much overhead.
Please let me do it... This could be my first PR... our friend made a competing PR already based on my code, he's just a troll.
My ESP3D is now perfectly working. It is able to receive the entire M43 output (more than 14K) with no lost at all. This night I will make some testing reducing the RX cache size to 2048 instead of 4096. Great, that's good to see. Working on ESP3D integration could be something nice to work on in the future. I get the time from the ESP3D, and give a estimated ETA when you start a print. And of course TFT 921600 baud support would be nice to have. |
sure
Yes, I will probably add also the support to 921600 baud (in the past I also asked the author of ESP3D to provide 1000000 baud) |
I believe this is the same as:
But in Serial_NewDataAvailable there is no data copy, and in Serial_Get the data copy is done in 8-bit cycles. In general I found that using and passing 32-bit variables is faster, that is probably because in the background 32-bit variables are always used, and
|
I tested also under stress and it works
No, but it is a function related to Serial.c/h as Serial_GetWritingIndexRX so I preferred to move in Serial.h.
It doesn't work. I causes an infinite loop (rIndex is never updated)
yes cut&paste of comment. I will change it
I made some testing using 32bit in functions but there is no difference.
Yes it is better. I will change it |
All clear, one more thing... The new baudrates do not seem to be in |
yes, right thanks. updated also Configuration.h. Please, don't forget to test GD version |
Sure, I will test GD and F4, both write modes. |
yes thanks. I tested F2 and F1 (both modes). Working fine |
Confirmed: GD32F2 and STM32F4 working fine, both modes tested, well done! |
thanks for the testing. PR ready for merge |
My ESP3D is now perfectly working. It is able to receive the entire M43 output (more than 14K) with no lost at all. This night I will make some testing reducing the RX cache size to 2048 instead of 4096. Great, that's good to see. Working on ESP3D integration could be something nice to work on in the future. I get the time from the ESP3D, and give a estimated ETA when you start a print. And of course TFT 921600 baud support would be nice to have. @rondlh - I remember that MKS offered that feature for both their TFT and LCD so it was possible to to add Wireless Network direct from TFT / LCD, but only worked on their Hardware, cause some of their board offered ESP8266 as an addon for their Board and and also for their TFT |
Amazing improvement! I love things like this. One note, it seems the config file in the "Copy to SD" directory was not updated. Is it supposed to be updated differently? |
@F14V Only BTT can update that folder. In the meanwhile you (everyone) have to compile the fw |
Oh, good to know, sorry if it was stated somewhere and I missed it. Indeed, I had to compile since the automatic build didn't run yet. But it's working great! (didn't see any pauses yet, they were occurring in the past) |
Yes, the automatic build populates that folder (config files, binary files). That task is executed by BTT only |
IMPROVEMENTS:
Attached pictures show a comparison with current implementation. The current implementation struggles to reach and maintain the target TX slots (only 1 pending gcode towards the mainboard instead of the 31 available) having a very low scan rate (number of times the main loopProcess() function is invoked per second) while the proposed implementation maintains the target TX slots (a constant 31 pending gcodes towards the mainboard) with a huge difference on scan rate
By the way, TX cache size is set to 256 bytes for mainboard and supplementary serial ports. It is bigger more than enough to buffer any gcodes (max 100 bytes) or even a long ACK message from M43 output (even 200 bytes) avoiding any need of blocking transmission
serial_port
inconfig.ini
has been extended providing other standard baudrates such as 230400 and 921600 (e.g. supported by ESP3D)NOTES:
Serial.h
. By default, TX DMA mode is configured to be used. Both DMA and Interrupt modes provide similar performanceBUGFIXES:
resolves #2835
fixes #2858
PR STATE: ready for merge
Current solution:
Proposed solution: