Guide me,How to handle DTR pin.

Good Evening,everyone ! As I’m not English speaker, many mistake may be contained this article. Solly. I’m coding software using UART in NS9360 Dev.board with Net+OS now. I Want to Handle /com/0 like … # RTS/CTS Hard flow. # Manualy control DTR(To use “Force Disconnect”) I tried to use tcsetsignals(). But it becomes Error. What am I wrong ? Something modefication needed in BSP code ? --------------------------------------------------------- int i; int FD; struct termios Newtio; FD = open(ComPort,O_RDWR); // Open COM0 port if(FD <0){ // Fail? exit(-1); // then terminate } tcgetattr(FD,&Newtio); // Get current setteing cfsetospeed(&Newtio, BAUDRATE); // Set to 9600bps Newtio.c_cflag = CS8|CRTSCTS|CREAD; // 8Bit,Rx On,CTS/RTS Flow Newtio.c_iflag = IGNPAR|IGNBRK; // Non-Parity,without Break Newtio.c_oflag = 0; // default value Newtio.c_lflag = 0; // default value tcflush(FD, TCIFLUSH); // flush buffer tcsetattr(FD,TCSANOW,&Newtio); // Setup COM0 port. if(tcsetsignals(FD,MS_DTR)!=0){ // Activate DTR i=getErrno(); printf("Err %d
",i); }

There’s an erroneous return value in netos63_gnu\src\bsp\devices\common\serial\mercury_serl.c confusing you, see the first line in the code snippet below tagged with MRS. /* * 11.09.2005 MRS TCSETSIGNALS in netos_serlioctl modified: * && instead of || for RTS handshake function check * result = OK instead of default ENOSYS as error return value / … case TCSETSIGNALS: status = OK; / MRS / DISABLE_INTS; opt = port->serl_regs->ctrl_a; prev = 0; if (opt & DTR) prev |= MS_DTR; if (opt & RTS) prev |= MS_RTS; mout = (uint32)arg; //Cast to uint32 to avoid warning. Truncation ok if ( !(port->current_termios->c_cflag & CDTR) ) { if (mout & MS_DTR) { opt |= DTR; } else { opt &= ~DTR; } } if ( !(port->current_termios->c_cflag & CRTS) && !(port->current_termios->c_cflag & CRTSTOGGLE) ) / not ||, MRS / { if (mout & MS_RTS) { opt |= RTS; } else { opt &= ~RTS; } } port->serl_regs->ctrl_a = opt; RESTORE_INTS; if ( (prev ^ mout) & MS_DTR ) { / DTR changed / serial_sigchange[0].dtr_counter++; serl_cb_event(channel, DTR_DELTA); //Do we need this here if serl_monitor will catch it? DISABLE_INTS; port->status->mstat ^= MS_DTR; RESTORE_INTS; } if ( (prev ^ mout) & MS_RTS ) { / RTS changed */ serial_sigchange[0].rts_counter++; serl_cb_event(channel, RTS_DELTA); //Do we need this here if serl_monitor will catch it? DISABLE_INTS; port->status->mstat ^= MS_RTS; RESTORE_INTS; } break; …

I thancs for your cooperation.
And,I apologize for my answer so delayed.
I have tryed to repray may 7.But this BBS system ignored my message.
may be Server in maintenance at that time…

At may 7,I also found out the problem of NET+WORKS OS.
So,I did following methods to avoid this problem.

  • To configure Serial port as “4wire-UART”
  • To configure Lest of flow lines as “GPIO”
  • Create application within “software driven” Hard Flow Control.

I know its not good way. But, it not need to modefy the OS.
Because,Modefied OS may cause trouble when its version-up.

In the future though it is good when this BUG is corrected.