Skip to content

nRF52: I2S causes 600uA extra power usage if bluetooth is off #2693

@gfwilliams

Description

@gfwilliams

This looks like a nRF52 hardware 'anomaly'. Doing something like this works fine:

NRF.setConnectionInterval(100); // set lower power connection. -> 60uA
// write some neopixel data - we're still using ~60uA on average
setInterval(function() {
  require("neopixel").write(Q3.sda, [0,1,2,3,4,5]);
}, 5000);

But now if you do NRF.sleep() then the next time the neopixel.write function is called, power usage jumps from 60uA to 600uA and stays there.

Tested on Jolt.js - but it seems like it's an issue on nRF52832 as well.

The following change actually fixes this:

--- a/targets/nrf5x/i2s_ws2812b_drive.c
+++ b/targets/nrf5x/i2s_ws2812b_drive.c
@@ -164,8 +164,12 @@ ret_code_t i2s_ws2812b_drive_xfer(rgb_led_t *led_array, uint16_t num_leds, uint8
        // as far in advance as it can.
        while (i2s_ws2812b_drive_flag_buffer_cnt < 5);
 
-    // finally, stop the output
-    nrf_drv_i2s_stop();
+       // finally, stop the output
+       nrf_drv_i2s_stop();
+
+       // USE_WORKAROUND_FOR_I2S_STOP_ANOMALY (anomaly 194) from SDK17 (SDK15 doesn't have this included)
+       *((volatile uint32_t *)(((uint32_t)NRF_I2S) + 0x38)) = 1;
+       *((volatile uint32_t *)(((uint32_t)NRF_I2S) + 0x3C)) = 1;
 
        // un-initialize i2s
        nrf_drv_i2s_uninit();

which was copied from SDK17. However after a while it causes some kind of system lockup and the chip halts, drawing 9mA - so this needs further investigation

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions