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

nRF Mesh and UART

Hi,

I am currently working on a project in Mesh on nRF52840 DK.

I am using the mesh v3.1.0.

I wanted to send command from mobile app to particular node in the mesh and that particular node should send the same data via UART.

I am using light_switch_server code to make the mesh and get the command from the mobile app.

I am able to get the data from the mobile app and now I want to send it through UART from that particular node in the mesh.

Can anyone help me on how to address this issue and use UART from the mesh node to send the data.

Thanks & Regards,

Vibhu.

Parents
  • Hi,

    Are you sure you want Bluetooth Mesh? I'm not sure what you are trying to do here, could you give me more details? Do you want to print the data through UART or send it to another device?

  • To do this I think you only need uart_init() andnus_evt_handler from the sdk_coexist example. I would suggest you look at the UART part of the code in the sdk_coexist example.

  • There is a main.c and mesh_main.c in sdk_coexist example.

    The mesh_main.c contains all mesh related codes and main.c contains UART part.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    /**
    * Copyright (c) 2014 - 2018, Nordic Semiconductor ASA
    *
    * All rights reserved.
    *
    * Redistribution and use in source and binary forms, with or without modification,
    * are permitted provided that the following conditions are met:
    *
    * 1. Redistributions of source code must retain the above copyright notice, this
    * list of conditions and the following disclaimer.
    *
    * 2. Redistributions in binary form, except as embedded into a Nordic
    * Semiconductor ASA integrated circuit in a product or a software update for
    * such product, must reproduce the above copyright notice, this list of
    * conditions and the following disclaimer in the documentation and/or other
    * materials provided with the distribution.
    *
    * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
    * contributors may be used to endorse or promote products derived from this
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    I went through the code and I am guessing I need the below functions for UART,

    uart_init()

    uart_event_handle()

    services_init()

    nus_data_handler()

    So if I integrate these functions into mesh, I would be able to send data via UART from mesh is that right?

    Can you please take a look at the main.c and tell me whether I should add any other functions for this purpose?

    Thanks

  • You want to send data to another controller via UART inside the same node, right? Then yes, you only need to implement thos functions.

    No, you don't need to add other functions.

  •  I am trying to add those functions which you suggested, to mesh main.c and I included the path also in the preprocessor tab in project properties.

    When I build it I am getting a error.

    I think the .c file is not linking properly ?

    Any suggestions on how to solve this ? Should I include any macros or anything ?

    Edit: Which function is used to send or receive using UART ?

    Is it nrf_drv_uart_tx or app_uart_get ?

    Am a little confused. Please help

  • Hi,

    Have you imported the .c files into the project?

    For sending and receiving over UART, have a look at these functions:

    app_uart_get(..)

    app_uart_put(..)

    ble_nus_data_send(..)

Reply Children