Advertisement
Guest User

Untitled

a guest
Apr 22nd, 2013
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. Hi,
  2.  
  3. I bought the RS485 Cap and i'm trying to use it correctly.
  4.  
  5. The connection is set to the UART 2 with the switch. ( rx and tx )
  6.  
  7. i correctly set the pin mux to enable the uart 2:
  8.  
  9. echo 21 > /sys/kernel/debug/omap_mux/spi0_sclk
  10. echo 1 > /sys/kernel/debug/omap_mux/spi0_d0
  11.  
  12.  
  13. In my code, i'm able to open the connection, but not to initiate it :
  14.  
  15.  
  16. int fd = open ("/dev/ttyO2", O_RDWR);
  17. if (fd < 0) {
  18. printf("error\n");
  19. /* Error handling. See errno. */
  20. }
  21. // it works
  22. struct serial_rs485 rs485conf;
  23.  
  24. rs485conf.flags |= SER_RS485_ENABLED;
  25. rs485conf.delay_rts_before_send = 0x00000004;
  26. int test = ioctl(fd, TIOCSRS485, &rs485conf);
  27. if(test<0){
  28. test=0;
  29. /// i'm stuck here .........
  30. }else{
  31. test=1;
  32. }
  33.  
  34.  
  35. Would you like to explain me what is wrong with me ?
  36.  
  37. Thx you very much,
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement