Skip to content

nRF52: update from 0.33 -> 0.34 causes 500x idle-current #4597

Open
@perttierkkila

Description

@perttierkkila

For ultra-low power applications where all peripherials are disabled and usually under 1.5uA SystemON currents, update to 0.34 was a bad mistake which caused 600uA idle current. After debugging, something keeps requesting HF-clock.

I tried to check diffs between 0.33 and 0.34 and I can't find any changes related to nRF52-parts. The problem is caused under initAll()-code. I tried to dig that part also but no luck as it goes to compiler-part.

Example code:

func main() {
	arm.EnableIRQ(uint32(nrf.IRQ_RTC1)) // workaround to keep IRQs running, already fixed in dev

	led := machine.P0_20
	led.Configure(machine.PinConfig{Mode: machine.PinOutput})
	for {
		led.Set(nrf.CLOCK.HFCLKSTAT.Get()>>16 == 1)
		time.Sleep(10 * time.Millisecond)
		led.Low()
		time.Sleep(500 * time.Millisecond)
	}
}

Serial, GC and scheduler disabled, flashing with command:
tinygo flash -size=short -scheduler=none -gc=none -serial=none -target=pca10040 -programmer command main.go

Output:

  • 0.34: led blinks, current 600uA+ (led uses minimal current compared to HF-clock)
  • 0.33: no blinking, current under 1.5uA

Also tried to play with -opt values, no effect. Except -opt=0 which keeps current under 1.5uA but code is not running either. Any ideas which causes this issue?

Metadata

Metadata

Assignees

No one assigned

    Labels

    nRFNordic Semi

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions