NRF52840+Freertos+tickless no advertising lowpower err

I didn't use an external 32.768 crystal, the internal NRF_SDH_CLOCK_LF_SRC 0 I used。

NRF_SDH_CLOCK_LF_SRC 0

NRF_SDH_CLOCK_LF_RC_CTIV 16

NRF_SDH_CLOCK_LF_RC_TEMP_CTIV 2

NRF_SDH_CLOCK_LF_ACCURACY 1

When I don't start broadcasting, there is a 2 ms interval spike in current, as shown in the graph below

When I enable the broadcast its current is normal as shown in the figure below

Parents
  • static nrf_drv_pwm_t m_pwm0 = NRF_DRV_PWM_INSTANCE(0);


    static void buzzer_handler(nrf_drv_pwm_evt_type_t event_type)
    {
    if (event_type == NRF_DRV_PWM_EVT_FINISHED){
    nrf_drv_pwm_uninit(&m_pwm0);
    nrf_gpio_cfg_output(BUZZER_PIN_NUMBER);
    nrf_gpio_pin_clear(BUZZER_PIN_NUMBER);
    }
    }


    void BuzzerOn(void)
    {
    uint32_t err_code;

    nrf_drv_pwm_config_t const config0 =
    {
    .output_pins =
    {
    BUZZER_PIN_NUMBER | NRF_DRV_PWM_PIN_INVERTED, // channel 0
    NRF_DRV_PWM_PIN_NOT_USED, // channel 1
    NRF_DRV_PWM_PIN_NOT_USED, // channel 2
    NRF_DRV_PWM_PIN_NOT_USED, // channel 3
    },
    .irq_priority = APP_IRQ_PRIORITY_LOWEST,
    .base_clock = NRF_PWM_CLK_125kHz,
    .count_mode = NRF_PWM_MODE_UP,
    .top_value = 46,
    .load_mode = NRF_PWM_LOAD_COMMON,
    .step_mode = NRF_PWM_STEP_AUTO
    };

    // This array cannot be allocated on stack (hence "static") and it must
    // be in RAM (hence no "const", though its content is not changed).
    static uint16_t /*const*/ seq_values[] =
    {
    23
    };

    nrf_pwm_sequence_t const seq =
    {
    .values.p_common = seq_values,
    .length = NRF_PWM_VALUES_LENGTH(seq_values),
    .repeats = 0,
    .end_delay = 0
    };

    err_code = nrf_drv_pwm_init(&m_pwm0, &config0, NULL);
    // APP_ERROR_CHECK(err_code);
    if (err_code == NRFX_SUCCESS) {
    vTaskDelay(2);
    (void)nrf_drv_pwm_simple_playback(&m_pwm0, &seq, 270, NRF_DRV_PWM_FLAG_STOP);//响99ms秒停下来
    } else {
    nrf_drv_pwm_uninit(&m_pwm0);
    nrf_gpio_cfg_output(BUZZER_PIN_NUMBER);
    nrf_gpio_pin_clear(BUZZER_PIN_NUMBER);
    }
    }

    When I call the BuzzerOnfunction, the current anomaly appears, and the current anomaly does not occur until it is broadcast

  • err_code = nrf_drv_pwm_init(&m_pwm0, &config0, buzzer_handler);

    The error was copied above, and now it is correct

Reply Children
No Data
Related