This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

regarding uart with 4800 baud rate

hello i am trying to interface RN8209c ic with nrf52832 using uart communication with sdk 15.2 

uint8_t readbuf[50];

uint32_t err_code;sdk_config.txt


uint8_t buf[10];
buf[0]=0x7f;
uint8_t buf_len=0;
uint8_t buf_r[10];
nrf_drv_uart_config_t cfg = NRF_DRV_UART_DEFAULT_CONFIG;

cfg.baudrate = UART_BAUDRATE_BAUDRATE_Baud4800;
cfg.hwfc = NRF_UART_HWFC_DISABLED;
cfg.pselrxd = 13;
cfg.pseltxd = 14;
cfg.use_easy_dma = false;
cfg.parity = true;
ret_code_t ret;
nrf_drv_uart_init(&app_uart_inst, &cfg, NULL);
nrf_drv_uart_rx_enable(&app_uart_inst);
err_code=nrf_drv_uart_rx(&app_uart_inst, readbuf, 50);

if (err_code != NRF_SUCCESS)
{
NRF_LOG_ERROR("Failed initializing rx\n");
printf("Failed initializing rx\n");
}
nrf_drv_uart_tx(&app_uart_inst,(uint8_t*) buf, 1);
nrf_drv_uart_rx(&app_uart_inst, (uint8_t*)buf_r, 4);

printf("%x\n",buf_r[0]);
printf("%x\n",buf_r[1]);
printf("%x\n",buf_r[2]);
printf("%x\n",buf_r[3]);

my code got stuck in first nrf_drv_uart_rx line and i have attached my sdk_config file and i have checked my tx rx pins that is working fine

can someone tell me?

thanks and regards

manikandan v

Parents Reply Children
  • yes,but when i use app_uart_put  to send my tx value i can get the excepted value of rx but only one byte i want to get all my rx values using this nrf_drv_uart_rx(&app_uart_inst, (uint8_t*)buf_r, 4);  my sensor will give maxium values of 4 bytes at a time

  • It is still unclear to me if your sensor is transmitting this 4 bytes and the nRF UART is not receiving them? 

    If your sensor is still transmitting only 1 byte (similar to your use case of app_uart_put, then nrf_drv_uart_rx will not change that. And you will not get an event from uart unless you get those 4 bytes from the receiver. I would still like to see that the issue you are seeing is in fact in the Nordic side and not at the peer side. This I can only be sure if I can see that your peer is transmitting 4 bytes but nRF is not able to receive them. Can you please check if you can attach some pin sniffing logs so that I can see what the peer sent?

Related