Send/receive file through serial using minicom


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Send/receive file through serial using minicom
# 1  
Old 08-12-2014
Send/receive file through serial using minicom

i have connected with my board through serial interface using minicom and i am running a bash script, which should test ethernet (ping test), USB read/write, RS232 ..

I have managed to test ethernet and USB read/write.
I test ethernet with ping.
I test USB read/write, using dd and verifying the checksum with md5.

But i am stuck with testing RS232. Could you provide me ideas as to how i can do that using minicom session. I want to test that the serial interface is working properly.

Thanks,
srik

---------- Post updated at 06:31 AM ---------- Previous update was at 06:29 AM ----------

One idea i have is to send a file using sz to the host and then check for the files authenticity. but then it wasnot possible without human intervention (since i had to press ok after receving the file in minicom using xmodem protocol)
# 2  
Old 08-12-2014
OK, this doesn't directly answer your question, but why ping test any network connection before trying to use it? That's like checking a car for a trailer hitch before taking it to pick up a gallon of milk at 7-11 - it's completely irrelevant to what you're trying to do. Sure, a positive result tells you the car is there, but it doesn't tell you the car works. And a negative result tells you only that there's no trailer hitch - the car could still be there working just fine to boot.

Networks can be and are configured to block explorations such as pings. Hosts can be and are configured to not respond to pings. Networks can also and often are configured to block SSH or FTP sessions, so even if a ping is successful that's not proof an SSH session will connect.

If you're going to use a network-based service, just use the damn thing. A successful ping prior to trying such a service doesn't mean the service works, and a failed ping doesn't mean it won't.
# 3  
Old 08-12-2014
thanks for the reply. I hope i understood your response properly.

I am not going to use any ethernet based service and the ping test is not intended for that purpose. The idea is to put the system under some kind of stress (ping with a number of packets, sending a number of CAN frames, etc.. ) and at the same the hardware is verified.

Do you have any idea about how i can verify the RS232? i am looking at using sz non interactively, eventhough it is mentioned that it could be used non interactively it is not mentioned how to.
# 4  
Old 08-12-2014
Doesn't the fact that you "connect ... through serial" prove the RS232 to be working? Or am I missing something?
# 5  
Old 08-12-2014
yes it does. but i need to load the rs232 interface in some so that the hardware is tested for maximum load
# 6  
Old 08-12-2014
So you're able to feed a raw script into rs232?

Perhaps you could uuencode or base64 a file and make it part of your script in a here-document.

Code:
base64 -d > /tmp/$$ <<"EOF"
YXBwbGljYXRpb24vMWQtaW50ZXJsZWF2ZWQtcGFyaXR5ZmVjCmFwcGxpY2F0aW9uLzNncHAtaW1z
K3htbAphcHBsaWNhdGlvbi9DU1RBZGF0YSt4bWwKYXBwbGljYXRpb24vRURJLUNvbnNlbnQKYXBw
bGljYXRpb24vRURJLVgxMgphcHBsaWNhdGlvbi9FRElGQUNUCmFwcGxpY2F0aW9uL0gyMjQKYXBw
bGljYXRpb24vYWN0aXZlbWVzc2FnZQphcHBsaWNhdGlvbi9hbmRyZXctaW5zZXQJCQkJCQkJCQll
egphcHBsaWNhdGlvbi9hbm5vZGV4CQkJCQkJCQkJCQlhbngKYXBwbGljYXRpb24vYXBwbGVmaWxl
CmFwcGxpY2F0aW9uL2FwcGxpeHdhcmUJCQkJCQkJCQkJYXcKYXBwbGljYXRpb24vYXRvbSt4bWwJ
CQkJCQkJCQkJYXRvbQphcHBsaWNhdGlvbi9hdG9tY2F0K3htbAkJCQkJCQkJCQlhdG9tY2F0CmFw
cGxpY2F0aW9uL2F0b21kZWxldGVkK3htbAphcHBsaWNhdGlvbi9hdG9taWNtYWlsCmFwcGxpY2F0
aW9uL2F0b21zZXJ2K3htbAkJCQkJCQkJCWF0b21zcnYKYXBwbGljYXRpb24vYXRvbXN2Yyt4bWwJ
CQkJCQkJCQkJYXRvbXN2YwphcHBsaWNhdGlvbi9hdXRoLXBvbGljeSt4bWwKYXBwbGljYXRpb24v
EOF

