AnsweredAssumed Answered

TWR-VF65GS10:UART1 receive pin -not able to read data into buffer

Question asked by manjug on Oct 8, 2014
Latest reply on Nov 7, 2014 by alejandrolozano

Hi ,

I have connected UART1 RX pin of TWR-VF65GS10 to my App-Board UART TX pin and UART1 TX pin of TWR-VF65GS10 to RX pin to TTL converter board to PC.

I'm able to write data on UART1 TX pin of TWR-VF65GS10.

But I'm not able to read data on UART1 RX pin of TWR-VF65GS10.

Below is the UART1  settings i did and code chunk explaining my read operation.

 

In vybrid_TWRVF65GS10_a5.h

#ifndef BSPCFG_ENABLE_TTYB

    #define BSPCFG_ENABLE_TTYB              1

#endif

/*

** Interrupt-driven TTY device (UART1)

** MGCT: <option type="bool"/>

*/

#ifndef BSPCFG_ENABLE_ITTYB

    #define BSPCFG_ENABLE_ITTYB             0

#endif

/*

** TTYB and ITTYB baud rate

** MGCT: <option type="number" min="0" max="115200"/>

*/

#ifndef BSPCFG_SCI1_BAUD_RATE

    #define BSPCFG_SCI1_BAUD_RATE             4800

#endif

/*

** TTYB and ITTYB buffer size

** MGCT: <option type="number" min="0" max="256"/>

*/

#ifndef BSPCFG_SCI1_QUEUE_SIZE

    #define BSPCFG_SCI1_QUEUE_SIZE             256

#endif

 

#if BSPCFG_ENABLE_TTYC

  #define BSP_DEFAULT_IO_CHANNEL                        "ttyb:"

  #define BSP_DEFAULT_IO_CHANNEL_DEFINED

  #else

  #define BSP_DEFAULT_IO_CHANNEL                        NULL

  #endif

 

#ifndef BSP_DEFAULT_IO_OPEN_MODE

    #define BSP_DEFAULT_IO_OPEN_MODE                      (void *) (/*IO_SERIAL_XON_XOFF |*/ IO_SERIAL_TRANSLATION /*| IO_SERIAL_ECHO*/)

#endif

 

 

In my source file :

 

MQX_FILE_PTR port_dev = NULL;

  char text [256]={0};

  uint32_t len=sizeof(text);

bool disable_rx = FALSE;

   int32_t baud = 4800;

   int32_t result;

   int32_t ser_opts = IO_SERIAL_NON_BLOCKING;

 

 

   port_dev = fopen(NMEA_PORT_CHANNEL, BSP_DEFAULT_IO_OPEN_MODE);

   result = ioctl(port_dev, IO_IOCTL_SERIAL_SET_FLAGS, &ser_opts);

   result = ioctl(port_dev, IO_IOCTL_SERIAL_DISABLE_RX, &disable_rx );

   result = ioctl(port_dev, IO_IOCTL_SERIAL_SET_BAUD, &baud);

 

while(1)

  {

     memset(text, 0,  len);

       result=fread(text,1,18, port_dev);

       text[result+1]='\0';

       printf("String received :%s\n",text);

  }

Outcomes