implementing custom service

product details:

nRF52840 custom board

nRFConnectSDK 2.2.0

we want to implement custom service interacting with the Android app.

Where we will receive on command from Android app and we will do some processing and sending the data back to the android app.

For this what and all we need to do.

for ex: service

what characteristics and what descriptors are needed and their properties.

All we need to know is how to write custom service and for our requirement what we need to add.

Parents Reply
  • Hi 

    with NRF tool box it works fine.

    Now this peripheral UART we want to port to other application (which we were discussing in private ticket.).

    Now my team head want this app to be ported to our app and also the android app to support this.

    Can we suggest the steps to be proceeded to create android app to handle this(we may do it from scratch or already we have some app and we want to add this.)

    Usually there will be commands sent on RX characteristic and will receive the data from nRF.

Children
  • For the android app, it is mostly up to you.

    However, we have the source code for the nRF Toolbox open source: https://github.com/NordicSemiconductor/Android-nRF-Toolbox. You can use this as inspiration.

  • Hi,

    As you know was busy with serail recovery testing did not spend time on this.

    Now on DK i am able to test the peripheral UART using nRF Tool box.

    In peripheral UART we are using 

    # Enable the UART driver
    CONFIG_UART_ASYNC_API=y
    CONFIG_NRFX_UARTE0=y
    CONFIG_SERIAL=y
    now my query is initially i want to port this to our custom board with CDC_ACM.
    also we have the UART implemented and custom driver is used where we are able to communicate to UART and get the data also.
    Still we need CONFIG_NRFX_UARTE0=y with CDC_ACM interface to iMX and also UART interface?
  • We are talking about multiple devices now.
    Are you able to make a drawing of communication lines here, so I do not misunderstand?

  • we have two different products where in 1 it goes as USB CDCACM.

    In another we have UART interface. In this we want to tap the data to BLE connected to Android app/ios app. In the same we want UART communication to iMX.

    Ofcourse currently testing this with laptop instead of iMX where UART driver send data to COM(testing with tera term). Final thing will be iMX.

    Is this both possible in single application. Currently as you suggested we are in process to move UART method to serial recovery method. But before that making our code work with BLE over UART has become priority. So requesting this in paralllel to other ticket.

    adding to the above query, UARTE is taking uart0 i think.

    Just now found nelw lines from:

    config NRFX_UART0
        bool "UART0 driver instance"
        depends on $(dt_nodelabel_has_compat,uart0,$(DT_COMPAT_NORDIC_NRF_UART))
        select NRFX_UART

    config NRFX_UARTE
        bool

    config NRFX_UARTE0
        bool "UARTE0 driver instance"
        depends on $(dt_nodelabel_has_compat,uart0,$(DT_COMPAT_NORDIC_NRF_UARTE))
        select NRFX_UARTE

    C:\ncs\v2.2.0\zephyr\modules\hal_nordic\nrfx\kconfig

    So will uart0 is available for BLE and also COM/shell connection.

    for shell/data communication we are using below"

    #define UART_DEVICE_NODE DT_CHOSEN(zephyr_shell_uart)
    struct device *uart_dev = DEVICE_DT_GET(UART_DEVICE_NODE);

    Peripheral UART uses:

    static const struct device *uart = DEVICE_DT_GET(DT_CHOSEN(nordic_nus_uart));
    Both can be used in same application?
    Sorry for multiple edits.
    I thought one thing, so added the UART code to BLEperipheral UART code which i tested on nRF52840 DK.
    On to the same I tested echo_bot code seperately to test serial code.
    ow I merged both, and see only BLE code works as it took over the UART first.
    In main.c the code in #if 1 ... #endif belongs to serial.
    Attaching here.BLEperipheraUART.zip
Related