HW PWM disturbance

Hi!

I'm developing for nrf52832 using zephyr. I'm using the nordic hal driver in order to use the PWM with EasyDMA. The PWM is used to control a piezo buzzer. The PWM is working and to my understanding the CPU should not be able to interfere when using the PWM with EasyDMA. But we are having some typ of interference. If I have the BLE enabled the sound of the buzzer is a bit "blurry" but if I disablde the BLE or lowering the advertising interval (BT_GAP_ADV_SLOW_INT_MIN, BT_GAP_ADV_SLOW_INT_MAX) the sound is better.

Regardless of the settings on the BLE, once every 7-8 second i get like a interruption on the buzzer, just like something are interfering.

Is there something that can interfere with the PWM using EasyDMA?

Best regards Jonas

Parents
  • Hi!

    The Bluetooth stack will request the HFXO when it uses the RADIO, so you might see some small jitter when HFCLK changes between HFINT and HFXO.

    You can call this function below to request HFXO to be used all the time, and see if you see any changes:

    int clocks_start(void)
    {
    	int err;
    	int res;
    	struct onoff_manager *clk_mgr;
    	struct onoff_client clk_cli;
    
    	clk_mgr = z_nrf_clock_control_get_onoff(CLOCK_CONTROL_NRF_SUBSYS_HF);
    	if (!clk_mgr) {
    		LOG_ERR("Unable to get the Clock manager");
    		return -ENXIO;
    	}
    
    	sys_notify_init_spinwait(&clk_cli.notify);
    
    	err = onoff_request(clk_mgr, &clk_cli);
    	if (err < 0) {
    		LOG_ERR("Clock request failed: %d", err);
    		return err;
    	}
    
    	do {
    		err = sys_notify_fetch_result(&clk_cli.notify, &res);
    		if (!err && res) {
    			LOG_ERR("Clock could not be started: %d", res);
    			return res;
    		}
    	} while (err);
    
    	LOG_DBG("HF clock started");
    	return 0;
    }

Reply
  • Hi!

    The Bluetooth stack will request the HFXO when it uses the RADIO, so you might see some small jitter when HFCLK changes between HFINT and HFXO.

    You can call this function below to request HFXO to be used all the time, and see if you see any changes:

    int clocks_start(void)
    {
    	int err;
    	int res;
    	struct onoff_manager *clk_mgr;
    	struct onoff_client clk_cli;
    
    	clk_mgr = z_nrf_clock_control_get_onoff(CLOCK_CONTROL_NRF_SUBSYS_HF);
    	if (!clk_mgr) {
    		LOG_ERR("Unable to get the Clock manager");
    		return -ENXIO;
    	}
    
    	sys_notify_init_spinwait(&clk_cli.notify);
    
    	err = onoff_request(clk_mgr, &clk_cli);
    	if (err < 0) {
    		LOG_ERR("Clock request failed: %d", err);
    		return err;
    	}
    
    	do {
    		err = sys_notify_fetch_result(&clk_cli.notify, &res);
    		if (!err && res) {
    			LOG_ERR("Clock could not be started: %d", res);
    			return res;
    		}
    	} while (err);
    
    	LOG_DBG("HF clock started");
    	return 0;
    }

Children
No Data
Related