Networking :: Serial Port : Read Data, Not Reading Complete Data?

Mar 5, 2010

I have an application where I am sending data via serial port from PC1 (Java App) and reading that data in PC2 (C++ App). The problem that I am facing is that my PC2 (C++ App) is not able to read complete data sent by PC1 i.e. from my PC1 I am sending 190 bytes but PC2 is able to read close to 140 bytes though I am trying to read in a loop.Below is code snippet of my C++ AppOpen the connection to serial port

Code:
serialfd = open( serialPortName.c_str(), O_RDWR | O_NOCTTY | O_NDELAY);
if (serialfd == -1)

[code]...

View 5 Replies


ADVERTISEMENT

Programming :: Get Data From Serial Port Function Read() Blocks When Data Not Available?

Jun 11, 2009

I am using read() in c++ to get data from a serial port. However, if no data is available on the serial port the function blocks until dta arrives.Example code:

//------------------------------------------------------------
char m_readBuffer[255] = {0};
char* p_curChar = m_readBuffer;

[code]...

View 1 Replies View Related

Programming :: Displaying I/O Possible When Reading Data From The Serial Port?

Aug 31, 2009

I have got a problem while reading from the serial port. I'm working on iMX-31 board and Eclipse IDE. Whenever I'm trying to read any data through the serial port, it's displaying I/O Possible and the application is being terminated. After reading I'm trying to write this data on a file. Here are the excerpts from the code:

