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

nRF52832 communication with Linux Gateway running BlueZ (NUS and GATT via Python)

The Situation:    I am having a Sensor Node that is based on the nRF52832 (S132) and does two things: advertise some sensor data and store sensor data to the internal flash. To collect the data I am having a Linux based gateway that is based on a Raspberry Pi 4B and is running BlueZ. I need the backend to do four things a) collect the advertisement data, b) download the logged data from the nRF52832 in periodic intervals, c) send settings to the nRF52832 like the sensor sampling frequency and d) perform an update of the firmware/application code on the nRF52832. The software running on the gateway can be freely chosen, but needs to be able to be used in production, has to be scriptable and must be accessible from a CLI, preferably from the Shell or Python. There is no nRF5 based Dongle or DK available on the gateway. 

The Questions:    There are a bunch of tools, both mentioned in the nRF Connect SDK and on GitHub, however - their purpose is not always entirely clear and I could not sort it out alone. In addition there are community based projects that seem to be mentioned fairly often in the devzone (e.g. pygatt). What is the preferred / Nordic recommended way fulfill my objectives on the linux gateway.

a) This can be achieved with the HCITool from BlueZ and works. 

b) The logged data consists basically of entire flash pages that need to be transferred page by page to the gateway over GATT and the Nordic UART Service. What is the best way to use the NUS on Linux over BlueZ. Is there a sample project available that covers the nRF52832 as peripheral and a linux machine with BlueZ as central?

c) From my understanding this should be fairly comparable to c) and also use the NUS. 

d) Updating the application code on the nRF52832 is not high priority, however, if there is a solution out there that can handle this as well, I am happy for explanations of tools and their relation to my other objectives.

Thanks, bchwtz

  • Hello,

    I'm sorry for the delayed response on this. I will take a look at it later today/tomorrow

    Best regards,

    Simon

  • Based on your text (if I've understood you correctly) you don't want to control BLE from the Raspberry Pi (which BlueZ can help you with). It seems like you want to send data from the nRF52 to the Raspberry Pi (advertising data and logged data), send data the other way (settings like sensor sampling frequency) and also perform an update of the firmware/application code on the nRF52832.

    In order to send data forth and back, you could just use standart UART communication and write a custom python program with grabSerial or pySerial (or another module) on the Raspberry Pi to send, receive and store the data. 

    The approach to perform a DFU update depends on the firmware on the nRF52. If you're using the nRF5 SDK, you should look here and here. If you're using the nRF Connect SDK, take a look at this link.

    If anything is unclear, please ask and I will elaborate.

    Best regards,

    Simon

Related