Sending data over BT

Hi,

I'm hoping you can help.

I am using the CENTRAL_UART and PERIPHERAL_UART to evaluate the nRF52840, and using a terminal program works fine.

What I want to do is press a button on the CENTRAL and once received at the PERIPHERAL turn on an LED.

I have code for detecting the button press which works.

When I try and send data from the CENTRAL the board appears to reset (as I get *** Booting Zephyr OS build v3.3.99-ncs1 *** on the terminal) although the data is received at the PERIPHERAL.

The code I have added is this:-

            err = bt_nus_client_send(&nus_client, "1234567890\r", 11);
            if (err) {
                LOG_WRN("Failed to send data over BLE connection"
                    "(err %d)", err);
                printf("Failed to send data over BLE connection button\n"
                    "(err %d)", err);                  
            }

            err = k_sem_take(&nus_write_sem, NUS_WRITE_TIMEOUT);
            if (err) {
                LOG_WRN("NUS send timeout");
                printk("NUS send timeout button\n");
            }
As you can see I am sending a fixed string of 1234567890. None of the 'err' checks generate an error.
Any pointers in the right direction would be greatly received.
Best Regards
Paul Mercer
Related