Results 1 to 4 of 4
I am writing a c program to control serial devices. I need to be able to control at least 2 at one time. I can successfully read from and write ...
- 05-20-2009 #1Just Joined!
- Join Date
- May 2009
- Posts
- 9
Reading from 2 serial devices (C program)
I am writing a c program to control serial devices. I need to be able to control at least 2 at one time. I can successfully read from and write to one of them. I have to send a configuration packet every time I connect or the device will not send any data back. When I connect to two devices at once (two different file descriptors, fd1 and fd2) I can send my configuration packet (44 bytes) to both of them and they both accept it. I can send commands to both of them (single bytes). And I can read from one of them, when I try to read from the other one I just get nothing back, even though the device says it received the configuration packet correctly. Is there some trick to this? If I disconnect from one device to read from the other, I will have to resend the configuration packet when I reconnect, which would be bad to do too many times. What can I do? Why can't I read from both devices?
They do both work, they work fine if I just connect to one at a time.
- 05-21-2009 #2Just Joined!
- Join Date
- May 2009
- Posts
- 9
Sincere appologies.
The issue was not that I could not read from both of them, but that the connector on one of the stepdown boards was mounted upside down. All the pins were reversed. Transmit worked because the transmit pin is directly in the center so if you flip the connector the transmit pin is in the same place.
- 05-21-2009 #3Just Joined!
- Join Date
- May 2009
- Posts
- 9
Again, sorry for wasting your time.
- 05-24-2009 #4Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,974
No time wasted. It's likely that your posing the question helped you analyze the problem, even though it would be unlikely (though possible) that anyone replying would have suggested such a cause, though it is quite likely that someone would have suggested that there was a hardware problem. When you have such weird problems with devices, a root-cause analytical technique will often get you to the source of the problem.
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!


Reply With Quote