nRF_SDK_17.1.0 s140 pca10056 BLE_UART

Hello all,

I am trying to develop an application where the user will input some specific commands i.e hex value of 0x01 via a mobile application and then via bluetooth this command will be passed to the computer using UART.

I have compiled the ble app uart on my nrf52840 but i am struggling to modify the code for my application.

Could someone help me with this ? 

Thanks

Kleanthis

Parents
  • Hello Karl,

    Yes i can elaborate on what my issue is. 

    I would like to develop a firmware that as soon as the user enters the command 0x01 (hex) in a mobile application that will be connected with bluetooth to enable a function called ACTIVATE_DEVICE and that will send in UART the following command. That command will be written in the function on_write and called from the main script.

    I have started with the example of ble_app_uart and modified that accordingly. Please see attached the ble_nus.c , ble_nus.h and the main script where i call the function

     

    Could you please have a look and let me know your thoughts on this ? 

    Thanks 

    Kleanthis

  • Hello Kleanthis,

    Thank you for elaborating, this makes your issue a lot easier to understand.
    From the provided description I do not immediately see the need to modify the BLE NUS service directly to achieve the activation command.
    Would it be an option to just use the unmodified BLE NUS service, check the contents of incoming packets, and set the DEVICE_ACTIVATED variable in case the 0x01 command is received?
    In essence, you would do this as part of the NUS event handler in main.c, before the received data is passed to app_uart_put.

    In the shared screenshots I notice that you have commented out swaths of code from the ble_nus.c file. Do you intend to keep the original BLE NUS service functionality alongside the ACTIVATE command, or are you primarily concerned with forwarding these hex commands?
    If you do not intend to keep the original NUS functionality I would recommend that you go through the Service Tutorial instead. The tutorial goes through the theoretical and practical aspects of how to set up a custom service and characteristic - which might be what you are after, in this case.

    On a general note I would also recommend that you share code here in the forum using the Insert -> Code option, instead of screenshots. This makes the code a lot easier to read and understand for others.

    Best regards,
    Karl

Reply
  • Hello Kleanthis,

    Thank you for elaborating, this makes your issue a lot easier to understand.
    From the provided description I do not immediately see the need to modify the BLE NUS service directly to achieve the activation command.
    Would it be an option to just use the unmodified BLE NUS service, check the contents of incoming packets, and set the DEVICE_ACTIVATED variable in case the 0x01 command is received?
    In essence, you would do this as part of the NUS event handler in main.c, before the received data is passed to app_uart_put.

    In the shared screenshots I notice that you have commented out swaths of code from the ble_nus.c file. Do you intend to keep the original BLE NUS service functionality alongside the ACTIVATE command, or are you primarily concerned with forwarding these hex commands?
    If you do not intend to keep the original NUS functionality I would recommend that you go through the Service Tutorial instead. The tutorial goes through the theoretical and practical aspects of how to set up a custom service and characteristic - which might be what you are after, in this case.

    On a general note I would also recommend that you share code here in the forum using the Insert -> Code option, instead of screenshots. This makes the code a lot easier to read and understand for others.

    Best regards,
    Karl

Children
No Data
Related