serial-port

Can write to, but can't read from serial port ttyS0 in linux C program

拥有回忆 提交于 2019-12-24 13:18:00
问题 I'm trying to learn how to program the ttyS0 serial port in Linux using C. I have another machine connected to my serial port sending alternating hex values of 5f and 6f about every two seconds. I've verified with other port monitoring apps that these values are appearing at the port. In my code I'm using a blocking read() into a 10 char length buffer. Even though my other machine is still sending data, read() blocks forever. If I include the line fcntl(fd, F_SETFL, FNDELAY); which sets read(

Android bluetooth communication with Arduino

北城余情 提交于 2019-12-24 12:20:33
问题 I am currently looking at Google's Bluetooth Chat example. The goal is to get communication between android and and Arduino working based on this example. While communication from the smartphone to the Arduino is working great, the other direction does not: When sending bytes from the Arduino to the smartphone, the following code is used for receiving: // Read from the InputStream bytes = mmInStream.read(buffer); // Send the obtained bytes to the UI Activity mHandler.obtainMessage

Serial port reading

只愿长相守 提交于 2019-12-24 12:20:07
问题 I am trying to read 3 temperature devices using WinForms and the Modbus 485 protocol. Basically I have to periodically write a command to each device, wait for response and when I get the response, process it. Each device has a unique communication adress. In order to periodically send the command I am using a timer. Timer1.interval=100; This is how I am sending the command and where I am processing the response: private void ProcessTimer_Tick(object sender, EventArgs e) { switch (tempState)

How to integrate Serial Port Communication in iOS SDK

烈酒焚心 提交于 2019-12-24 11:52:18
问题 I am very new to iOS development. I want to communicate with RN52 chip over Bluetooth through my iOS app using Serial Port Communication. Can any one tell me how to implement this? Or is their any tutorial which will help me? Do I need MFi certificate for this? 来源: https://stackoverflow.com/questions/20737793/how-to-integrate-serial-port-communication-in-ios-sdk

How to integrate Serial Port Communication in iOS SDK

自闭症网瘾萝莉.ら 提交于 2019-12-24 11:48:10
问题 I am very new to iOS development. I want to communicate with RN52 chip over Bluetooth through my iOS app using Serial Port Communication. Can any one tell me how to implement this? Or is their any tutorial which will help me? Do I need MFi certificate for this? 来源: https://stackoverflow.com/questions/20737793/how-to-integrate-serial-port-communication-in-ios-sdk

open function doesn't return for serial port

限于喜欢 提交于 2019-12-24 11:19:24
问题 I have a USB serial port module and I want to use it in my C application. The problem is the open system call doesn't return! int serialDevice = open("/dev/ttyUSB0", O_RDWR | O_NOCTTY); // doesn't return I added my user to dialout group and I can access the port without root access using minicom in terminal. So it's not permission problem. Even if it is, it should return instantly and give permission error. But open function doesn't return at all. What should I do? Do you have any idea?

Equivalent of a SerialPortEvent for a socket connection

和自甴很熟 提交于 2019-12-24 10:58:46
问题 I'm writing a application that has a connection to a measuring device. This device can be connected by serial and networkconnection. The serial side I'm done with and catches the data that is send by using a SerialPortEvent . Now I'm trying to accomplish the same thing with a socket . I have the connection working, and I can send/and receive data from the device. Problem with this is that I force a Thread.sleep to wait for all data to be ready. But now I want to automatically catch the

Changing a form from a separate background worker

大憨熊 提交于 2019-12-24 10:00:00
问题 I have a form which when loaded starts a looping background worker which gets data from a usb device every half a second. Once the program receives a new piece of data from the usb device it runs a function. The _Dowork function has while (true) { portConnection.Write("?"); Thread.Sleep(50); } I then have a separate routine that runs when data is received private void portConnection_DataReceived(object sender, SerialDataReceivedEventArgs e) { } This is the routine that cannot then set values

Forcing raw serial mode in C - linux

时光怂恿深爱的人放手 提交于 2019-12-24 07:56:07
问题 Not sure how to word the title, but what I'm trying to do is test my micro controller with my Linux PC to ensure data is correct. After hours of searching, I found out that the stty command can change how data is managed through the serial port and it turned out that by default if xon or xoff characters are received from the port, they don't get displayed. At first I thought my computer was too slow that I was losing characters at 57.6Kbps but that wasn't the case. Back in the day when I was

Serial Comms Not Working Through QSerialPort (Qt) But Is Working Via Terminal (Termite)

好久不见. 提交于 2019-12-24 07:16:50
问题 I have a very strange issue, which has been driving me mad for the last two days. I have a serial device (LS 100 Photometer) which I am trying to control. Using a terminal (termite) set up with the correct parameters, I can send the command ("MES"), followed by the delimeter (CR LF), and I get back some measurement data as expected. The problem is, from Qt, I do not get any data returned. Using a sniffer program, I have confirmed that I am sending the exact same 5 bytes (MES CR LF) as the