Which Central code can I use to exchange data considering the Peripheral code presented in the course?

Hello everyone,

I'm taking the "Bluetooth Low Energy Fundamentals" course For all the examples I followed in the training, from what I understood, we loaded the peripheral code on the nRF52840 board and needed the App on the cell phone to simulate the Central.

https://academy.nordicsemi.com/courses/bluetooth-low-energy-fundamentals/lessons/lesson-4-bluetooth-le-data-exchange/topic/blefund-lesson-4-exercise-1/

In this case, would there be a Central code that could be placed on the board? To test with two nRF52840 boards.

An nRF52840 board as central and another nRF52840 board as peripheral.

I would just like to send different types of data between two nRF52840 boards. Thanks.

Parents
  • Hello,

    So in that particular lesson we are using the LBS service (Led Button Service). We don't have a central application for this particular service in NCS. We did have one in the nRF5 SDK (the old "legacy" SDK), but it may not be worth the trouble installing that and getting familiarized with it just to get a central sample for the LBS up and running (that is up to you). 

    If you want to, it is possible to create this service, but we do not have any Devacademy courses showing how to set up central applications. At least not at this point in time. 

    However, there is nothing special about this service (LBS), apart that we have a separate mobile app that interacts with this particular service. If you want to set up a central-peripheral pair, I can recommend trying out the peripheral_uart and central_uart samples. They will connect to one another, and they will have a "tunnel", using the "Nordic UART Service". The way that works is that the peripheral has one Service with two Characteristics. One for sending and one for receiving. The peripheral uses the function bt_nus_send() to send an array of data, and the central uses bt_nus_client_send() to send data the other way.

    Perhaps this is something that you can use?

    Best regards,

    Edvin

  • Hello Edvin, Thank you for your support. I will focus my efforts on learning from these examples you mentioned. I believe that a topic about Central implementation would help a lot, another interesting topic would be BLE Mesh implementation. Thanks

  • Hello,

    Thank you for the feedback. Yes, ideally we would cover everything in these courses, but they take time to make. But more will come, so feedback on topics are good. 

    The Bluetooth course on DevAcademy basically builds up the peripheral_uart sample from scratch, but we did take parts of the peripheral_lbs sample in to demonstrate a few concepts at an earlier stage in the course. But if you complete the course, you should recognize quite a lot from the peripheral_uart sample in the end (at least the BLE part of the sample). 

    As for the central, it should be possible to follow the code from the sample. Basically, the flow is to start scanning, search for the particular service (service discovery) and set up how the central will use that service. 

    Let me know if you are stuck.

    Best regards,

    Edvin

  • Hello Edvin,

    1) About course, I'm happy that Nordic will continue creating the trainingsI myself am excited to create content about implementation using Nordic boards.

    2) About the course in DevAcademy, I'm stuck in Exercise 4.1.
    I can copy the code and put in code prior, compile and flash, work well. But, same studying the pages (GATT operations, Services and characteristic and Attribute table) of the training, I still don't understand how mount the bytes (attributes) to create the service and characteristic.

    In the exercise the representation to button characteristic is
    0x00001523, 0x1212, 0xefde, 0x1523, 0x785feabcd123
    is segmented in 5 parts, but in page Services and characteristics, is demonstrated the are 4 parts (Handle, Type(UUID), Permissions, Value). I'm confused.

    I'm looking forward to getting to exercise 4.3, to check the Nordic UART Service (NUS)

    3) About Central.
    In other test, I got the Central and Peripheral generic codes and was able to flash them on different cards. I was able to scan on the Central side; and also do advertising on the Peripheral side; and connect both. Now I need to be able to transfer data between the two boards.

Reply
  • Hello Edvin,

    1) About course, I'm happy that Nordic will continue creating the trainingsI myself am excited to create content about implementation using Nordic boards.

    2) About the course in DevAcademy, I'm stuck in Exercise 4.1.
    I can copy the code and put in code prior, compile and flash, work well. But, same studying the pages (GATT operations, Services and characteristic and Attribute table) of the training, I still don't understand how mount the bytes (attributes) to create the service and characteristic.

    In the exercise the representation to button characteristic is
    0x00001523, 0x1212, 0xefde, 0x1523, 0x785feabcd123
    is segmented in 5 parts, but in page Services and characteristics, is demonstrated the are 4 parts (Handle, Type(UUID), Permissions, Value). I'm confused.

    I'm looking forward to getting to exercise 4.3, to check the Nordic UART Service (NUS)

    3) About Central.
    In other test, I got the Central and Peripheral generic codes and was able to flash them on different cards. I was able to scan on the Central side; and also do advertising on the Peripheral side; and connect both. Now I need to be able to transfer data between the two boards.

Children
  • Higo said:
    3) About Central.
    In other test, I got the Central and Peripheral generic codes and was able to flash them on different cards. I was able to scan on the Central side; and also do advertising on the Peripheral side; and connect both. Now I need to be able to transfer data between the two boards.

    I am glad to hear. This is a quite versatile example, and it can easily be changed to suit your need.

    Higo said:
    In the exercise the representation to button characteristic is
    0x00001523, 0x1212, 0xefde, 0x1523, 0x785feabcd123
    is segmented in 5 parts, but in page Services and characteristics, is demonstrated the are 4 parts (Handle, Type(UUID), Permissions, Value). I'm confused.

    I think you got it a bit mixed up. The 5 segments make up the entire UUID alltogether. The UUID is 128 bit, (so that is 4 bytes + 2 bytes + 2 bytes + 2 bytes + 6 bytes = 16 bytes = 128 bits)

    If you follow the tutorial strictly, it should be correct. Please let me know where (on what step) you are stuck if it doesn't work.

    BR,

    Edvin

Related