02-19-2020 01:23 PM
You can use software flow control (XON/XOFF if I remember right) but both devices must support it, and it's not a super commonly used format.
It seems like your buffer is filling up too quickly, so you should try giving it a larger buffer. I routinely do very long serial reads at 921600 baud with no issues. Use the function Instrument I/O -> Serial -> VISA Set I/O Buffer Size. The default buffer size is 4096 bytes; set it to 10x or 100x that and you should be fine.
For some math, a 921600 baud signal transmits 92,160 bytes per second (8 data bits + 1 start bit + 1 stop bit) so you are currently filling your buffer in 4096/92160 = ~44 milliseconds. If you don't get your read done in 44 ms, the buffer will overflow. Setting your buffer size to 40,000 will give you nearly a half second to get the data out of the buffer, which should fix your problem and you can read at full speeds.
Also, I'd try to not use Bytes At Port- just do a Read of a given size, and it'll wait there until it can either read that many bytes or it'll time out. That way you can get rid of the 2 second delay.
02-19-2020 01:31 PM
If you have control over the software running on the other device, then you can do whatever you want.
You a command structure that tells it to send more data.
1. Receiver, send me data.
2. Sender, send X bytes (where X is smaller than the serial buffer on the receiver". Ideally, preface with the data with 2 bytes telling how many more bytes follow.
3. Receiver, read 2 bytes, convert that to a U16 number. Read that many bytes.
4. Once read go back to step 1.
If Sender sends a message such as 00 00 telling there are 0 bytes left to read, then the receiver knows to stop requesting data.
A serial port is going to feel ridiculously slow if you are talking about data files of 758,683 bytes. What is your baud rate?
Can you do this over ethernet? Look at the TCP/IP server/client examples in LabVIEW to show you the concepts that could be applied to a serial port communication process.
Can you talk to the person who wrote the firmware on the micro-controller? They should be ones who had thought of how to send these large files and tell you how they intended them to be sent. If they don't understand how to do it, then they shouldn't be the ones to have programmed the micro-controller.
02-19-2020 01:35 PM
Thank you 🙂
02-19-2020 01:36 PM
Great, Thanks 🙂
02-19-2020 01:58 PM
@RavensFan wrote:
A serial port is going to feel ridiculously slow if you are talking about data files of 758,683 bytes. What is your baud rate?
Because I am bored at the moment, I did the math. With a baud rate of 115200 bits/second, it will roughly come out to 66 seconds. This is just raw sending of the file data, not including any overhead like size bytes, responses, etc.
02-19-2020 02:18 PM
@crossrulz wrote:
@RavensFan wrote:
A serial port is going to feel ridiculously slow if you are talking about data files of 758,683 bytes. What is your baud rate?
Because I am bored at the moment, I did the math. With a baud rate of 115200 bits/second, it will roughly come out to 66 seconds. This is just raw sending of the file data, not including any overhead like size bytes, responses, etc.
A common value for the low end is 9600 baud, so it is going to be about 800 seconds. Well over 10 minutes.
Unless the process is less than 10 seconds, I'd recommend working in some visual feedback where the receiver can update a progress bar after every receptions showing how many bytes received vs. the total file size. The sender may have to send the total file size back in a reponse in the very first message.
02-19-2020 03:04 PM
The picture posted by the OP shows he's using a data rate of 921600 baud, so around 8 seconds to get all of the data. Not lightning fast but not terribly slow either.
02-19-2020 03:59 PM
You're right. That picture was so tiny, I didn't even see that.
Actually, I'd say 921,600 is actually lightning fast for serial communications. At least for RS-232 or RS-485. It is nearly 1 megabit per second.
02-19-2020 04:02 PM
Yeah I wish this was better, but to get full resolution pictures or even snippets to work, you have to right click then "View image" then edit the URL to remove "/image-size/medium?v=[stuff]". Basically, remove "image-size" to the end of the URL, and you can see it full size.
Hopefully this link works:
/t5/image/serverpage/image-id/262570iA04CB11E994C4508/
02-19-2020 04:45 PM
@BertMcMahan wrote:
Yeah I wish this was better, but to get full resolution pictures or even snippets to work, you have to right click then "View image" then edit the URL to remove "/image-size/medium?v=[stuff]". Basically, remove "image-size" to the end of the URL, and you can see it full size.
Hopefully this link works:
/t5/image/serverpage/image-id/262570iA04CB11E994C4508/
My browser has the option for "full screen". I have a standard 1080p monitor and it hasn't failed to display a full-sized picture (yet).