send data from ble to ble with UART

I'd like to know whether the cetnral get the data from peripheral or not.
I'm using UART, it connects mcu(stm32f4) to ble module (nrf52832) and ble module gets the sensed data.
Those data should be sent to other ble module (nrf52840) with NUS.
I'm checking the data is sent from nrf52832 (peripehral) to nrf52840 (central) with RTT viewer.
Using BLE in nrf connect program, I make the nrf52840 is central (adapter) and the nrf52832 is peripheral, after scanning and connecting.
I send the hex data in peripheral, such as 31 (0x31) in TX (Write) characteristic, I can see this value in RTT viewer, it is printed there.
Should I connect the j link to nrf52840 for checking if the sent data is writtien to it or not?
I don't know how to know it.

Also, what should I do if I want to send the data from central to peripheral?

And, is it correct that using UART/NUS for sending the data from ble to another ble? it should be bidirectional (read and write).

  • Of course! :) Just keep in mind that if the questions diverge from the question in the original ticket it is better to open up a separate ticket for this question, so that other domain-expert Nordic engineers can work on it in parallel.

    Thanks!

    The unmodified example actually already has separate event handlers for the BLE UART and the Hardware UART - which is the bt_receive_cb and uart_cb respectively.

    I don't use zephyr, but I can understand and I've solved it by seperating the event handle. Nus event handle and uart event handle are initialized in service init function, and define ble_nus_string_send. 

    It was confusing because I'd like to watch the sent data with serial monitor (pc) that is connected with uart lol, uart with mcu, uart with ble, and uart with pc :( 

    Anyway, I can send the data from app, and the ble is receiving it and it is shown in RTT viewer. Also, that data is sent to mcu, either, I can watch it on serial monitor. 

    Now, I can send the data from nrf connect app to ble, the reverse sequence (sending the data from mcu to ble, and app) isn't work, even though the notify is enable. It is a different issue, I'll open other thread after I'm trying to solve it :) 

  • Bi_ said:
    I don't use zephyr, but I can understand and I've solved it by seperating the event handle. Nus event handle and uart event handle are initialized in service init function, and define ble_nus_string_send. 

    Ah, my apologies for the incorrect assumption. I am glad to read that the understanding carried over to the nRF5 SDK application nevertheless, great! :) 

    Bi_ said:
    It was confusing because I'd like to watch the sent data with serial monitor (pc) that is connected with uart lol, uart with mcu, uart with ble, and uart with pc :( 

    Hehe, yes, there is a lot of UART going on.. Perhaps it could be helpful to read through the ble_app_uart example documentation, to better the understanding?
    In essence, the device hardware UART peripheral communicates with the serial terminal on your pc. Additionally, it transmits whatever it receives in its communication with the PC, to its connected peer device, as well as echoing whatever it receives from the connected peer device over BLE to the serial terminal on the computer, through the hardware UART connection.

    Bi_ said:
    Anyway, I can send the data from app, and the ble is receiving it and it is shown in RTT viewer. Also, that data is sent to mcu, either, I can watch it on serial monitor. 

    So it now works as intended, great!
    I notice that you view it in RTT Viewer, did you change the outputting of the data received over BLE to instead be output by the logger over RTT?

    Bi_ said:
    the reverse sequence (sending the data from mcu to ble, and app) isn't work, even though the notify is enable. It is a different issue, I'll open other thread after I'm trying to solve it :) 

    This works in the unmodified example - what changes have you made to the application, on either side of the BLE link?

    Best regards,
    Karl

Related