2 Replies Latest reply on Nov 21, 2016 12:18 PM by Intel Corporation

    UART1 edison to RS232

    Radhika.k

      Hi all,

                   I'm using Intel edison arduino expansion board,I'm trying to do echo test ,but its not reflecting in /dev/ttyMFD1.I have tried with arduino IDE gpio on serial1 with arduino expansion board ,then I can see the output in /dev/ttyMFD1 . My pin connections are as below

      Rs 232's Tx - Rx on edison

      RS 232's Rx - Tx on edison

      RS 232's Gnd - Gnd on edison.

      RS 232's CTS - digital pin 2

      RS 232's RTS -digital pin 4

      The other end of RS-232 RX and TX pins are shorted.

      I'm enabling the gpio pins to uart using the script file given below.I'm using the code as mentioned in the link tx/ rx pin not working.

      #include <stdio.h>

      #include <stdlib.h>

      #include <unistd.h>     // UNIX standard function definitions

      #include "mraa.h"

       

       

      int main() {

            mraa_uart_context uart;

          uart = mraa_uart_init(0);

          mraa_uart_set_baudrate(uart,9600);

          mraa_uart_set_mode(uart,8,MRAA_UART_PARITY_NONE , 1);

         //mraa_uart_set_flowcontrol(uart,0,0);

          //mraa_uart_set_timeout(uart,0,0,0);

       

          if (uart == NULL) {

              fprintf(stderr, "UART failed to setup\n");

              return EXIT_FAILURE;

          }

       

          unsigned char buffer[] = {0x11,0x01,0x01,0xED};

           //char buffer[5]

        //buffer[] = {h};

          unsigned char revBuf[50];

          unsigned int revBytes;

          unsigned int i;

       

          for (i=0;i<5;i++){

          printf("serial sent %d\n",i);

          mraa_uart_write(uart, buffer, sizeof(buffer));

       

          usleep(1000000);

          printf("try to read response...\n");

       

          if (mraa_uart_data_available(uart,1)){

          printf("dataReceived\n");

          revBytes=mraa_uart_read(uart,revBuf,sizeof(revBuf));

          printf("data receive:%x%x%x\n",revBuf[0],revBuf[1],revBuf[2]);

          }

        else

        {

        printf("data not received");

        }

          usleep(1000);

          }//end for

       

          mraa_uart_stop(uart);

          mraa_deinit();

          return EXIT_SUCCESS;

      }

      But I'm unable to get the data :-( I also tried by changing the baud rate but no result. Unable to read the data from /dev/ttyMFD1 too ...

      I also tried with the commands tried with the commands  stty -F /dev/ttyMFD1 9600 and echo "hello" >> /dev/ttyMFD1 and in the other console I opened cat /dev/ttyMFD1 but it is not reflecting anything :-( Please do needful.

       

      Thanks and Regards,

      Radhika.

        • 1. Re: UART1 edison to RS232
          Intel Corporation
          This message was posted on behalf of Intel Corporation

          Hi Radhika,

          Thank you for contacting us. We’ll do our best to assist you with this case. You mention that you were able to run this test on the Arduino IDE with the code from the thread above, but not the example uart_got.c, is this correct? You mention you tried changing the baud rate, you’re using 9600, right?

          You also mention your RS232 to the Edison connections. On the RS232 side that’s connected to the Edison, why are you connecting CTS to digital pin 2 and RTS to digital pin 4? It would be helpful if we had the complete schematic of how you’re connecting the RS232 to the Edison.

          Are you using the latest image? You can check you’re using the latest one if the output of cat /etc/release is 201606061707.

          You can see https://www.scivision.co/intel-edison-using-uart-ttymfd1-serial-port/ for more information about UART in the Edison.

          We’ll be waiting for your response.

          -Sergio
           

          • 2. Re: UART1 edison to RS232
            Intel Corporation
            This message was posted on behalf of Intel Corporation

            Do you still need assistance with this case?

            -Sergio