2009-06-02 09:35:57     cant send packes less then 256 via RS232 (BF537 uCLinux)

Document created by Aaronwu Employee on Aug 15, 2013
Version 1Show Document
  • View in full screen mode

2009-06-02 09:35:57     cant send packes less then 256 via RS232 (BF537 uCLinux)

Adam W (POLAND)

Message: 75023   

 

I want to use /dev/ttyS1 in thread on BF537 (uCLinux). I am sending small 30bytes packets, but nothing happens (I can see no packets on osciloscope) until I will send 9 packets ((aprox. 256 bytes) - and then all 9 frames are transmitted.

 

How should I configure in uClinux RS232 driver? I want Linux to send packets at once when I use write(..) function.

 

 

 

here is my initial configuration on port (I am using non blocking write and read):

 

 

 

        cfsetispeed(&my_termios, B115200);

        cfsetospeed(&my_termios, B115200);

 

        tcflush(*aPortFile, TCIFLUSH);

      

        my_termios.c_cflag = B115200 | CS8 |CREAD | CLOCAL | HUPCL;

      

        cfsetospeed(&my_termios, B115200);

      

        tcsetattr(RS_file, TCSANOW, &my_termios);

      

        fcntl(*aPortFile, F_SETFL, FNDELAY);

 

 

 

 

with best regards,

 

xadamus

QuoteReplyEditDelete

 

 

2009-06-02 10:56:15     Re: cant send packes less then 256 via RS232 (BF537 uCLinux)

Adam W (POLAND)

Message: 75026   

 

One more info:

 

when I add to the of the packed 0x0A  (\n) character, packet is transmitted at once. When there is no 0x0A  at the packet end, at least 256 bytes must be written to transmitt data.

 

 

 

I open file like that:

 

file=fopen(aPort,"wb");

 

 

 

Any suggestions ?

QuoteReplyEditDelete

 

 

2009-06-02 14:39:17     Re: cant send packes less then 256 via RS232 (BF537 uCLinux)

Mike Frysinger (UNITED STATES)

Message: 75035   

 

that's because that is how you configured the termios settings.  if you dont want it line buffered, then disable it.  i.e. use canonical mode.

QuoteReplyEditDelete

 

 

2009-06-03 05:43:03     Re: cant send packes less then 256 via RS232 (BF537 uCLinux)

Adam W (POLAND)

Message: 75117   

 

thanks a lot, now is working fine.

 

but ... almost workning because:

 

 

 

1. when I call program from command line:  ./myprogram  /dev/ttyS0 /dev/ttyS1   works everything ok (I use two serial ports)

 

2. when program is called from autostart.sh in the same way: ./myprogram  /dev/ttyS0 /dev/ttyS1,  I get error nr -2 when opening port (No such file or directory)

 

3. when program is called from autostart.sh like that: ./myprogram  /dev/ttyS0 /dev/ttyS1 > /dev/null , again works ok.

 

 

where is the problem ? (I am newby with Linux)

QuoteReplyEditDelete

 

 

2009-06-03 06:25:42     Re: cant send packes less then 256 via RS232 (BF537 uCLinux)

Mike Frysinger (UNITED STATES)

Message: 75120   

 

i dont really know what "autostart.sh" is or how it is executed

 

if i had to guess, your application expects the default fds of 0,1,2 to be connected and if they arent, it falls apart.  dont access std{in,err,out} in that case.

Attachments

    Outcomes