set -- $(md5sum /tmp/$$)
rm -f /tmp/$$

if ! [ "$1" = "0e657476ea6a0024f4adadd1d105b7a4" ]
then
        echo "transfer corrupted"
        exit 1
fi

...except you could make a much bigger chunk. Feed a sufficiently large file into 'base64 < filename', and get the sum with 'md5sum filename'
# 7  
Old 08-12-2014
hi corona, sorry for asking this, but could you explain your code. my scripting skills are limited.
base64 -d > /tmp/$$ <<"EOF" This seems to decode some data and add it to a file and appends and EOF at the end.
1. Which data does it decode and what does $$ mean?
set -- $(md5sum /tmp/$$)
2. what does "set --" do to the checksum calculated?
if ! [ "$1" = "0e..." ]
3. $1 is ? (first argument for?)

With my limited scripting skills it is difficult for me to understand in which step a RS232 transfer is taking place
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

zfs send receive performance issues

I 'm trying to clone a zfs file system pool/u01 to a new file system called newpool/u01 using following commands zfs list zfs snapshot pool/u01@new zfs send pool/u01@new | zfs -F receive newpool/u01 Its a 100G file system snapshot and copied to same server on different pool and... (9 Replies)
Discussion started by: fugitive
9 Replies

2. Shell Programming and Scripting

Send Receive Mails

Hi All, I am writing one script to automate one long process. In this process we need to upload some input files and download some output files. So , I want to automate this upload and download by using mail functionality. I want to trigger this script when I am sending mail to server. I know... (0 Replies)
Discussion started by: NirajThakar
0 Replies

3. Shell Programming and Scripting

How to monitor send/receive bytes

Hello, I need to create a script to monitor sent/received packets for a period of time (the period of time will be a users input) and write the result to some txt file. Is there any command (don`t want to use any 3rd party sw) what I can use? I`m using Solaris 10. Thank you (14 Replies)
Discussion started by: msojka77
14 Replies

4. Programming

Send/Receive buffer size??

Dear friends, How do I find the TCP send and receive buffer size? (1 Reply)
Discussion started by: nagalenoj
1 Replies

5. UNIX for Dummies Questions & Answers

Can send but not receive email

Hi, One of the users in our company can send but not receive email. We are using SENDMAIL in conjunction with procmail. The funny thing is that all his sent email is in his /var/spool/mail but the email client does not pick anything up! He is using IMAP. Anyone see have any ideas? (2 Replies)
Discussion started by: mojoman
2 Replies

6. UNIX for Dummies Questions & Answers

I can send but cannot receive mail with unix?

Hi all, First post! I have just discovered that I can use unix to send mail to a mail address. I normally use entourage for my mail. This unix mail is very intriguing to me, but something is not working... I tried the search, but could not find the answer... This works: (in terminal)... (1 Reply)
Discussion started by: bjorn
1 Replies

7. Shell Programming and Scripting

Minicom runscript: How to send escape character ( \ )

Please can any of you address my query which I dont find in the runscript MAN page and other results on google. I am using minicom scripts to configure my uboot environment. I have to send a string which contains the escape character ( \ ) itself as follows send "set bootcmd bootm cp.b... (1 Reply)
Discussion started by: rkhanna
1 Replies

8. Linux

how to test for serial commonication??(minicom)

I am testing for serial comm.......... I got suggestion of minicom.... but when i fire minicom... then i get the following error... minicom minicom: WARNING: configuration file not found, using defaults Device /dev/modem access failed: No such file or directory. I am using fedora 6 ,... (3 Replies)
Discussion started by: arunchaudhary19
3 Replies

9. Programming

how i can transfer and receive file in any format over serial port

helo i m using fedora core 6 o.s. i want to develop application using c,c++ which transfer file in any format(like pdf,txt,doc etc) over the serial port and i want to receive the same file from the serial port please guide me. amit (4 Replies)
Discussion started by: amitpansuria
4 Replies

10. IP Networking

Tcp Ip Send Receive Server Program

Requirements: A server program should read a file and send the message to the client . if the file is not there, then switch to the receive part of the same program and receive any messages from the socket. If no messages to receive then switch to send part of the program to... (2 Replies)
Discussion started by: Rajeshsu
2 Replies
Login or Register to Ask a Question