TWR-VF65GS10 uart1 read operation failing in MQX

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

TWR-VF65GS10 uart1 read operation failing in MQX

525 Views
manjug
Contributor III

Hi,

I have attached the document with register values before UART initialized and after initialized.

Jumper settings

J23: 1-2 and 3-4 connected(SCI1_TX to UART1_ELEV_TX and SCI2_TX to OpenSDA_RX)

J24:1-2 and 3-4 connected(SCI1_RX to UART1_ELEV_RX and SCI2_RX to OpenSDA_TX)

Read is not happening still on "ttyb:".UART1 RX pin is continuously fed with strings at 4800 baudrate , Parity:None, Stop bit:1 and No flow control.

below is the code:

#define NMEA_MAX_SIZE 256

#define NMEA_PORT_CHANNEL "ttyb:"

UART_task(){

bool disable_rx = FALSE;

   int32_t baud = 4800;

   int32_t result;

   int32_t ser_opts = IO_SERIAL_NON_BLOCKING;

   int32_t stop_bits=IO_SERIAL_STOP_BITS_1;

   int32_t data_bits=8;

   int32_t parity=IO_SERIAL_PARITY_NONE;


   nmea_port_dev = fopen(NMEA_PORT_CHANNEL,NULL);


   if(nmea_port_dev!=NULL){

   printf("dev pointer value:%d",nmea_port_dev);

   }


   ioctl(nmea_port_dev, IO_IOCTL_SERIAL_SET_FLAGS, &ser_opts);

   ioctl(nmea_port_dev, IO_IOCTL_SERIAL_DISABLE_RX, &disable_rx );

   ioctl(nmea_port_dev, IO_IOCTL_SERIAL_SET_BAUD, &baud);

   ioctl(nmea_port_dev, IO_IOCTL_SERIAL_SET_DATA_BITS,&data_bits);

   ioctl(nmea_port_dev, IO_IOCTL_SERIAL_SET_STOP_BITS,&stop_bits);

   ioctl(nmea_port_dev, IO_IOCTL_SERIAL_SET_PARITY,&parity);

  while(1)

  {

  memset(NMEA_text, 0,  NMEA_size);

  result=fread(NMEA_text,1,5, nmea_port_dev);//Trying to read length of 5

  if(result>0){

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

  write( nmea_port_dev, NMEA_text, strlen(NMEA_text) );

  fflush(nmea_port_dev);

  ioctl(nmea_port_dev, IO_IOCTL_SERIAL_WAIT_FOR_TC,NULL);

  memset(NMEA_text, 0,  NMEA_size);

  }

  else{

  write( nmea_port_dev, data_buffer, strlen(data_buffer) );

  }

}

}

0 Kudos
2 Replies

331 Views
alejandrolozan1
NXP Employee
NXP Employee

Hi,

Let me try that out and I will let you know my results.

Best Regards,

Alejandro

0 Kudos

331 Views
DavidS
NXP Employee
NXP Employee

Hi Manju,

I have the TWR-VF65GS10 Rev H hardware so one revision newer.  I do not have the Rev G version I suspect you have.

I first started with the default jumper settings where SCI1 going to OpenSDA interface and SCI2 going to elevator.

The attached code example (which can be used in MQX4.1.1 mqx/examples/io project) worked for both interface and I could send and receive to both terminals connected.

I then switched the jumpers so SCI1 went to elevator and SCI2 went to OpenSDA.  this test also worked.

Please be sure in your user_config.h that you have TTYB and TTYC set to "1".  Recompile RTOS, then MQX application and re-test.

At the end of the test I then call a modified version of your code and it too is working.

Please note I'm using IAR7.20, and the A5 processor.

Regards,

David

0 Kudos