Forcing a clean uninterrupted baud when receiving data via serial port

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












I made a project with a micro-controller that allows me to send data to the PC where the low nibbles of data always follow the same sequence. For example, My data is sent like this:



x0 x1 x2 x3 x4 ..... xE xF



where x is any hex value from 0 to F.



At the beginning the transmission is fine but when I send data from the PC to the micro-controller and then have it return data, it always wants to skip the exact same byte position. For example, Instead of...



x0 x1 x2 x3 x4......


I get:



x0 x2 x3 x4.....


I double checked my code and its efficient, so it can't be code especially if the exact same function to produce the data to the PC is exactly the same everytime and that function formats the data so the lower nibble is the sequence number and it waits for the transmission to complete.



This makes me think there are some unix settings I need to apply.



I looked at setserial and stty but I'm wondering what settings are actually the best. I don't mind if my computer literally locks all other processes up while the serial tests run.



I was thinking of adjusting closing_wait and close_delay options in setserial and maybe enabling low_latency as well as using the nice and ionice commands on the app (aka od) to watch the I/O. But then again, could the app I'm using is bad? This is the command I used to read data...



od -t x1 -w16 -v /dev/ttyS0


So what unix tools would help the most that would allow me to get ALL of the data without losing any character from the serial port? The data rate set for both devices is 57600bps, and I'm using a one meter serial port cable.







share|improve this question




















  • Does it happen at a lower baud? Also can you rig a serial line between two microcontrollers, or two linux systems, and then see if the problem appears in those other cases or not?
    – thrig
    Oct 28 '17 at 12:45










  • Today, I ran the same tests again, this time without first launching any additional programs in X and the data passed through better this time. It must be my computer was being slow even though it responds fast.
    – Mike
    Oct 28 '17 at 21:54














up vote
0
down vote

favorite












I made a project with a micro-controller that allows me to send data to the PC where the low nibbles of data always follow the same sequence. For example, My data is sent like this:



x0 x1 x2 x3 x4 ..... xE xF



where x is any hex value from 0 to F.



At the beginning the transmission is fine but when I send data from the PC to the micro-controller and then have it return data, it always wants to skip the exact same byte position. For example, Instead of...



x0 x1 x2 x3 x4......


I get:



x0 x2 x3 x4.....


I double checked my code and its efficient, so it can't be code especially if the exact same function to produce the data to the PC is exactly the same everytime and that function formats the data so the lower nibble is the sequence number and it waits for the transmission to complete.



This makes me think there are some unix settings I need to apply.



I looked at setserial and stty but I'm wondering what settings are actually the best. I don't mind if my computer literally locks all other processes up while the serial tests run.



I was thinking of adjusting closing_wait and close_delay options in setserial and maybe enabling low_latency as well as using the nice and ionice commands on the app (aka od) to watch the I/O. But then again, could the app I'm using is bad? This is the command I used to read data...



od -t x1 -w16 -v /dev/ttyS0


So what unix tools would help the most that would allow me to get ALL of the data without losing any character from the serial port? The data rate set for both devices is 57600bps, and I'm using a one meter serial port cable.







share|improve this question




















  • Does it happen at a lower baud? Also can you rig a serial line between two microcontrollers, or two linux systems, and then see if the problem appears in those other cases or not?
    – thrig
    Oct 28 '17 at 12:45










  • Today, I ran the same tests again, this time without first launching any additional programs in X and the data passed through better this time. It must be my computer was being slow even though it responds fast.
    – Mike
    Oct 28 '17 at 21:54












up vote
0
down vote

favorite









up vote
0
down vote

favorite











I made a project with a micro-controller that allows me to send data to the PC where the low nibbles of data always follow the same sequence. For example, My data is sent like this:



x0 x1 x2 x3 x4 ..... xE xF



where x is any hex value from 0 to F.



At the beginning the transmission is fine but when I send data from the PC to the micro-controller and then have it return data, it always wants to skip the exact same byte position. For example, Instead of...



x0 x1 x2 x3 x4......


I get:



x0 x2 x3 x4.....


