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

UART to BLE transfer Data Issue

Hi Sir, I’m working in an application with the demo board A to communicate via Bluetooth to the demo board B and send data between them. In the module I have to do send a data from demo board A to the demo board B and display it in the computer screen via UART, then I have to write a value in the computer and sent it back to the demo board A and display it in the computer screen via UART. Do you know how to seeting BLE Master/Slave mode and finish nRF51822's BLE pairing ? What steps do you suggest I should take? Please help! Thank you I want to transfer data using UART to BLE by Baud Rate 38400(using nRF51822).

  • Hi Billtest,

    I pasted the wrong answer from another case to your case earlier. I deleted it. Sorry about that.

    We have an example in our SDK that you can have a look. It's the experimental_ble_app_uart project where it acts as a peripheral and forward the data it receive on UART line to BLE and vice versa. You can test this with the nRFUART app on the phone.

    In your case you want to have nRF51 on both side, then you would need to implement the central as well. We also have an example for that, but it's not the official one. You can have a look here.

    Regarding bonding, you can have a look at the ble_app_hrs_c example where we trigger bonding right after doing service discovery.

  • Hi Hung Bui,

    Sorry! I have some question need you help. I have attached a black diagram.

    A board use S120 softDevice for BLE/Master. B board use S110 softDevice for BLE/Slave.

    I still can't work with nrf51 UART to BLE transfer Data. Do you know how to finish BT pairing from nRF51822 code? Can I change BT pairing PIN code?

    A board code : ble_app_uart_c_S120-master project B board code : experimental_ble_app_uart project

    image description image description

    Thanks, Billtest

  • Hi,

    I suggest you to take a look on the UART example with S110 first, understand how uart SERVICE is been used there.

    Now, pull out the essential stuff for UART Service over S120 and try to fit the UART service in s120, i guess there would be a sample application based on s120, i haven't checked this out though.

    Nextly, Once you scan and connected from S120 (master) device, the nus_handler will be responsible to get data from Slave(s110). I hope this make sense.

    To make pairing with security steps, try set flags for that in adv params to raise the pin security, do check for the valid and corresponding flag for it. And that should be done in both side, Master and on Slave side as well.

  • @billtest36: Have you made any changes to the example ? The error code telling that it is NRF_ERROR_NOT_SUPPORTED. I would suggest you to test first with: ble_app_hrs_c on the S120 side and ble_app_hrs on the S110 side. Let them connected and talk to each other to understand how the central and peripheral works. After that you can also try to use experimental_ble_app_uart on S110 interfacing with a PC and a phone/tablet, to know how them work and how UART data from the PC can be sent to the phone and vice versa.

    Then you can try to run the set up as in the figure you draw. If you still have the issue, could you add a breakpoint at line 660 and go step by step through to see which line of code give error 0x06

Related