<DIV><FONT face="comic sans ms" size=3>Hello, All,</FONT></DIV>
<DIV><FONT face="comic sans ms" size=3></FONT> </DIV>
<DIV><FONT face="comic sans ms" size=3>I'm a software guy and new to Ethernut. I just bought a Ethernut II board and try to use UART1 as a 485 master to scan data from my another board which has been tested successfully as a 485 slave.</FONT></DIV>
<DIV><FONT face="comic sans ms" size=3></FONT> </DIV>
<DIV><FONT face="comic sans ms" size=3>First I followed the Hardware Manual and setup JP1 (shorten Pin1 & 2, 3 & 4, 9 & 10, 11 & 12), JP2 (shorten Pin1 & 2, 3 & 4) and JP6 (shorten Pin 5 & 6, 7 & 8, Pint 9 & 10). Then I just directly connected RS485A to the High (+) of my slave 485 and RS485B to the Low (-) of my slave 485. Then I modified the uart.c which is a sample comes with Ethernut software. Here is a slice of the code:</FONT></DIV>
<DIV><FONT face="comic sans ms" size=3></FONT> </DIV>
<DIV><FONT face="comic sans ms" size=3>/*********************************************************************************</FONT></DIV>
<DIV><FONT face="comic sans ms" size=3></FONT> </DIV>
<DIV><FONT face="comic sans ms" size=3>static unsigned char SendBuf[5] = {0x96, 0x96, 0x01, 0x00, 0x01};</FONT></DIV>
<DIV><FONT face="comic sans ms" size=3>static unsigned char ReceiveBuf[32] = {0};</FONT></DIV>
<DIV><FONT face="comic sans ms" size=3></FONT> </DIV>
<DIV><FONT face="comic sans ms" size=3>int got;</FONT></DIV>
<DIV><FONT face="comic sans ms" size=3>FILE *uart1;</FONT></DIV>
<DIV><FONT face="comic sans ms" size=3>u_long baud1 = 9600;</FONT></DIV>
<DIV><FONT face="comic sans ms" size=3></FONT> </DIV>
<DIV><FONT face="comic sans ms" size=3>NutRegisterDevice(&devUart1, 0, 0);</FONT></DIV>
<DIV><FONT face="comic sans ms" size=3>uart1 = fopen("uart1", "r+");</FONT></DIV>
<DIV><FONT face="comic sans ms" size=3>_ioctl(_fileno(uart1), UART_SETSPEED, &baud1);</FONT></DIV>
<DIV><FONT face="comic sans ms" size=3></FONT> </DIV>
<DIV><FONT face="comic sans ms" size=3>_write(_fileno(uart1), SendBuf, 5);</FONT></DIV>
<DIV><FONT face="comic sans ms" size=3>_write(_fileno(uart1), 0, 0);</FONT></DIV>
<DIV><FONT face="comic sans ms" size=3>NutSleep(500);</FONT></DIV>
<DIV><FONT face="comic sans ms" size=3>got = _read(_fileno(uart1), ReceiveBuf, sizeof(ReceiveBuf));</FONT></DIV>
<DIV><FONT face="comic sans ms" size=3></FONT> </DIV>
<DIV><FONT face="comic sans ms" size=3>**************************************************************************************/</FONT></DIV>
<DIV><FONT face="comic sans ms" size=3></FONT> </DIV>
<DIV><FONT face="comic sans ms" size=3>But I cann't get anything from my slave device so far. My questions are:</FONT></DIV>
<DIV><FONT face="comic sans ms" size=3></FONT> </DIV>
<DIV><FONT face="comic sans ms" size=3>1. Is there anything special for the hardware setting? Did I setup my board correctly?</FONT></DIV>
<DIV><FONT face="comic sans ms" size=3>2. I knew the 485 on Ethernut is half duplex and have to use PD5 / PD4 to control the data direction, but based on Nut/OS, do I still need to do this? Is there any existing RS-485 UART driver for Nut/OS now?</FONT></DIV>
<DIV><FONT face="comic sans ms" size=3>3. If the above answer is NO, do I have to wirte ISR for Mega128 to send and receive package?</FONT></DIV>
<DIV><FONT face="Comic Sans MS" size=3></FONT> </DIV>
<DIV><FONT face="Comic Sans MS" size=3>Thanks for any kindly help.</FONT></DIV>
<DIV><FONT face="Comic Sans MS" size=3></FONT> </DIV>
<DIV><FONT face="Comic Sans MS" size=3>Sincerely,</FONT></DIV>
<DIV><FONT face="Comic Sans MS" size=3>Alex</FONT></DIV>
<DIV><FONT face="Comic Sans MS" size=3></FONT> </DIV><p>
<hr size=1><font face=arial size=-1>Do you Yahoo!?<br>Yahoo! Movies - <a href="http://movies.yahoo.com/showtimes/movie?mid=1808405861">Buy advance tickets for 'Shrek 2' </a>