I double checked my code and its efficient, so it can't be code especially if the exact same function to produce the data to the PC is exactly the same everytime and that function formats the data so the lower nibble is the sequence number and it waits for the transmission to complete.



This makes me think there are some unix settings I need to apply.



I looked at setserial and stty but I'm wondering what settings are actually the best. I don't mind if my computer literally locks all other processes up while the serial tests run.



I was thinking of adjusting closing_wait and close_delay options in setserial and maybe enabling low_latency as well as using the nice and ionice commands on the app (aka od) to watch the I/O. But then again, could the app I'm using is bad? This is the command I used to read data...



od -t x1 -w16 -v /dev/ttyS0


So what unix tools would help the most that would allow me to get ALL of the data without losing any character from the serial port? The data rate set for both devices is 57600bps, and I'm using a one meter serial port cable.







share|improve this question












I made a project with a micro-controller that allows me to send data to the PC where the low nibbles of data always follow the same sequence. For example, My data is sent like this:



x0 x1 x2 x3 x4 ..... xE xF



where x is any hex value from 0 to F.



At the beginning the transmission is fine but when I send data from the PC to the micro-controller and then have it return data, it always wants to skip the exact same byte position. For example, Instead of...



x0 x1 x2 x3 x4......


I get:



x0 x2 x3 x4.....


I double checked my code and its efficient, so it can't be code especially if the exact same function to produce the data to the PC is exactly the same everytime and that function formats the data so the lower nibble is the sequence number and it waits for the transmission to complete.



This makes me think there are some unix settings I need to apply.



I looked at setserial and stty but I'm wondering what settings are actually the best. I don't mind if my computer literally locks all other processes up while the serial tests run.



I was thinking of adjusting closing_wait and close_delay options in setserial and maybe enabling low_latency as well as using the nice and ionice commands on the app (aka od) to watch the I/O. But then again, could the app I'm using is bad? This is the command I used to read data...



od -t x1 -w16 -v /dev/ttyS0


So what unix tools would help the most that would allow me to get ALL of the data without losing any character from the serial port? The data rate set for both devices is 57600bps, and I'm using a one meter serial port cable.









share|improve this question











share|improve this question




share|improve this question










asked Oct 28 '17 at 3:07









Mike

1213




1213











  • Does it happen at a lower baud? Also can you rig a serial line between two microcontrollers, or two linux systems, and then see if the problem appears in those other cases or not?
    – thrig
    Oct 28 '17 at 12:45










  • Today, I ran the same tests again, this time without first launching any additional programs in X and the data passed through better this time. It must be my computer was being slow even though it responds fast.
    – Mike
    Oct 28 '17 at 21:54
















  • Does it happen at a lower baud? Also can you rig a serial line between two microcontrollers, or two linux systems, and then see if the problem appears in those other cases or not?
    – thrig
    Oct 28 '17 at 12:45










  • Today, I ran the same tests again, this time without first launching any additional programs in X and the data passed through better this time. It must be my computer was being slow even though it responds fast.
    – Mike
    Oct 28 '17 at 21:54















Does it happen at a lower baud? Also can you rig a serial line between two microcontrollers, or two linux systems, and then see if the problem appears in those other cases or not?
– thrig
Oct 28 '17 at 12:45




Does it happen at a lower baud? Also can you rig a serial line between two microcontrollers, or two linux systems, and then see if the problem appears in those other cases or not?
– thrig
Oct 28 '17 at 12:45












Today, I ran the same tests again, this time without first launching any additional programs in X and the data passed through better this time. It must be my computer was being slow even though it responds fast.
– Mike
Oct 28 '17 at 21:54




Today, I ran the same tests again, this time without first launching any additional programs in X and the data passed through better this time. It must be my computer was being slow even though it responds fast.
– Mike
Oct 28 '17 at 21:54















active

oldest

votes











Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f400999%2fforcing-a-clean-uninterrupted-baud-when-receiving-data-via-serial-port%23new-answer', 'question_page');

);

Post as a guest



































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f400999%2fforcing-a-clean-uninterrupted-baud-when-receiving-data-via-serial-port%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

How to check contact read email or not when send email to Individual?

Bahrain

Postfix configuration issue with fips on centos 7; mailgun relay