Bluetooth Setting Changes when mainly using app core

Hello,

I am using the nrf5340. My project is quite large but running on the app core just fine.

Now, I have the problem that I want to adjust some BLE settings, like tx Power, connection intervall ecc. As I have read here, it is said that bluetooth is generally handled using the net core.

I cannot build my project on the netcore however since it is to large and needs a lot of periphery which is not trivial to access using the net core apparently. Also, I have not found a easy example or documentation on how to send data from the app to the net core (I thought of doing so, so I have all the periphery communication and processing on the app core, send the data to the net core and have the netcore transmit the data via ble).

My question now is: would that really be the best process to do so? My basic example on which I started building my project was the peripheral uart example, which does not seem to use the net core for bluetooth at all.

Thanks in advance,

Morandell Paul

Parents
  • Hi,

    Normally, the Bluetooth stack is split with the controller on the network core and the host on the application core. Most parameters can be configured from the application core via the Zephyr Bluetooth APIs. This include things like advertising interval, Tx power etc, and you do not need to do changes on the network core.

    My basic example on which I started building my project was the peripheral uart example, which does not seem to use the net core for bluetooth at all.

    If you build for the app core, the HCI rpmsg application (which contain the Bluetooth controller) is automatically added to the project as a child image. This is normally what you want to do. Then, just do the BT configuration in your application, just as you would have on a single core device. The API is the same. For an introduction to Bluetooth development you may want to look at the Dev Academy Bluetooth Low Energy Fundamentals course.

  • Ah ok, so I do not have to flash my code onto the net core as it was suggested here

    I have implemented the set_tx_power function from this example. I simply copy pasted the function definition with its dependencies as well as the includes and called the function after I have set up my bluetooth in the peripheral uart example. It does not change the tx power however.

    Do I need any further configs, or where could the issue be? 

    These are y Bluetooth configs

    # take the ble parameters from peripheral
    CONFIG_BT_GAP_AUTO_UPDATE_CONN_PARAMS=y
    CONFIG_BT_PERIPHERAL_PREF_MIN_INT=6
    CONFIG_BT_PERIPHERAL_PREF_MAX_INT=6
    CONFIG_BT_PERIPHERAL_PREF_LATENCY=0
    CONFIG_BT_PERIPHERAL_PREF_TIMEOUT=30
    
    CONFIG_BT_LL_SOFTDEVICE=y
    CONFIG_BT_LL_SW_SPLIT=y
    
    CONFIG_BT=y
    CONFIG_BT_PERIPHERAL=y
    CONFIG_BT_DEVICE_NAME="Nordic_UART_Service"
    CONFIG_BT_DEVICE_APPEARANCE=833
    CONFIG_BT_MAX_CONN=1
    CONFIG_BT_MAX_PAIRED=1
    
    # Enable the NUS service
    CONFIG_BT_NUS=y
    

  • You need the controller on the net core, but that is automatically added as a child image when you build a bleutooth application for the app cor eon the nRF5340. In some cases you may also need to modify the net core configuration, but not for the tasks you describe. You can take a look at the Bluetooth: HCI Power Control sample for how to control the Tx power via Zephyr APIs (on your app core application).

  • I was now able to change the default tx Power by adjusting the said value in C:\ncs\v2.4.0\zephyr\subsys\bluetooth\controller\kconfig

    config BT_CTLR_TX_PWR_ANTENNA
    	int "Set TX power (dBm)"
    	range -127 127
    	default 3
    	depends on !BT_LL_SW_SPLIT
    	help
    	  Request a TX power in dBm. The power level set will be equal to or
    	  less than the one requested, based on the values supported by the
    	  hardware used. Values outside the supported range will be set to the
    	  nearest supported value.
    	  The value set here represents the actual power level fed to the
    	  antenna. When a Front-End Module is used, gain values for the SoC and
    	  FEM are calculated automatically to guarantee the closest possible
    	  match to the value requested by the user at the RF output.

    It works, but I'm not sure if this is good practice. Could it be that I'll run in problems later on when doing it this way?

  • I don't expect you will run into problems, no. That approach only works with the SoftDevice controller, but that is the controller you should use and which is used by default in the nRF Connect SDK. Another thing that separates this from the power control sample is that the API there can set different Tx power on different connections etc, but if that is not relevant, then CONFIG_BT_CTLR_TX_PWR_ANTENNA works well.

Reply
  • I don't expect you will run into problems, no. That approach only works with the SoftDevice controller, but that is the controller you should use and which is used by default in the nRF Connect SDK. Another thing that separates this from the power control sample is that the API there can set different Tx power on different connections etc, but if that is not relevant, then CONFIG_BT_CTLR_TX_PWR_ANTENNA works well.

Children
Related