XIAO nRF52840 as Central Scanner, memory leak?

Hi All

I have a XIAO nrf52840 running as a BLE scanner in an BLE to Wifi gateway. The nRF picks up BLE advertisements, parses them for specific data then sends the data over serial to an ESP32 with an SD card, then on to an InfluxDB server.

I am using VS Code & PlatformIO for Windows 11, Arduino with the nrf52840 Bluefruit BLE library.

My issue is that after 3-6 hours of scanning the nRF appears to hang as data stops flowing to the ESP32. After a manual reboot it works fine again. I need it to run in a field for months at a time.

My thinking is that there is a memory leak here.

Two questions;
1/ is there a way I can extract the nRF52840 free memory at runtime, in software using Arduino, to monitor memory usage over time
2/ If I was to select an External debugger, would you recommend a jlink(clone), DAPLINK, or a nrf52840DK to provide visibility into the runtime memory usage?

Thanks
Dave

Hi there,
Sounds like a flow control issue, more than a buffering one to me?
WHat type of flow control between the Xiao and ESP serial ports? < have you tried to slow it down or speed it up? to see if you can duplicate it? 3-6 hours is a long time. Are you just collecting scan data or is there a connection happening on the BLE? (3-6 hours of scanning)
I have Jlink and a clone(no serial#) if you go that route you can use segger embedded studio,
and use this


and this;

Vs code and PLio the debugging works very, verywell for me…

This is how I am Rolling…

I have a DK but haven’t had to deploy it yet , but soon for the BLE coded phy 2Mbs connection.
I’ve seen arduino code that checked the size at runtime by writing a variable to the stack and reading the location back and comparing it with the malloc, YMMV
HTH
GL :slight_smile: PJ :v:

Hmm, No experience , I would go for the latest?
It’s been a long time , I did get the clone working, but remember a issue and ended up getting the unit in the picture on a discount. SO many tools(software) that work with it and jflash or J_link commander.
check out the link recently . someone was getting one going and I posted a ton of screen shots.
HTH
GL :slight_smile: PJ

for me the epiphany was being able to see and set variables in real time, with PLio and the Debugger.
breakpoints and single-step was helpful. :+1:

I wouldn’t recommend using a J-Link clone. Go for the real one!

You’ll get the great software and the excellent support.

The J-Link EDU Mini version is affordable.

1 Like

:grin: :+1: What He said…

Yep I agree, but that product is no longer available as Segger have discontinued it. I checked both the Segger and Digikey sites.

The entry level J-Link BASE Classic version is $398 euro.

So for hobby usage, what other options do we have available for debugging the nrf52840?

I have the ESP-PROG for the ESP32 debugging.

Dave

$60 bucs…GO! instock.
HTH
GL :slight_smile: PJ

Magic, done.

Thanks
Dave

1 Like