k_msgq_get does not wait till the given timeout period

Hi,

I am using Echo bot example in nrf connect sdk v.2.0.2

I have connected my UART to BG95 module and i am able to send and recieve data

but , the problem is,

	uint8_t txdata[64] = "AT\r\n";
	print_uart(txdata);
	memset(tx_buf,0,MSG_SIZE);
  uint8_t ret;
	/* indefinitely wait for input from the user */
	while (ret = k_msgq_get(&uart_msgq, &tx_buf, K_TIMEOUT_ABS_MS(8000)) == 0) {
		printk("Echo:%s\r\n",tx_buf);
	}
  printf("while_ret:%d\n",ret);

when i run the above set, first time it works perfect, it waits for 8 secs as given and iam able to recieve the data,

but when i repeat the set for the second time, the k_msgq_get doesnot wait for the given 8 secs, it just execute once and then exits while loop.

What could be possibly wrong??

Related