# int main()
{
if (openport()<0)

[code]...

View 7 Replies View Related

Programming :: Read Some Data From Controller Using Serial Port?

Aug 25, 2010

i want to try with a small application in linu in that i want to read some data from controller using serial port and i wanna transfor that data to another meachin in the network for this i want serial port interfacing programming as well as socket programming.

View 1 Replies View Related

Programming :: Serial Port Data Read Time Interval?

Oct 30, 2010

I am writing a C program which reads data over serial port. While reading data, if I send my data(which is a 13 byte structure) periodic with a period of 1 second for 10 times I read it without problem and I read the data 10 times as I sent and as I expectBut if I send data continuousuly(without any time interval between each sending) 10 times I can only read 1 of them(I can only read it once).

View 11 Replies View Related

Programming :: Debian Serial Port Read() Return Wrong Data?

Jul 6, 2010

I am implementing a simple serial protocol where my ARM9 board, running Linux is communicating to a slave peripheral board. The Master sends a 12 byte data stream and the peripheral board returns status in a 23 byte response. The serial port is opened in raw mode. It works perfectly on 44 reads; however, on the 45 read the data returned from the read() is incorrect. I've framed what's being sent on an oscope and it is correct.The coincidence is that 23 x 44 = 1012. It's as though the receive buffer is 1K and when I go past the boundary I get bad data. The read following the bad one is good again.I've tried flushing the buffer before reading but get the same result.Here's the port initialization code:

Code:
int initport(int fd)
{

[code]...

View 4 Replies View Related

Networking :: Serial Port : Not Able To Write Big Chunk Of Data?

Mar 10, 2010

I am trying to send text data from one PC to other using Serial cable. One of the PC is running linux and I am sending data from it using write(2) system call. The log size is approx 65K bytes but the write(2) system call returns some 4K bytes (i.e. this much amount of data is getting transferred). I tried breaking the data in chunks of 4K but write(2) returns -1.My question is that "Is there any buffer limit for writing data on serial port? or can I send data of any size?. Also do I need to continously read data from other PC as I write 4K chunk of data"Do I need to do any special configuration in termios structure for sending (huge) data?

View 4 Replies View Related

Programming :: Intercept Data On Serial Port?

Dec 21, 2010

I dont know if this is the right forum, But I try to find a solution, I want to intercept data from/to serial port without disrupting the software that manages the serial port, (I would like to save the data to a file or sent into a socket) I searched somes modules and programs (linspy, ttysniff, interceptty, maxty ...), A bit complicated (There are some diff. between kernel 2.4 and 2.6), So I'd like to change the serial port driver to intercept the "read" and "write " and do what I want with the data, I'd like to know what do you think about

View 3 Replies View Related

Programming :: Send Data Through Serial Port Using C?

Oct 20, 2009

I am not a profession programmer. I have to write a C code which send some command to attach display using C program. Can any one please help me in this regard.

View 3 Replies View Related

Programming :: Serial Port Program Not Outputting The Right Data?

Apr 11, 2009

I have connected a device to my linux system with a serial cable (rs232). The settings are: port /dev/ttyS0, baud rate=38400, data bits=8, stop bits=1, no parity, no hardware or software handshaking. I wrote a linux program that sends 1 byte to the device, but the device doesn't receive it. I know the serial ports are working because when I use the CuteCOM application to send data, the device DOES receive it, so obviously it is a problem with my code..

Code:

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

[code].....

View 2 Replies View Related

Programming :: Send /receive Data Through Serial Port In Fedora?

Dec 27, 2010

I am doing work on serial port. I want to send/receive data to/from Microcontrolar through serial port. But I don't know how to initialize, receive and send data to Serial port. i am new in fedora so i hav'nt any deep concept of fedora.can anyone send me C code , which communicate through serial port in fedora (or atleast help me). I am using Fedora 11.

View 6 Replies View Related

Programming :: Write Data To Text File Which Is Coming On Serial Port Infintely?

Aug 5, 2010

trying read serial COM port and want to write that received data to file, now its writing only one sentence, but i want to write full file which coming on serial port, as i'm sending file from hyper terminal and reading on linux pc, If i put while loop its not writing anything,without while loop its writing only one line and if send big file then application terminates and then writes to file.But i need do write any size which coming on serial port.Finally i want write full file which is coming on hyper terminal, after writing the file it has wait for next data. This is my code,

#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

[code]...

View 9 Replies View Related

Programming :: Serial Port Communication Program Always Lose One Byte Data: 0x00?

Dec 13, 2009

I wrote a serial port communication program to access a equipment.

int main(void)
{
int fd = 0;
int nread = 0,i = 0,nwrite = 0, tmpread = 0, m = 0, n = 0 ;

[code]....

View 2 Replies View Related

Programming :: Data Directory In Automake - Data Is Always Read-only ?

May 9, 2010

I have some data files that should be distributed with my program. Using dist_pkgdata_DATA in Makefile.am, I get these files installed to /usr/local/data/share/package-name. The problem is that data is read-only, and my program needs to modify it. Playing with dist_sharedstate_DATA, dist_localstate_DATA, dist-data_DATA varibles, I got different installation directories, like /usr/local/com, usr/local/var, but data is always read-only.

How can I distribute modifiable data files with my package? I need some common directory for all users, or maybe local data in a user directory.

View 1 Replies View Related

Software :: Serial Printer Setup 7 Data Bits Rx 8 Data Bits Tx

Aug 8, 2010

About 7 years ago I setup a Redhat system with 8 serial terminals and 8 serial printers, this is still running but I need to get another system running so the original can be taken down for maintenance. The printers are ancient Newbury data dot matrix wide carriage with 7 data bits receive 8 data bits transmit Xon/Xoff flow control. Now I remember setting the transmit and receive data bits as above but after 7 years can't remember where.

View 2 Replies View Related

Hardware :: Reading Serial Port With C?

Aug 12, 2010

I have two usb2serial adapters connected to my PC with a null modem (I am doing some testing to learn serial comm for a particular application). I am writing to /dev/ttyUSB0 a trying to read /dev/ttyUSB1. I have used screen (screen /dev/ttyUSB1 115200) and am able to see the characters being written. I am also able to read and write with Python with the following code

Code: import serial,time,sys
ser1 = serial.Serial('/dev/ttyUSB0',baudrate=115200)
ser2 = serial.Serial('/dev/ttyUSB1',timeout=2,baudrate=115200)
ser1.open()
ser2.open()

[Code]....

View 3 Replies View Related

Networking :: Sending Test Data From File To Port And IP

Apr 23, 2009

I'm working on testing some software, and I have a question. We have several files of binary data that we need to push through our application to test. It communicates via simple TCP sockets. Is there a way I can send this data to the socket from the command line? I tried doing something like this, but telnet never picked up the data.

View 5 Replies View Related

Ubuntu :: Unable To Read The Serial Port

May 23, 2010

I am using a F232 USB to serial adapter for connecting my wireless modem to my laptop and I wrote a simple C code for reading data received by the modem transmitted by another modem installed on my target device.The problem is my code is simply giving 0.00000 (float data) output .When I use the same code with my desktop its running fine and I am getting relevant data.What may be the problem? I even changed the permission for my /dev/ttyUSB0 I am using Ubuntu 10.04 on both my laptop and desktop

below is my code

Code:

#include <stdlib.h>
#include <math.h>
#include <errno.h> /* Error number definitions */
#include <termios.h> /* POSIX terminal control definitions */

[code]....

View 5 Replies View Related

Programming :: Read X Bytes From Serial Port?

May 5, 2010

I am trying to write some code that interfaces with an AVR over a serial port. Basically I send a command then read the output which is 6 bytes. I need to receive all 6 bytes before the program continues. Is there a way to do this? If I use read() it returns -1 unless I add a delay before reading the port. Is there a way to get it to read the 6 bytes as soon as they arrive?In python you simply say how many bytes you want and the max time you are willing to wait which seems a whole lot easier than read

View 1 Replies View Related

Ubuntu :: Serial Port Read, Write After DTR Toggle In C++?

Mar 31, 2011

I need to read and write to a serial device. When I connect via gtkterm, I need to toggle DTR before I can communicate with the device . My problem is that I cannot emulate this in C++.

I want to write some code that can setup a comport, toggle the DTR, then read and write strings to the port. However all my attempts have been fruitless. My serial settings are B9600, No parity, no hardware control, 8 bt characters and 1 stop bit:

Code:
#include <iostream>
#include <SerialStream.h>
#include <sys/ioctl.h>
#include <fcntl.h>
using namespace LibSerial;

[Code]...

View 1 Replies View Related

General :: Serial Port Configuration - Write Or Read

Dec 1, 2010

I have a minilinux that I being working on, the problem now is that the serial ports doesn't seem to work (I have 4 serial ports).They don't write or read.

I run the command setserial g /dev/ttySx and it says that his IRQ are 3 or 4 (3 for ttyS0 and ttyS2 , 4 for ttyS1 and ttyS4)�but when I run the command: dmesg | grep ttyS the IRQ�s are 0 for ALL my serial ports� could be this the reason why my serial ports aren�t working right??? And if it is how can I solve the problem??

View 2 Replies View Related

Programming :: Read Datas After Write On Serial Port?

Mar 8, 2011

I'm currently developping a C program to drive a Telit GM862-GPS module using the serial port of an embedded board (SBC9261).The communication with the module is based on AT commands : I just send my command to the module, through the RS232 line, and the module answers immediately.Here's an example with a basic command returning the GPS's acquired position, sent with Minicom :

Code:
AT$GPSACP
$GPSACP: 104323.000,4x45.6171N,00x38.6219E,0.8,446.5,3,272.14,0.21,0.11,080311,09

[code]...

View 4 Replies View Related

Ubuntu :: Reading Data From Disk Into Memory

Jun 6, 2011

I have a simple C program that reads a 1 GB file from disk into memory.The first time I run this program, the process takes several seconds. But if I run this program again immediately after it finishes, the read happens almost instantly. What is going on here?My suspicion is that the operating system is realizing that the data I'm trying to read is still uncorrupted in memory (its been freed but not overwritten), so instead of reading it again, it just gives me the same block. I would really like to know what this process is called, or any Googleable keywords that would allow me to research it.

The reason I ask is because the size of my input data has increased. Now I need to read in a 6 GB file (my system has 12 GB of RAM), but I'm not observing the same behavior with the larger file. Each time I run the program the read takes an equally long time.

View 2 Replies View Related

Programming :: Reading Data From Multiple Files?

Mar 17, 2011

I have a folder which includes bunch of folders each having data files in them. [ Folder A has F1, F2 F3 ..... F1000 folders in it, and F1, F2, F3 ... each has about 10 different files named FILE 1, FILE2, FILE3 .... in them.

I am interested in File 1 of each Folder, because that contains the data I need in it. More specifically, that File1 s have a line "ANSWER=..." in them, and i need to get that value of the ANSWER from each file. So doing it by hand is so hard, so I need to write a script that will scan all folders and give me a list of values of eache ANSWERs.

View 4 Replies View Related

Programming :: Reading A File Of Data In An Array?

Feb 10, 2011

I have two files of data with different numbers of columns and rows. I want to read this two files in two arrays and then compare for example the second column of first data file with the third column of the other text file and if the difference between of two numbers is less than a threshold then the program print the information in the rows which fulfill this condition in the third text file. I have written below program but the problem is that it does not go through all rows of second file.

declare -a a
declare -a b
r=` awk '{n++} END {print n}' second.txt `
echo $r
awk '
{

[Code]....

Actually I have two data files one of them contains 44406 and the other one has 12066 rows and I want to check whether the difference between the components of two specific columns is less than a threshod but I have simplified it here. I had written this code and then I have realized that this code just goes through the number of rows as the same as the first.txt file and ignores the rest. I could not find the problem yet.

View 2 Replies View Related

Ubuntu :: Reading EXIF Data From TIFF Files

Aug 9, 2010

I'm having trouble reading EXIF data from TIFF files. Both 8 bit and 16 bit fail to load EXIF data via eye of gnome and GIMP and I'm not sure why. Neither files downloaded online nor rendered from Bibble 5 seem to work. Using Ubuntu 10.04 64bit and GIMP 2.7.2.

View 2 Replies View Related

Fedora :: Reading A Data From CD / Dvd Is Very Slow After Change Motherboard

Mar 28, 2010

Recently changed my motherboard. The new board has the 790FX/SB750 chipset, and the old board used the 770/SB600 chipset. Prior to the change, I had never had any problems reading/writing CDs or DVDs. I now find that reading a data CD is very slow, it can take up to 30 secs before the icon appears on the desktop and a filer window appears. In my tests thus far, only data CDs written on Linux can always be read, albeit slowly. Data CDs written on Windows are variable. Some are never seen by the system, others may or may not be opened. That is I might be able to read it during one test, and next time I try I can't.

When a CD is not 'seen', there is an initial flurry of activity by the drive, but the drive icon (in "Computer' window) doesn't think a disc is in the drive. I can boot OK off a DVD, and data DVDs wrtten on Linux are opened and read quite fast. I am running Fedora 12 x86_64 with the latest Fedora kernel package (2.6.32.9-70), and the Motherboard bios is the latest available. The CD/DVD drive is a SATA Pioneer DVR-215. I have checked the bios settings, and have tried setting 'storage configuration' to IDE and to AHCI, each giving the same result.

I tried switching the SATA data cable from SATA-3 to SATA-2 and was able to open and read a Windows data CD that had previously not been seen, but subsequent attempts have failed to open and read that CD. I suspect the problem may have something to do with hardware drivers, but I really am guessing about this and have not been able to find any useful information on this.

View 6 Replies View Related

General :: Reading The Manufacturer Data / Device ID On A USB Drive?

Jun 28, 2011

I wish to read the Manufacturer data and other details such as Device ID, Serial number on a USB drive.

1. Could anyone help me out with information on the memory structure of a USB drive? (which location is the mnfr data stored?)

2. Are there are any commands in Linux that will help in reading/accessing this data?

View 3 Replies View Related

Software :: Block Driver Error While Reading Data

Jan 22, 2010

i am writing sample block driver while reading data i am getting below error

i am not getting what is this error

BUG: sleeping function called from invalid context at kernel/sched.c:4684 in_atomic():0, irqs_disabled():1

Pid: 5364, comm: test_buf Not tainted 2.6.27.42 #1
[<c041f1d4>] __might_sleep+0xae/0xb3
[<c063ae43>] wait_for_common+0x1f/0x117

[Code]....

View 5 Replies View Related

Programming :: Clearing Cache - Reading Data Upon Investigation

Apr 9, 2009

I have been saving an XML file wherein I shall be reading data, if and only if the XML is present on Hard Drive. If same is not present, the code shall generate first and next time it shall simply read and not jump into writing part again and again. The issue that I am facing is, I am deleting the file manually going to that location, and checking whether it is reading the data, upon investigation, I found that it is really reading the data although the file is deleted.

I suspected that there may be some cache issue from where it is picking values, hence it fired the command
"sync; echo 3 > /proc/sys/vm/drop_caches"
But it is still doing the same pattern.

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved