Simple radio connection (example)

Dear,

I have 2 kits nRF52-DK and nRF52840-DK. I want to make simple app for sending data from one kit to another. Is it possible to use only the radio without using BLE stack?

E.g in TX side I want to call function like sendMyPayload(uint8_t *data, uint8_t size) and on the RX side I would call  function StartRX and when RX done the IRQ lets me know about it and then I call getRxPayload(...)

I suppose it is possible to do something like that. I could not find any similar example. What do you think is the easiest way to the goal?

I am new in Nordic world :-)

Thank you for your advices. Jan

  • Hello Jan,

    I am new in Nordic world :-)

    Welcome! :) 
    Please do not hesitate to ask if anything should be unclear - we are happy to help!
    If you are just getting started with Nordic development, and the nRF Connect SDK in particular, I would highly recommend checking out this Fundementals course over at the DevZone Academy - it's a great place to start!

    If I could ask, what is the reason for not wanting to use the provided Bluetooth stack?
    The SoftDevice/SoftDevice Controller is one of the big benefits for choosing Nordic products, since it lets you focus on your application development through taking care of all the radio usage for you.
    Making a working proprietary radio protocol is quite the workload, and so I would highly recommend making use of the tools we already provide for this.
    If you still would like to use the radio manually, you can take a look at these bare-metal examples - the radio_tx and radio_rx - which shows how you can use the radio directly, thought it is not an approach that I would recommend for anyone just getting started with development of wireless devices.

    Other than that, the Peripheral UART example (emulated UART over BLE) does pretty much exactly what you ask describe - the only difference is that it collects its input from the UART peripheral, but you can remove this part and instead use the bt_nus_send for the purpose you describe directly.

    Best regards,
    Karl

  • Hi Karl,

    Thank you for fast and detailed answer! 

    reason for not wanting to use the provided Bluetooth stack?

    1) I need simple app where data for sending will have only a few bytes (BLE is maybe unnecessary).

    2) I thought when I use only radio, the solution would be much more simple and development will be much faster.

    3) We need fast response - it means e.g. when button is pushed on TX side, on RX side should LED light as fast as possible.

    Actually the app is like: TX simple data when button is pushed, and call some function when data are RXed on RX side.

    What do you think? Would you still recommend me to use whole BLE stack?

    Thank you! Jan.

  • If you use ESB (see link in my previous reply) then your RX side can turn on the LED less than 1ms after you have pushed a button on the TX side. You can also achieve high data throughput (~164KB/s).

    In 1 second, I can send this amount of data, with ACK from RX side (but no payload).

    2552 x 1 byte payload => 2 KB/s
    2360 x 8 byte payload => 18 KB/s
    1893 x 32 byte payload => 59 KB/s
    1210 x 100 byte payload => 118 KB/s
    668 x 252 byte payload => 164 KB/s

  • Hello,

    witc said:
    Thank you for fast and detailed answer! 

    No problem at all, I am happy to help!

    witc said:
    1) I need simple app where data for sending will have only a few bytes (BLE is maybe unnecessary).

    Will your application only ever communicate against a specific device that you yourself has made?
    BLE might seem like an 'overkill' to send only a couple of bytes every now and then, but you likely will end up doing less work yourself if you use the BLE stack implementation that we have already created for you.

    witc said:
    2) I thought when I use only radio, the solution would be much more simple and development will be much faster.

    I would think the fastest approach is to use the tools we have already implemented and tested/verified for you, instead of having to do any of this work yourself.

    witc said:
    3) We need fast response - it means e.g. when button is pushed on TX side, on RX side should LED light as fast as possible.

    The lowest possible Connection Interval in BLE is 7.5 ms, which then would be the worstcase latency for the time that a button-press notificaiton is 'waiting' to be sent (not including processing time on both ends of the link).

    witc said:
    Would you still recommend me to use whole BLE stack?

    It depends - as Tim mentions you can shave off a couple of ms by not using BLE, so if this is paramount to your application then it might be the best way forward.
    If this is not the case, and a 7.5 ms latency is acceptable for your use-case, then I would definitively recommend using our provided BLE implementation to do this for you instead.

    The BLE implementation will also take care of things like retransmission in case a packet is not acknowledged, etc. for you, since this is part of the BLE specification.

    Best regards,
    Karl

Related