Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

pca10028 disconnects immediately when trying to connect using ble_app_uart

Can anyone tell me if there is a specific problem on the nFR 51 using the 12.3 DK, where a disconnect is seen when it connects? I'm using Android Lolipop 5.0 on a BLU device. I see the disconnect immediately after selecting the nordic device in the selection dropdown, so it does see the device.

I have read that the 51 had problems, and it wasn't clear if the 52 also has the same problem, or if this is similar with a timeout not being set at the start?

The project I'm working on will use the 52 and I'm thinking of just buying one, but before I do I wanted to find out if this is a common problem with 51 and 52 devices? Isolated to 51? Neither, an error in the ble_app_uart example?

I'm going to get the sniffer setup tonight and see what I see, but I'm using Linux so it requires some jumping through a couple hoops to get the nRF sniffer going...:(

Any help would be appreciated. Eventually I need to get a 52 board, but was trying to use this until the firmware iscomplete, that will be based around your 52 chipset. I'm not doing that portion, I'm on the software side.

The firmware engineer is on vacation, so I'm trying to get going in the meantime. AFAIK, I have the example built and flashed properly to the pca10028 device I'm using.

I'm attempting to use the UART profile with 32 bytes of data.

Compiler:
arm-none-eabi-gcc (GNU Tools for Arm Embedded Processors 7-2018-q2-update) 7.3.1 20180622 (release) [ARM/embedded-7-branch revision 261907]

flash:
[aland@eagle armgcc]$ pwd
/home/aland/src/nRF5_12.3.0/examples/ble_peripheral/ble_app_uart/pca10028/s130/armgcc
[aland@eagle armgcc]$ make flash
Flashing: _build/nrf51422_xxac.hex
nrfjprog --program _build/nrf51422_xxac.hex -f nrf51 --sectorerase
Parsing hex file.
Erasing page at address 0x1B000.
Erasing page at address 0x1B400.
Erasing page at address 0x1B800.
Erasing page at address 0x1BC00.
Erasing page at address 0x1C000.
Erasing page at address 0x1C400.
Erasing page at address 0x1C800.
Erasing page at address 0x1CC00.
Erasing page at address 0x1D000.
Erasing page at address 0x1D400.
Erasing page at address 0x1D800.
Erasing page at address 0x1DC00.
Erasing page at address 0x1E000.
Erasing page at address 0x1E400.
Erasing page at address 0x1E800.
Erasing page at address 0x1EC00.
Erasing page at address 0x1F000.
Erasing page at address 0x1F400.
Erasing page at address 0x1F800.
Erasing page at address 0x1FC00.
Erasing page at address 0x20000.
Erasing page at address 0x20400.
Erasing page at address 0x20800.
Applying system reset.
Checking that the area to write is not protected.
Programming device.
nrfjprog --reset -f nrf51
Applying system reset.
Run.

OS:
Ubuntu 18.04 (bionic beaver)

Alan

Parents
  • I'm not sure what happened but I replied a couple days ago and don't see it here now...hmmm...

    Anyway, Edvin, I got the 52 but see the same thing...I suspect I should try with a different version of Android, but wanted to get your thoughts?

    I'm using Lolipop 5.0.

    I'm only using nRF Logger so far, but will get the nRF Sniffer setup.


    nRF Logger Output

    --------------------------

    nRF Connect, 2018-08-09
    No name (30:90:3F:2E:2C:67)
    V 15:36:21.248 Connecting to 30:90:3F:2E:2C:67...
    D 15:36:21.249 gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE) (hidden)
    V 15:36:39.933 Cancelling connection...
    D 15:36:39.933 gatt.disconnect()
    I 15:36:39.937 Disconnected
    D 15:36:39.951 [Callback] Connection state changed with status: 0 and new state: DISCONNECTED (0)
    D 15:36:39.958 gatt.refresh() (hidden)
    D 15:36:41.286 [Callback] Connection state changed with status: 0 and new state: DISCONNECTED (0)
    D 15:36:41.289 gatt.refresh() (hidden)
    D 15:37:33.377 gatt.close()
    D 15:37:33.379 wait(200)
  • Did you try the .hex file that I told you to test? 

    The reason that the file that you are trying to flash doesn't work is because it is a serialization application. It is not what you are looking for.

  • Edvin,

    [aland@eagle hex]$ pwd
    /home/aland/src/nRF5-15/examples/ble_peripheral/ble_app_hrs/hex
    [aland@eagle hex]$ nrfjprog -f nrf52 --program ./ble_app_hrs_pca10056_s140.hex --sectorerase
    Parsing hex file.
    Erasing page at address 0x0.
    Erasing page at address 0x1000.
    Erasing page at address 0x2000.
    Erasing page at address 0x3000.
    Erasing page at address 0x4000.
    Erasing page at address 0x5000.
    Erasing page at address 0x6000.
    Erasing page at address 0x7000.
    Erasing page at address 0x8000.
    Erasing page at address 0x9000.
    Erasing page at address 0xA000.
    Erasing page at address 0xB000.
    Erasing page at address 0xC000.
    Erasing page at address 0xD000.
    Erasing page at address 0xE000.
    Erasing page at address 0xF000.
    Erasing page at address 0x10000.
    Erasing page at address 0x11000.
    Erasing page at address 0x12000.
    Erasing page at address 0x13000.
    Erasing page at address 0x14000.
    Erasing page at address 0x15000.
    Erasing page at address 0x16000.
    Erasing page at address 0x17000.
    Erasing page at address 0x18000.
    Erasing page at address 0x19000.
    Erasing page at address 0x1A000.
    Erasing page at address 0x1B000.
    Erasing page at address 0x1C000.
    Erasing page at address 0x1D000.
    Erasing page at address 0x1E000.
    Erasing page at address 0x1F000.
    Erasing page at address 0x20000.
    Erasing page at address 0x21000.
    Erasing page at address 0x22000.
    Erasing page at address 0x23000.
    Erasing page at address 0x24000.
    Erasing page at address 0x25000.
    Erasing page at address 0x26000.
    Erasing page at address 0x27000.
    Erasing page at address 0x28000.
    Erasing page at address 0x29000.
    Erasing page at address 0x2A000.
    Erasing page at address 0x2B000.
    Erasing page at address 0x2C000.
    Erasing page at address 0x2D000.
    Erasing page at address 0x2E000.
    Erasing page at address 0x2F000.
    Erasing page at address 0x30000.
    Applying system reset.
    Checking that the area to write is not protected.
    Programming device.
    [aland@eagle hex]$

    Still I get nothing in any of the nRF Apps...nRF Connect nRF...Blinky nRF Logger

    Why don't I see my bluetooth?

    After I flashed the above I have only one LED, to the bottom left of the PCA10056 chip, none of the other 4 LEDs light up, but still I see no bluetooth on my Android BLU device. hmmm...???

    EDIT: I think that flash is working correctly in that Button 1 turns the single flashing LED off, and pressing it again will turn the single flashing LED back on. By default it gets power from VDD. I also tried the USB and plugged another cable into the micro USB for the nRF.

    There are 2 sets of VDD nRF pins on the header next to the nRF Power Source switch. Do those have any effect? I will try to look up the reference, I didn't get much with my DK, I know you have the info online. I want to look at what Li-Pro is for the Power Source. This was on VDD by default. The VDD is typically the Video Display Device, AFAIK I'm not sure how that relates to the power source but guess that comes from the ARM Cortex.

    Also there's a covered switch next to the power switch that says VEXT->nRF. I'm curious what this switch does, but probably nothing I need.

    Still the $64k question, err...that would be 64,000 Euros to you, why don't I see the bluetooth device, but see both my iPhone and BLU phone? My BLU phone sees itself and 2 Apple device. Nothing else. Something is fundamentally wrong.

    Alan

  • Edvin,

    I should add that I tried to get the sniffer setup. Unfortunately I'm using Ubuntu 18.04 and the document here was written for 14.04. I run into a problem compiling the wireshark tarball I downloaded along with the plugin. Eventually it tells me that I get an error because the code is not compiled for PIC. I've seen this on my last job and resorted to recompiling all of QT with PIC to resolve it. I would hate to have to do that here because this 52840 is only being used to prototype this project, my colleague will be using the nRF 52 in the device.

    This will not be an easy resolve on 18.04, which I have on my desktop and laptop at the moment. I could probably install 14.04 if all this could compile and work with the sniffer. Please let me know if this is the case, as far as Nordic knows?

    Has anyone else seen the issue on PIC code, where the default QT libs are using PIE?

    The other piece that seems to be tripping me up, and this could be why is that by default 18.04 uses qt5, yet it seems the wireshark needs qt4. I tried to set that as the default on my system, but compiling wireshark is still trying to use qt5 when it is configured for qt4. This might related to PIC/PIE, not sure. I just know that the system QT libs do not have PIC on them and it's needed for most embedded devices.

    Alan

  • Edvin,

    Holy Crap Batman, the BLU device was sitting for a while and the light had been turned off. I turned it off and back on, the single light started to flash, but more importantly it showed up on the SCANNER tab for nRF Connect as NORDIC_HRM and I was able to connect and am connected now.

    Still curious why I don't see it most of the time and/or if it's because of the mode I was in...AFAICT, there is nothing changed on it from when it ships. I have both micro USBs plugged into my hub, and the nRF Power Source is set for VDD.

    My single light is on, but not flashing when I'm connected.

    I haven't built this nRF Connect, it's the one I downloaded from Google Play, so my next step is to be able to build one of the apps I can load on the BLU device to connect and get data from the 52840.

    Still unclear why it magically showed up and/or if I reboot the BLU device if it will still be able to see it.

    This is good, although I'm not out of the woods, I am at least able to see and connect to the device as would be expected.

    I believe I have the combined .hex file loaded which includes the SD, that you mention above.

    What app would you recommend to start with?

    I still do not see the device in nRF UART v2.0, but I am connected from nRF Connect.

    EDIT: I disconnected and I can see the device in nRF Connect, but it won't connect again. Here's the log from the device:

    nRF Connect, 2018-08-16
    Nordic_HRM (ED:37:1C:68:45:6C)
    I 19:44:05.201 [Server] Server started
    V 19:44:05.219 Heart Rate (0x180D)
    - Heart Rate Measurement [N] (0x2A37)
       Client Characteristic Configuration (0x2902)
    - Body Sensor Location [R] (0x2A38)
    - Heart Rate Control Point [W] (0x2A39)
    Unknown Service (0000aaa0-0000-1000-8000-aabbccddeeff)
    - Unknown Characteristic [N R] (0000aaa1-0000-1000-8000-aabbccddeeff)
       Client Characteristic Configuration (0x2902)
       Unknown Descriptor (0000aab0-0000-1000-8000-aabbccddeeff)
       Characteristic User Description (0x2901)
       Characteristic Presentation Format (0x2904)
    - Unknown Characteristic [I W WNR] (0000aaa2-0000-1000-8000-aabbccddeeff)
       Client Characteristic Configuration (0x2902)
    User Data (0x181C)
    - First Name [R W] (0x2A8A)
    - Last Name [R W] (0x2A90)
    - Gender [R W] (0x2A8C)
    V 19:44:05.648 Connecting to ED:37:1C:68:45:6C...
    D 19:44:05.648 gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE) (hidden)
    D 19:44:25.678 [Callback] Connection state changed with status: 0 and new state: DISCONNECTED (0)
    I 19:44:25.678 Disconnected
    D 19:44:25.685 gatt.refresh() (hidden)
    D 19:45:04.969 gatt.close()
    D 19:45:04.971 wait(200)
    V 19:45:05.173 Connecting to ED:37:1C:68:45:6C...
    D 19:45:05.173 gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE) (hidden)
    D 19:45:25.148 [Callback] Connection state changed with status: 0 and new state: DISCONNECTED (0)
    I 19:45:25.148 Disconnected
    D 19:45:25.156 gatt.refresh() (hidden)
    D 19:50:21.585 gatt.close()
    D 19:50:21.588 wait(200)
    V 19:50:21.791 Connecting to ED:37:1C:68:45:6C...
    D 19:50:21.792 gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE) (hidden)
    D 19:50:41.818 [Callback] Connection state changed with status: 0 and new state: DISCONNECTED (0)
    I 19:50:41.818 Disconnected
    D 19:50:41.826 gatt.refresh() (hidden)
    D 19:50:57.564 gatt.close()
    D 19:50:57.567 wait(200)
    V 19:50:57.769 Connecting to ED:37:1C:68:45:6C...
    D 19:50:57.769 gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE) (hidden)
    D 19:51:17.745 [Callback] Connection state changed with status: 0 and new state: DISCONNECTED (0)
    I 19:51:17.745 Disconnected
    D 19:51:17.752 gatt.refresh() (hidden)
    D 19:51:31.841 gatt.close()
    D 19:51:31.842 wait(200)
    V 19:51:32.045 Connecting to ED:37:1C:68:45:6C...
    D 19:51:32.046 gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE) (hidden)
    D 19:51:52.071 [Callback] Connection state changed with status: 0 and new state: DISCONNECTED (0)
    I 19:51:52.071 Disconnected
    D 19:51:52.081 gatt.refresh() (hidden)
    I got it connected again...not sure why it doesn't show up sometimes...any ideas? Or why it connects sometimes and not others as noted above?
    Here's the full log:
    nRF Connect, 2018-08-16
    Nordic_HRM (ED:37:1C:68:45:6C)
    I 20:02:21.614 [Server] Server started
    V 20:02:21.635 Heart Rate (0x180D)
    - Heart Rate Measurement [N] (0x2A37)
       Client Characteristic Configuration (0x2902)
    - Body Sensor Location [R] (0x2A38)
    - Heart Rate Control Point [W] (0x2A39)
    Unknown Service (0000aaa0-0000-1000-8000-aabbccddeeff)
    - Unknown Characteristic [N R] (0000aaa1-0000-1000-8000-aabbccddeeff)
       Client Characteristic Configuration (0x2902)
       Unknown Descriptor (0000aab0-0000-1000-8000-aabbccddeeff)
       Characteristic User Description (0x2901)
       Characteristic Presentation Format (0x2904)
    - Unknown Characteristic [I W WNR] (0000aaa2-0000-1000-8000-aabbccddeeff)
       Client Characteristic Configuration (0x2902)
    User Data (0x181C)
    - First Name [R W] (0x2A8A)
    - Last Name [R W] (0x2A90)
    - Gender [R W] (0x2A8C)
    V 20:02:22.106 Connecting to ED:37:1C:68:45:6C...
    D 20:02:22.107 gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE) (hidden)
    D 20:02:23.785 [Server callback] Connection state changed with status: 0 and new state: CONNECTED (2)
    I 20:02:23.787 [Server] Device with address ED:37:1C:68:45:6C connected
    D 20:02:23.793 [Callback] Connection state changed with status: 0 and new state: CONNECTED (2)
    I 20:02:23.793 Connected to ED:37:1C:68:45:6C
    D 20:02:23.808 [Broadcast] Action received: android.bluetooth.device.action.ACL_CONNECTED
    V 20:02:23.855 Discovering services...
    D 20:02:23.855 gatt.discoverServices()
    D 20:02:25.163 [Callback] Services discovered with status: 0
    I 20:02:25.164 Services discovered
    V 20:02:25.192 Generic Access (0x1800)
    - Device Name [R W] (0x2A00)
    - Appearance [R] (0x2A01)
    - Peripheral Preferred Connection Parameters [R] (0x2A04)
    - Central Address Resolution [R] (0x2AA6)
    Generic Attribute (0x1801)
    - Service Changed [I] (0x2A05)
       Client Characteristic Configuration (0x2902)
    Heart Rate (0x180D)
    - Heart Rate Measurement [N] (0x2A37)
       Client Characteristic Configuration (0x2902)
    - Body Sensor Location [R] (0x2A38)
    Battery Service (0x180F)
    - Battery Level [N R] (0x2A19)
       Client Characteristic Configuration (0x2902)
    Device Information (0x180A)
    - Manufacturer Name String [R] (0x2A29)
    D 20:02:25.193 gatt.setCharacteristicNotification(00002a05-0000-1000-8000-00805f9b34fb, true)
    D 20:02:25.197 gatt.setCharacteristicNotification(00002a37-0000-1000-8000-00805f9b34fb, true)
    D 20:02:25.202 gatt.setCharacteristicNotification(00002a19-0000-1000-8000-00805f9b34fb, true)
    D 20:03:03.943 [Broadcast] Action received: android.bluetooth.device.action.ACL_DISCONNECTED
    I 20:03:03.950 Disconnected
    D 20:03:03.967 [Callback] Connection state changed with status: 0 and new state: DISCONNECTED (0)
    D 20:03:03.968 [Server callback] Connection state changed with status: 0 and new state: DISCONNECTED (0)
    I 20:03:03.968 [Server] Device disconnected
    D 20:03:03.983 gatt.refresh() (hidden)

    Alan

  • Hello,

    Good news that you managed to connect to it. If you are able to connect once, but not again, it may mean that there is some bonding information stored on one device, but not on the other. Try to remove the device from your phone settings. There should be something like "forget device" somewhere. Also completely erase your nRF and try to program it again. Then you should start from a fresh start.

     

    Most of our examples has an advertising timeout, typically set to 180 seconds. After this, the device will go into sleep mode, but it will typically wake up on a button press. I say typically, since it is defined in the source code, so it may vary between the different examples.

     

    Since you have got it up and running, I suggest that you can try the ble_app_uart example. How to test it is described here.

    Please remember to program the softdevice first, before flashing the project. You should use the PCA10056 project folders, since you have the nRF52840, and the S140 softdevice.

    You only need to attach the usb cable to the connector on the short side of the board. The other one is only used in our USB examples.

     

    Good luck, and best regards,

    Edvin

Reply
  • Hello,

    Good news that you managed to connect to it. If you are able to connect once, but not again, it may mean that there is some bonding information stored on one device, but not on the other. Try to remove the device from your phone settings. There should be something like "forget device" somewhere. Also completely erase your nRF and try to program it again. Then you should start from a fresh start.

     

    Most of our examples has an advertising timeout, typically set to 180 seconds. After this, the device will go into sleep mode, but it will typically wake up on a button press. I say typically, since it is defined in the source code, so it may vary between the different examples.

     

    Since you have got it up and running, I suggest that you can try the ble_app_uart example. How to test it is described here.

    Please remember to program the softdevice first, before flashing the project. You should use the PCA10056 project folders, since you have the nRF52840, and the S140 softdevice.

    You only need to attach the usb cable to the connector on the short side of the board. The other one is only used in our USB examples.

     

    Good luck, and best regards,

    Edvin

Children
  • Edvin,

    What I have noticed is that if I leave the 52840 running for a long time, it doesn't seem to broadcast it's bluetooth properly and if I see it in the nRF Connect, it won't connect. A power cycle will alleviate that problem and it will connect. This Android doesn't like something about the device running for a long time. I had it running for about a week, but will make sure I power cycle it frequently. The other thing is I need to think about getting a more recent Android device.

    My next goal will be to see if I can setup a heart rate with a frequency that I could get a UART packet (32 bytes)  of data from the nRF52840. Somewhere I saw an Android App that was scrolling data on the screen, maybe that was a video of ble_app_uart, I can't remember...

    Alan

  • As I said:

    Most of our examples has an advertising timeout, typically set to 180 seconds. After this, the device will go into sleep mode, but it will typically wake up on a button press. I say typically, since it is defined in the source code, so it may vary between the different examples.

     

  • Edvin,

    Sorry to drop absent on this issue, I had a death in the family and had to take care of a few things in regard to it.

    I haven't forgot about this project, and will be revisiting it soon.

    My initial goal will be to send and receive a BLE packet using the ble_app_uart example. You had recommended a place that would be good to insert code for that, I'll have to read through this thread again. Thanks for your help, sorry to drop off the radar for a bit...but I haven't forgot about this.

    Alan

  • My condolences. 

    Yes. I suggest that you initially try the unmodified ble_app_uart example on the DK, and use e.g. Termite to write something to the DK via the UART, and see that it is received when you connect to it via nRF Connect either for Desktop or the mobile app.

    Then you can try to replace the data with whatever you want to send using the ble_nus_data_send() or ble_nus_string_send() (depending on what SDK version you use).

    Best regards,

    Edvin

  • Thanks Edvin, I will do just this but need about a week at least to get some things off my plate after getting back to work. This is a personal project with a friend who is doing the hardware, and will be using the 52 chipset. This reply of yours will definitely help, I will look at those functions.

Related