This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

One central_uart communicate with two peripheral_uart

Hello,

I want to communicate one card nrf5340dk with 2 same card in using 'central_uart' and 'peripheral_uart' samples.

I have succeeded to establish the connection and send data.

But there is a problem : when i want to send the data to the two receivers. I can send the data with succeed, but after the central card reboots...

I juste wonder why...

I give you here a part of my key code and in attached my file main.c

for (;;) {

        /* Wait indefinitely for data to be sent over Bluetooth */
        struct uart_data_t *buf = k_fifo_get(&fifo_uart_rx_data,
                             K_FOREVER);

                err = bt_nus_client_send(&nus_client[0], buf->data, 1);

                if (err) {
            LOG_WRN("Failed to send data over BLE connection"
                "(err %d)", err);
        }

        err = k_sem_take(&nus_write_sem, NUS_WRITE_TIMEOUT);
        if (err) {
            LOG_WRN("NUS send timeout");
        }


                k_sleep(K_SECONDS(1));

                err = bt_nus_client_send(&nus_client[1], buf->data, 1);
                if (err) {
            LOG_WRN("Failed to send data over BLE connection"
                "(err %d)", err);
        }

        err = k_sem_take(&nus_write_sem2, NUS_WRITE_TIMEOUT);
        if (err) {
            LOG_WRN("NUS send timeout");
        }
    }

here the two send can be done, but after the system of the central card reboot...

Thanks for all responses,

best regards

Parents Reply Children
No Data
Related