2011-09-14 11:13:11     Enable RS485 on BF548

2011-09-14 11:13:11     Enable RS485 on BF548

barreh walid (TUNISIA)

Message: 103387   

Hi

I have a BF548 ezkit and I am using the latest trunk kernel/uboot/filesystem ( 2010R1 ).

Any idea to enable RS485 half duplex mode ?

i tested:  RS485fd = open(dv, O_RDWR);

if (RS485fd < 0)

pabort("can't open device");

else

printf("RS485 device open :%s\n",dv)

// Get current terminal settings

  tcgetattr(RS485fd, &m_tmbuf);

    // Copy current settings so we can restore them later

    m_tmsave = m_tmbuf;

    // Local modes - turn off echoing, canocal, extended functions

    // and signal chars

    m_tmbuf.c_lflag &= ~(ECHO|ICANON|IEXTEN|ISIG);

  // Non-blocking

    m_tmbuf.c_cc[VMIN]  = 0;

    m_tmbuf.c_cc[VTIME] = 0;

    // Input modes - turn off canonical, extended functions and signal chars

    m_tmbuf.c_iflag &= ~(BRKINT|ICRNL|INPCK|ISTRIP|IXON);

    // Output modes - turn off post processing

    m_tmbuf.c_oflag &= ~(OPOST);

    // Configure 8 bits per character

  m_tmbuf.c_cflag |= (CS8);

    // Configure input/output baud rate

    cfsetispeed(&m_tmbuf, B115200);

    cfsetospeed(&m_tmbuf, B115200);

    // Apply new settings now after flushing

RS485conf.flags |= SER_RS485_ENABLED;

    tcsetattr(RS485fd, TCSAFLUSH, &m_tmbuf); 

// Set RS485 mode:

RS485conf.flags |= SER_RS485_ENABLED;

if (ioctl (RS485fd,TIOCSERSETRS485/*TIOCSRS485*/, &RS485conf) < 0)

printf("ioctl error\n");

is not working always return error

THANKS

QuoteReplyEditDelete

2011-09-14 22:32:47     Re: Enable RS485 on BF548

Aaron Wu (CHINA)

Message: 103390   

Could you dig into the ioctl method in the driver and check what happened in your case?

QuoteReplyEditDelete

2011-09-23 05:28:43     Re: Enable RS485 on BF548

Aaron Wu (CHINA)

Message: 103513   

Just greped the kernel, currently blackfin serial driver does not support your ioctl "TIOCSERSETRS485"

QuoteReplyEditDelete

2011-09-26 17:37:46     Re: Enable RS485 on BF548

barreh walid (TUNISIA)

Message: 103548   

THANKS

  • Created
Was this helpful?

Before You Switch


Switching languages will make ADI Explorer unavailable. Resume your session by switching back to English and reopening ADI Explorer.