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

uart_event_handle method doesnt called to send a string

Hi,

I am trying to modify the multilink central example to send string to other board (peripheral)

I already did the UART configuration and in my tests I saw that when I sent a string by terminte the uart_event_handle method doenst called.

Are there any configuration for enable the uart interruption.

I think that the string must pass for this method (uart_event_handle), when I wrote the string in the termite and push enter

Can anyone help me?

Parents
  • So you want one central and several peripherals, right?

    In the ble_app_uart and ble_app_uart_c, you have the two functions ble_nus_string_send() and ble_nus_c_string_send(), respectively. They will take care of which link to send the string, by attaching the correct conn_handle (connection handle).

    The peripheral will eventually call sd_ble_gatts_hvx(...) from ble_nus_string_send(...), and the central will call sd_ble_gattc_write(...) from ble_nus_c_string_send(...) or from the led_status_send_to_all() in ble_app_multilink_central example.

    You must ensure that you call these functions, sd_ble_gatts_hvx() or sd_ble_gattc_write() once for each connection you are in, and with each connection's respective conn_handle.

    You can see one way this is done in the ble_app_multilink example. It has a buffer for queuing the send calls.

    I suggest you read what it says about the sd:ble_gattc_write() function either on infocenter, or in ble_gattc.h. There you will find some hints on what to do if your sending buffer fills up.

  • Hi Edvin..

    Thanks for all... I will study these functions.

    But for you undestand what I am doing.. I am changing the multlink example... (in this example the multi connections are done) but instead to send status led, I wanna to send string.

    I am trying add the ble_nus_c (uart example) in multilink example... but I am nor sure if this is the better way.

    In the uart example, there are only one connection, but in the multilink example there are many, and I am not achieving to adapt ble_nus_string_send() to send string to all multilink connections.

    Can you give a hint?

Reply
  • Hi Edvin..

    Thanks for all... I will study these functions.

    But for you undestand what I am doing.. I am changing the multlink example... (in this example the multi connections are done) but instead to send status led, I wanna to send string.

    I am trying add the ble_nus_c (uart example) in multilink example... but I am nor sure if this is the better way.

    In the uart example, there are only one connection, but in the multilink example there are many, and I am not achieving to adapt ble_nus_string_send() to send string to all multilink connections.

    Can you give a hint?

Children
  • I see,

    What you need to know, is that the ble_app_uart_c and the ble_app_multilink_central_c are looking for different service UUIDs in their application. The uart service is (of course) looking for the UART service, while the multilink is looking for the LBS service. You can find this in the ble_lbs_c.h file in the multilink example.

    You need to change this to look for, and enable notification on the correct service (NUS service), in order to receive notifications from the ble_app_uart chip.

    A starting point would be to change the function call in main(): lbs_c_init() with a corresponding nus_c_init function.

    Let us know if you get stuck.

    Edvin

Related