Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Serial Port issue, write()?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
diefast
Tux's lil' helper
Tux's lil' helper


Joined: 08 Sep 2005
Posts: 131
Location: little room with no windows

PostPosted: Sun Sep 17, 2006 9:38 am    Post subject: Serial Port issue, write()? Reply with quote

Hello,
I am writing simple code to work on the serial port. I have read and write interface to pass the data in and out. My code, previously tested on kubuntu and gentoo 2.6.8 fails to work on 2.6.17 r7. What could be different in the serial port kernel setup?

My code writes binary and reads binary. Something is wrong with the writing routine. My code reads ok but write does not give the proper read.

I stripped my code down to bare serial port io. I think that the problem is the lack of flow control. I run 38,400 with no flow control. The board I am connected to takes binary commands to activate and deactivate certain features. For some reason my asus laptop (this computer) does not do proper serial port io.

What can I do to make my serial io stable? What could have I done to screw it up?

What I noticed is the following:
If I use a loopback cable, I get 4 byte chunks. Usually on my toshiba laptop or my desktop I get the whole 20 bytes of the responce. Why am I getting 4 byte chunks. What could be off?

Please help,
Roman
Back to top
View user's profile Send private message
diefast
Tux's lil' helper
Tux's lil' helper


Joined: 08 Sep 2005
Posts: 131
Location: little room with no windows

PostPosted: Sun Sep 17, 2006 10:32 am    Post subject: Re: Serial Port issue, write()? Reply with quote

diefast wrote:
Hello,
I am writing simple code to work on the serial port. I have read and write interface to pass the data in and out. My code, previously tested on kubuntu and gentoo 2.6.8 fails to work on 2.6.17 r7. What could be different in the serial port kernel setup?

My code writes binary and reads binary. Something is wrong with the writing routine. My code reads ok but write does not give the proper read.

I stripped my code down to bare serial port io. I think that the problem is the lack of flow control. I run 38,400 with no flow control. The board I am connected to takes binary commands to activate and deactivate certain features. For some reason my asus laptop (this computer) does not do proper serial port io.

What can I do to make my serial io stable? What could have I done to screw it up?

What I noticed is the following:
If I use a loopback cable, I get 4 byte chunks. Usually on my toshiba laptop or my desktop I get the whole 20 bytes of the responce. Why am I getting 4 byte chunks. What could be off?

Please help,
Roman


I have posted a post in the programming group regarding this problem as well at https://forums.gentoo.org/viewtopic-p-3583488.html#3583488.
Sorry for the double shot.
RK
Back to top
View user's profile Send private message
diefast
Tux's lil' helper
Tux's lil' helper


Joined: 08 Sep 2005
Posts: 131
Location: little room with no windows

PostPosted: Sun Sep 17, 2006 10:34 am    Post subject: Re: Serial Port issue, write()? Reply with quote

diefast wrote:
Hello,
I am writing simple code to work on the serial port. I have read and write interface to pass the data in and out. My code, previously tested on kubuntu and gentoo 2.6.8 fails to work on 2.6.17 r7. What could be different in the serial port kernel setup?

My code writes binary and reads binary. Something is wrong with the writing routine. My code reads ok but write does not give the proper read.

I stripped my code down to bare serial port io. I think that the problem is the lack of flow control. I run 38,400 with no flow control. The board I am connected to takes binary commands to activate and deactivate certain features. For some reason my asus laptop (this computer) does not do proper serial port io.

What can I do to make my serial io stable? What could have I done to screw it up?

What I noticed is the following:
If I use a loopback cable, I get 4 byte chunks. Usually on my toshiba laptop or my desktop I get the whole 20 bytes of the responce. Why am I getting 4 byte chunks. What could be off?

Please help,
Roman


I have found that I am missing chunks, when I read back from a loopback cable.

When I sent this out, I only got half back.

Code:

serial port io: sending message of length = 9
serial port io: sending message - [01][04][00][00][00][7C][2A][7E][8E]
serial port io: sending length of pulled buf: 9
serial port io: message to be sent by character - [01][04][00][00][00][7C][2A][7E][8E]
serial port io: bytes written: 9
serial port io: thread raw read: [01]
serial port io: thread raw read: [7C][2A][7E]


As you can see 4 out of 9 came back through the loopback.
The output refers to write and read commands. Write is done in the thread that sleeps until called for, the read is blocking most of the time - until something comes in. I have no idea why my serial ports are screwed up.

Please help
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum