How to connect my bluetooth peripheral uart example with 3rd party bluetooth applications

Hi everyone, I am quite newbee to nRF5340 and nRF ecosystem. Anyway, my goal is to talk with 3rd party application to receive positioning data over bluetooth and then I have to mirror these data to another MCU via UART. I modified peripheral uart example in way to send data received from BL to other MCU. This is working with nRF's own bluetooth serial application and other 3rd party bluetooth serial application, but whenever I try to connect my nRF5340 from 3rd party GNS applications, it could not connect. I don't know the reason and I am open to any suggestions. 

Thanks.

Parents
  • Hi,

    Can you explain a bit more? The third party device you are connecting to, is it a peripheral or a central? Which exact device is it? What sevice(s) does it have, are they standard ones and/or custom ones? And what about pairing/bonding?

    If you do not know the answer to these questions, and if the device is a peripheral, a good start could be to connect to it from nRF Connect for desktop, and do service discovery to see what services it provides.

    If you are not even able to connect, perhaps the third party device use whitelisting, or some other mechanism that prevents you from connecting? Would it be possible to put in in a pairing mode where it would advertise without a whitelist for a while (this is a common thing to do)?

  • Hello,

    1. I picked bluetooth/peripheral_uart example for my custom nRF5340 board.

    2. I modified UART in a way to would send received data from BL to my another MCU runs over board.

    3. I disabled Buttons in that example in a way that would accept pairing number default. ( you also need to press button to confirm whether pairing codes is true in nRF5340.

    4. I connect with nRFConnect Bluetooth Serial Interface and sent some words and It worked and also managed to send these words to my another MCU.

    5. I also tried with another bluetooth serial terminal in google play. It also worked.

    6. Then I started to evaluate my real goal.

    The real goal is, I downloaded LEFEBURE NTRIP Client app to my mobile phone to get GNSS positioning data and send the data over BLE to my peripheral device e.g my custom nrF5340 board.

    My phone could see Uart Nordic Servis as my device and whenever I try to connect my device from inside of app, it could not connect.

    I also downloaded another app like lefebure and but did not work.

    Is it clear enough ? Please let me know.

    Device is my phone Redmi 10 2022. Host Application : LEFEBURE NTRIP Client. I am not sure which one is central but both my phone device and app should be central as far as I know. You can also see available ble device from this application.

  • Hi,

    OK, so you have an nRF communicating with another MCU over UART, and that works. So it is the other way around, you are making the peripheral (nRF) and the central app on the phone you have not made. And it is not able to connect to the nRF. Is that correct?

    What does this app require to connect? A special device name in the advertising packet, a special service, or something else? Why does it not connect? Have you checked with a sniffer trace? If this is a proprietary solution then you might need a bit of reverse engineering in order to figure things out, but it could also be that it will be quite obvious.

    Even though I got this the wrong way in my previous post, the key point remains, and that is that you need to know what communication is expected between the peers. Once you know how this should work, you can start implementing.

  • I think you might understood wrong.


    There is one nrf5340 and another MCU. Only communication way between each other is UART.

    I used Bluetooth serial terminal both nRF Connect and other applications to connect with nRF5340 via bluetooth and I succed. I sent some words and from this Bluetooth Serial Ports to nRF5340 and mirrored it to my another MCU via UART. This is what is working.

    I do not know what app requires to connect and where would I get this info. 

    There are connection section where you can see available bluetooth device. I am picking my nRF5340 there and application trying to connect.

    What I saw is there should be Java code is running at backend and it is prompting an error like java.io.exception: read failed, socket might closed or timeout.

    My advertise packet in RF5340 is default packet comes with peripheral uart example and did not any modification.

    Should I also know the advertise package of application ?

    I did not sniff. I will try to do.

  • ismail_embedded said:
    I do not know what app requires to connect and where would I get this info. 

    If you did not make the app, you either need to sniff or do something else to observe it externally, or ask the manufacturer: I cannot assist with reverse engineering, though.

    ismail_embedded said:

    My advertise packet in RF5340 is default packet comes with peripheral uart example and did not any modification.

    Should I also know the advertise package of application ?

    If the nRF is peripheral, the nRF is advertising, and the phone is the central that should connect. You need to know this part though, or ask the app developer or mak your own app. The point is that there is an interface here which is not known, and you need to find a way to know how this should work, and that I can unfortnately not help you with.

  • http://lefebure.com/software/android-ntripclient/

    They mention here about Serial Port Profile, it is a thing should my android phone or nRF have ?

  • No, the serial port profile is a bluetooth classic concept. It does not exist in BLE.

Reply Children
Related