TWR-VF65GS10 uart1 read operation failing in MQX

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

TWR-VF65GS10 uart1 read operation failing in MQX

跳至解决方案
781 次查看
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 项奖励
1 解答
591 次查看
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 项奖励
2 回复数
592 次查看
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 项奖励
590 次查看
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