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

NUS with Scanner

I can scan beacons with Scanner. and can use NUS (ble_periperall\ble_app_uart ) to get connect with device.

My goal is to combine both application Have NUS Service to connect with Mobile and Scanner for scanning and sending beacon data to Uart.

After combining code, I can connect to device using Mobile. and Device also receives the beacon.

When when I connect with device it stops Scanner. I want to make connection to configure device and Scanner should also work at this time.

Thank You

Bivay   



  • Dear Edvin,

    Thanks for help I will debugging in code. but there is no "fatal error". code is running as expected after above error. This is found from log of start print. If I provide you my code can you please look for issue in it.

    My Goal is a Android mobile is connected to My NRF52840 device. This device scans the beacon continuously and transmit beacon data to Android Mobile in NUS.

    My problem is when scanning runs can't use NUS. and when use NUS can't use scan for beacon. Both scan and NUS runs independent perfectly. My goal is to run both simultaneously.

    Please find attachement. 

    I am using Segger Studio 4.20 as IDE.

    SDK: nRF5_SDK_16.0.0_98a08e2

    Please copy code in following folder : nRF5_SDK_16.0.0_98a08e2\examples\ble_peripheral

    Thank You

    Bivay

    ble_app_uart - v1.zip

     
  • bivay said:
    My problem is when scanning runs can't use NUS. and when use NUS can't use scan for beacon.

     Can you explain why you can't use them? What happens if you try to use NUS while scanning? And what happens if you try to scan while you use NUS?

  • I already described my issue, but once again:

    I am using the attached code with sdk16.0.0, extract to nRF5_SDK_16.0.0_98a08e2\examples\ble_peripheral.

    When this code starts, I get beacon data on RTT Viewer, and get advertisement in Android NRF Connect Application. When I press connect button on NRF Connect Application, New tab is opned and shows connected, but in this situation I didn't get beacon data on RTT viewer by Scanner Module. 

    Then, after some time in NRF Connect Application, Device get disconnect with following error:

    ERROR 8 (0x8) : GATT CONN TIMEOUT

    And then in RTT viewer I can see beacon data again.

    I can confirm that NRF52840 is not reset or reboot or hangs during this process.


    But when at event BLE_GAP_EVT_CONNECTED, if I stop scanning using sd_ble_gap_scan_stop(), NUS Bus works perfectly (Can't see beacon data on RTT viewer). and at event BLE_GAP_EVT_DISCONNECTED (when I disconnect manually from NRF Connect Application), when start scanning again, it scan and shows beacon data on RTT viewer.

    My problem is when scanning runs can't use NUS. and when use NUS can't use scan for beacon. Both scan and NUS runs independent perfectly. My goal is to run both simultaneously.

    Thank You 

    Bivay

  • Hello,

    I tested your project now. I am struggling to recreate the issues that you describe.

    Can you please confirm that

    1: You run this on an nRF52840 DK from Nordic (or do you use a 3rd party DK?)

    2: That you use the S140 softdevice from SDK16.0.0, and

    3: That you are using the project found in the folder pca10056\s140\ses ?

    The reason I ask about the folder is that I had to add the path to the nrf_ble_scan.h before I could compile.

    I was able to see the advertisements in the RTT log, to see the device advertising itself, to connect to it using nRF Connect for Mobile, and to send and receive data using the NUS service while I could see the RTT print of advertisements coming in all the time.

    If you still experience the issues that you describe:

    Confirm 1,2 and 3 above,

    Maybe you changed some files outside the project folder? Try to unzip the project that you sent me in an unmodified version of the SDK (download from nordicsemi.com and unzip, so that you know that it is not modified).

    If that doesn't help, please try to capture a sniffer trace, and monitor the log output from the application. Does it say anything other than the advertising reports?

    You can use nRF Sniffer to capture a sniffer trace.

    Best regards,

    Edvin

  • Dear,

    Thanks for your support.

    I didn't changed anything in sdk. This is fresh SDK.

    About your queries:

    1) My module is 3rd party module : cdebyte e73-2g4m08s1c. I used external 32.768kHz external crystal on P0.0 and P0.1.

    2) Yes I used s140.

    3) My path of project is : nRF5_SDK_16.0.0_98a08e2\examples\ble_peripheral\ble_app_uart - v1\pca10056\s140\ses

    some of my question about your testing:

    1) Have you tried my code and get both NUS and Scanner Working together. means able to send beacon data on NUS bus to mobile (this is not implemented in my code yet), if not could you check, please.

    2) Have you sent data from Mobile and seen in RTT viewer using NUS and at this time scanner is also working means seen beacon data in RTT Viewer.

    I will try to unzip SDK again and try my code.

    Thank You

    Bivay

Related