Unable to force use of external 32M HFXO using S132 SDK v7.0.1

I am using v7.0.1 S132 SDK on the nRF52832 processor for BlueTooth Light coded in Segger.

I have a high speed output (50uS) to drive an external device using an internal timer (timer[3]).

There seems to be jitter on the GPIO output.

Many posts seem to refer to forcing the use of the external 32MHz crystal using sd_clock_hfclk_request();

But querying the state using sd_clock_hfclk_is_running(p_is_running); never returns true.

I know the HF clock is running because I'm using the 16MHz clock for the timer (and using the radio to send BLE pkts).

How do I know which clock (INT or XO) is being used?

How do I force it to use the external 32MHz crystal?

Parents Reply Children
  • Hi Vidar.

    Thankyou for your feedback, it has been very helpful.

    I am seeing very low jitter in the PWM which is less than 0.1%.

    This is good enough for us.

    BUT I need to use a timer to trigger the PWM at 100Hz

    This timer seems to have a 2% jitter on a 2MHz clock taken when the external clock is running.

    I have raised the ISR priority to 2 and it seem better (<2% jitter).

    I'm not sure if there is any other way to do that.

    Adrian.

  • Hi Adrian,

    I'm glad to hear that it accuracy has improved.

    anealca said:

    BUT I need to use a timer to trigger the PWM at 100Hz

    This timer seems to have a 2% jitter on a 2MHz clock taken when the external clock is running.

    Please correct me if I'm wrong, but I assumed you wanted this to be a continuous clock signal. If you want to start the PWM every "1/100hz" seconds to play a shorter sequence, then I would recommend you connect the timer to the PWM with PPI. The problem with using the timer interrupt to trigger the PWM task is that it will take the program several CPU cycles to enter the interrupt handler.

    Attached below is an example put together to test the accuracy here, and it seems to be OK. Please try to run this on your board to see if you  get the same result.

    Test code based on the ble_app_hrs example

    The waveforms I captured with my logic analyzer

    Vidar

Related