Re: Seeed BLE Micro (nrf51822) hangs on k_msleep

Matias N.

sorry for the delay. I just tried your suggestion and it does not seem to make a difference. As I mentioned, on debugging it seems to be halted at the WFI instruction. From my understanding, there should be an interrupt firing via the RTC but this is not happening and the MCU does not get out of the WFI (I placed a breakpoint at the rtc1_nfr_isr) and it never reaches there.

I also tried to simply modify the in-tree board definition for BLE nano, changing the LED gpio pin and setting the appropriate UART pins for my board and then flashing the blinky sample. I got the same result of the LED staying fixed.

Furthermore, the board came with nordic's UART/BLE demonstration firmware and this works (I can bind from my phone) so I would rule out defective hardware.

I can't really understand what could be happening. Any idea on what I should try?


On Wed, Jun 10, 2020, at 21:42, Vinayak Kariappa wrote:
Hi Matias,

From the schematics posted in seedstudio website, indeed a 32KHz crystal is said to be present. You may always use the internal 32 KHz RC oscillator in nRF51 to check if the system timer is not the problem.

Enable the following to use RC Oscillator:

16MHz clock is essential for 2.4 GHz radio peripheral.


On Sat, Jun 6, 2020 at 5:31 AM Matias N. <matias@...> wrote:

I'm starting a project based on the BLE Micro module from Seeedstudio. Since this "board" was not supported but the RedBear BLE nano board is the most similar one, I created a custom board directory for it using this as a template. I managed to flash the blinky sample to the module (using openocd and a ST-Link v2 clone device) and can also connect with gdb to debug. I have this module soldered to a custom PCB which features a LED and thus I set the correct LED GPIO in the dts file. I managed to control the LED but from my debugging it seems to hang when calling k_msleep(). When it hangs, if I pause the execution it appears to be right after the "wfi" instruction (i'm assuming the debugger breaks the sleep).

I'm not sure why this could be happening. My guess it is something to do with the clock configuration. The module features a 32.768hz crystal (just like the BLE Nano) but also a 16 MHz crystal (which I'm not sure is used or not by zephyr). I tried disabling tickless, but the behavior does not change.

As I'm new to zephyr I'm not quite sure what else to check. Googling for this problem I found old issues in GitHub relating to tickless mode, low-power, rtc, etc. But all seem to be merged/closed. I would appreciate any help in this.


Join to automatically receive all group messages.