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

nrf51822 hanging sometimes in high current almost 250uA

nrf51822 production is sometimes hanging (no response) in high current state (almost 250 uA -> normally 20uA).

before this issue, there is similar issue about twi that waiting twi event sometimes hanged (not exactly same code, twi->ready ).

So I added watch dog timer , It resets after a watchdog period of time.

I thinks it is different issue.

As I searched, I suspected that It was in debug mode in high current. so I attach pull down resistor to swd_clk pin.

But it happens equally.

what should I start with?

Parents
  • Hi,

     

    nrf51822 production is sometimes hanging (no response) in high current state (almost 250 uA -> normally 20uA).

    before this issue, there is similar issue about twi that waiting twi event sometimes hanged (not exactly same code, twi->ready ).

    So I added watch dog timer , It resets after a watchdog period of time.

    I thinks it is different issue.

    As I searched, I suspected that It was in debug mode in high current. so I attach pull down resistor to swd_clk pin.

    Debug mode shall draw more than 250 uA, so it is likely something else.

    Q1: How are your pins configured? If a pin has a pull resistor, and there is something external keeping the pin active, it can draw around 200 uA (VDD_NRF / 13k = ~230uA at 3.0V) depending on your supply voltage.

    If there are several pins configured as input, which are floating, the same issue can occur.

    Q2: Is there nothing on the device that works as it should when this occurs? Have you tried to reproduce this in debug mode?

    Q3: Have you tried to look at the current consumption using a analyzer to see if the current draw is static or dynamic (ie: a timer that wakes up every x ms)?

     

    Kind regards,

    Håkon

Reply
  • Hi,

     

    nrf51822 production is sometimes hanging (no response) in high current state (almost 250 uA -> normally 20uA).

    before this issue, there is similar issue about twi that waiting twi event sometimes hanged (not exactly same code, twi->ready ).

    So I added watch dog timer , It resets after a watchdog period of time.

    I thinks it is different issue.

    As I searched, I suspected that It was in debug mode in high current. so I attach pull down resistor to swd_clk pin.

    Debug mode shall draw more than 250 uA, so it is likely something else.

    Q1: How are your pins configured? If a pin has a pull resistor, and there is something external keeping the pin active, it can draw around 200 uA (VDD_NRF / 13k = ~230uA at 3.0V) depending on your supply voltage.

    If there are several pins configured as input, which are floating, the same issue can occur.

    Q2: Is there nothing on the device that works as it should when this occurs? Have you tried to reproduce this in debug mode?

    Q3: Have you tried to look at the current consumption using a analyzer to see if the current draw is static or dynamic (ie: a timer that wakes up every x ms)?

     

    Kind regards,

    Håkon

Children
  • Q1. the production has two peripherals 1 spi,1 twi. and 1 input pin, 2 output pins. Are you talking about the pull resistor on swd_pin? or common input pin? 

    Q2. I try to check debug print with j-link, but It doesn't print anything.

    Q3. supply dc voltage only

    I assume stack overflow. Can you check this .map file and config 

    keil i used

    Total RO Size (Code + RO Data) 80340 ( 78.46kB)
    Total RW Size (RW Data + ZI Data) 7616 ( 7.44kB)
    Total ROM Size (Code + RO Data + RW Data) 80416 ( 78.53kB)

    arm_startup.s file

    Stack_Size 2048

    Heap_Size 2048

    Stack + Heap + Rw Size =  11,712 

    My device has 16KB RAM, softdevice use 8KB RAM.

    I think Ram should be need over almost 19KB. Is it right?

  • So. I change my config heap size -> 0, stack size-> 0x600, but this issue still occur. 

    *.map file

    ...
    .heap 0x200036b8 0x0
    0x200036b8 __HeapBase = .
    0x200036b8 __end__ = .
    0x200036b8 PROVIDE (end, .)
    *(.heap*)
    .heap 0x200036b8 0x0 _build/nrf51422_xxac_gcc_startup_nrf51.S.o
    0x200036b8 __HeapLimit = .

    .stack_dummy 0x200036b8 0x600
    *(.stack*)
    .stack 0x200036b8 0x600 _build/nrf51422_xxac_gcc_startup_nrf51.S.o
    0x20003fe8 __StackTop = (ORIGIN (RAM) + 0x2000)
    0x200039e8 __StackLimit = (__StackTop - SIZEOF (.stack_dummy))
    0x20003fe8 PROVIDE (__stack, __StackTop)
    0x00000001 ASSERT ((__StackLimit >= __HeapLimit), region RAM overflowed with stack)
    OUTPUT(_build/nrf51422_xxac.out elf32-littlearm)

    my application using ram size is 0x200036b8 - 0x20001fe8= 0x16D0

    my *.ld file 

    MEMORY
    {
    FLASH (rx) : ORIGIN = 0x1b000, LENGTH = 0x25000
    RAM (rwx) : ORIGIN = 0x20001fe8, LENGTH = 0x2000
    }

    ram size + stack + heap size = 0x16D0 + 0x600 + 0 = 0x1CD0 < 0x2000

    Can you find any problem? 

  • _maibi said:
    RAM (rwx) : ORIGIN = 0x20001fe8, LENGTH = 0x2000

     LENGTH should be 0x2018 (you have 0x4000 bytes of total RAM).

     

    _maibi said:

    ram size + stack + heap size = 0x16D0 + 0x600 + 0 = 0x1CD0 < 0x2000

    Can you find any problem? 

    If you have a stack overflow, you should be able to read out the SP when debugging.

    If using gdb, you can send the "mon regs" command to read all the CPU registers.

    Have you checked the call stack trace when the issue occurs?

     

    Kind regards,

    Håkon

Related