Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Serial data delay

by cavac (Parson)
on Oct 23, 2018 at 10:24 UTC ( [id://1224543]=note: print w/replies, xml ) Need Help??


in reply to Serial data delay

I don't think you are dealing with a Perl issue here, not directly. But just in case, add this at the start of your script to make your life easier and help us get to the root of the problem:

use strict; use warnings; use diagnostics;

You are running this on a Raspberry Pi, right? In my experience, this hardware had a lot of "unexpected features", like messing up SPI timing when a new ethernet packet arrives.

In your case, you seem to transfer more than 16 bytes at one time, but i rather suspect the serial hardware has a 16 byte limited buffer, and that is most likely where your timing gets messed up and you drop some bytes. This happens when the system is busy with other stuff (like dealing with ethernet or other interrupts) and can't get to working on the serial buffer in time.

You have quite a few alternatives here. You could use another hardware or try one of those serial-to-ethernet boxes. You could also try a different Serial-to-USB adapter.

perl -e 'use MIME::Base64; print decode_base64("4pmsIE5ldmVyIGdvbm5hIGdpdmUgeW91IHVwCiAgTmV2ZXIgZ29ubmEgbGV0IHlvdSBkb3duLi4uIOKZqwo=");'

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1224543]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2024-03-28 20:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found