Skip to content
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

Support for Larger Baud Rates? #5

Open
justiceamoh opened this issue Apr 14, 2022 · 12 comments
Open

Support for Larger Baud Rates? #5

justiceamoh opened this issue Apr 14, 2022 · 12 comments
Labels
enhancement New feature or request

Comments

@justiceamoh
Copy link

Incredible work with this Serial Plotter tool. I was keeping Arduino just for it's serial plotter function but yours is much better and completely replaces that.

Is it possible to support higher baud rates like 460800, 921600, etc. ? A number of recent arduino compatible boards like Sparkfun's Artemis have USB-serial chips that can tolerate much higher baudrates. I tried adding more baud rates in the header file:

std::vector<int> baud_rates = {110,
300,
600,
1200,
2400,
4800,
9600,
14400,
19200,
38400,
56000,
57600,
115200,
128000,
256000};

But that didn't seem to work. Any suggestions?

@nathandunk
Copy link
Owner

nathandunk commented Jul 12, 2022

Hi @justiceamoh. Glad you like the tool! Unfortunately, it seems like I didn't get a notification for this thread.

The baud rates are limited by the windows serial communication interface here, which only supports up to 256000. I haven't done any investigation to whether or not it could go higher with another resource, but it would probably be a large effort to change that at this point if it had to go to a different system.

@justiceamoh
Copy link
Author

Thanks for getting back @nathandunk.

Ah makes sense that windows was the limit. I'm using macOS and the serial drivers there allow for higher baud rates. I agree it won't be trivial to transition to another serial driver. I appreciate your consideration though. Thanks!

@maleiter
Copy link

maleiter commented Aug 7, 2022

I tried adding more baud rates in the header file:

std::vector<int> baud_rates = {110,
300,
600,
1200,
2400,
4800,
9600,
14400,
19200,
38400,
56000,
57600,
115200,
128000,
256000};

But that didn't seem to work. Any suggestions?

@justiceamoh You have to edit rs232.cpp of mahi-com as well. The function RS232_OpenComport has a switch-case statement, where you have to add the new baud rate.

This way, I can add support for up to 3Mbaud (tested on Windows).

@nathandunk
Copy link
Owner

@maleiter, thanks for the suggestion. If I were to add it to the main branch, do you have thoughts on whether it should have a new set of default baud rates? Or add a way to input your own baud rate? I would love to add the functionality without giving an overwhelming amount of options for a typical user.

@nathandunk nathandunk reopened this Aug 16, 2022
@maleiter
Copy link

@nathandunk I'd suggest, that you keep the current set of default baud rates, but add the possibility to enter a custom baud rate.
But this requires some changes in mahi-com. See maleiter/mahi-com@6eebbf0 (implemented for Windows only)

@nathandunk nathandunk added the enhancement New feature or request label Dec 7, 2022
@nathandunk
Copy link
Owner

nathandunk commented Dec 7, 2022

So I have this implemented in Windows (attached), but apparently custom baud rates in linux is a mess... I would like to implement it in both before I add it to a release though. For now, this could be usable.
BetterSerialPlotter-Windows-Custom-Baud.zip

@ctadlock
Copy link

ctadlock commented Dec 22, 2022

FYI, for Teensy 4 the USB serial runs at the full 480 Mbit regardless of the baud setting. The app cant handle this and only draws the chart at the very end. Im assuming that is because some data buffer is full. If I add a 1 or 2 ms delay on each loop the app handles it better, which in effect is slowing the data rate. Also the app regularly silently crashes which is annoying.

https://www.pjrc.com/teensy/td_serial.html

image

@nathandunk
Copy link
Owner

@ctadlock, can you clarify what platform you are testing on and what release version you are using? I think this could likely be a problem with how I handled the data buffer which was just set to a number of data points, rather than scaling it by the data rate. So when the data rate is higher, it is still limited to that buffer size.

Can you zoom in the x-axis by scrolling and confirm whether or not the data looks correct based on your data rate, and there is just a small section of it at a time, or whether the data is just misrepresented entirely, which could be a different problem?

@timoxd7
Copy link

timoxd7 commented Jan 14, 2023

@nathandunk i have the same problem. I took the current master branch and added a Baurate for me (921600) in the SerialManager.hpp only. Works fine so far, but i have the same problem as @ctadlock. For me, the x-axis has is only half filled but the values seem correct. On pause, i can double click and it fits perfectly in the whole x-length. Also, after doing this once, on resume it also fits like it should, removing the problem at all, also for newly added plots.

I use Windows, compiled with VS 2022 and use an ESP32.

@nathandunk
Copy link
Owner

Hi @timoxd7, rather than adding your own baudrate in source, can you see if using the custom baudrate test exe in the comment I made above also works with setting that baud rate? I don't have a Teensy, but I tested with an Arduino with the same baudrate and was able to get it to work. I will address the buffer size in your other post!

@arbitur
Copy link

arbitur commented Jan 15, 2023

Hi @justiceamoh. Glad you like the tool! Unfortunately, it seems like I didn't get a notification for this thread.

The baud rates are limited by the windows serial communication interface here, which only supports up to 256000. I haven't done any investigation to whether or not it could go higher with another resource, but it would probably be a large effort to change that at this point if it had to go to a different system.

The library states:

The baud rate at which the communications device operates. This member can be an actual baud rate value, or one of the following indexes.

I dont see the docs say you cannot use a baud above 256000.

@timoxd7
Copy link

timoxd7 commented Jan 16, 2023

@nathandunk Works fine, same result as my compiled version before. I attached the picture below.
Seems like about half of the graph is cut away. I don't know what i did, but once i was able to see the whole graph with the version i compiled, after pausing and moving the graph a bit around. But now i was not able to do this anymore and i don't know a way to redo this.

grafik

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants