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

Jump to solution
1,000 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 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
Reply
1 Solution
810 Views
CommunityBot
Community Manager
This an automatic process.

We are marking this post as solved, due to the either low activity or any reply marked as correct.

If you have additional questions, please create a new post and reference to this closed post.

NXP Community!

View solution in original post

0 Kudos
Reply
2 Replies
811 Views
CommunityBot
Community Manager
This an automatic process.

We are marking this post as solved, due to the either low activity or any reply marked as correct.

If you have additional questions, please create a new post and reference to this closed post.

NXP Community!
0 Kudos
Reply
809 Views
VilemZ
NXP Employee
NXP Employee

Hi Manju,

Your code seems correct. And did you try jumper 23 and 24 connect by default settings? And then is it working?

Best Regards

Vilem