This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Loop back mode enabling?

I want to enable the software loop back in the MCR of UART4 instance through my (user space )application code.

I am using omap4460 panda board.

I  was able to control the baudrate ,using termios but not this as this is different when i looked into omap-serial.c for version(3.4)

How will I do it using ioctl?or any other way.How do I test it.

I tried this way.

#define DEVICE "/dev/ttyO3"

int main()
{
	int fd;
	int write_fd1;
	int read_fd;
	int status = 0;
	char buf[2];
	struct termios options;
	fd = open(DEVICE,O_RDWR | O_NONBLOCK);

	if(fd < 0)
	{
		printf("unable to open the device\n");
		return -1;
	}
	else
		printf("device opened %d \n",fd);
	tcgetattr(fd,&options);	
	cfsetospeed(&options,B300);
	cfsetispeed(&options,B300);
	tcsetattr(fd,TCSANOW,&options);	
	tcgetattr(fd,&options);	

	if((cfgetospeed(&options) != B300) || (cfgetispeed(&options)!= B300));
	{
		printf("Baud rate not set");
	}
	ioctl(fd,TIOCMGET,&status);
	status |= 0x0010;
	ioctl(fd,TIOCMSET,&status);
	/* read from file and write to device */
	while(1)
	{
		write_fd1 = write(fd,"a",2) ;
	   	read_fd = read(fd,buf,sizeof(buf)) ;
		printf("write_fd %d \n",write_fd1);
		printf("read_fd %d \n",read_fd);
	}
	close(fd);
	return 0;
}

Please share any reference code.

  • Hi, Try to implement  the loopback mode that way.
    unsigned int modem_control_bits;
    
    result = ioctl(tty_descriptor, TIOCMGET, &modem_control_bits);
    
    modem_control_bits |= TIOCM_LOOP; /* request loopback  */
    
    result = ioctl(tty_descriptor, TIOCMSET, &modem_control_bits);

    Regards,
    Boyko
  • Hi ,

    1. 6 UART in TI81xx. I am using 4 UART'S UART1,3,4,5

    UART1 is ttyO1,ttyO3,ttyO4,ttyO5 how to configure this uart 3,4,5

    # dmesg | grep UART
    omap_uart.0: ttyO0 at MMIO 0x48020000 (irq = 72) is a OMAP UART0
    omap_uart.1: ttyO1 at MMIO 0x48022000 (irq = 73) is a OMAP UART1
    omap_uart.2: ttyO2 at MMIO 0x48024000 (irq = 74) is a OMAP UART2
    omap_uart.3: ttyO3 at MMIO 0x481a6000 (irq = 44) is a OMAP UART3
    omap_uart.4: ttyO4 at MMIO 0x481a8000 (irq = 45) is a OMAP UART4
    omap_uart.5: ttyO5 at MMIO 0x481aa000 (irq = 46) is a OMAP UART5
    # echo "UU" > /dev/ttyO1
    # cat /dev/ttyO1 &
    #

     TX & RX short (loopback) no output on console. any missing ?

    I was check pin muxing  UART1, & UART3 also.

    BR

    Tejas