This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Accurate sample rate with ncs

Are there any examples of sampling something like an I2C bus at a constant sample rate? I have seen issues myself with the k_sleep and k_busy_wait not giving accurate delays. Tested with a salae logic analyser. I haven't tested the timings of the k_timer yet.

I have seen this https://github.com/zephyrproject-rtos/zephyr/issues/6498 when looking into the inaccuracy of the delay functions above

  • Ok got it working now, didn't know I needed to add this to ncs/nrf/subsys/spm/Kconfig as well make the change in spm.c

    config SPM_NRF_RTC0_NS
    	bool "RTC0 is Non-Secure"
    	default y

    Is there a reason there is manual changes needed in the SDK to enable RTC0 in the non-secure domain?

  • Glad to hear that you got it working.

    RonanB96 said:
    Is there a reason there is manual changes needed in the SDK to enable RTC0 in the non-secure domain?

    I do not have a good answer here, other than the inherited behavior from Cortex M33 core, as all peripherals reset value is secure mode. Since the modem requires you to be in non-secure mode in order to communicate with it, it is then normal that the application would also reside in this defined area. I'll input this to the developers as a feature request, ie: set most peripherals to non-secure.

     

    Kind regards,

    Håkon

  • Glad to hear that you got it working.

    RonanB96 said:
    Is there a reason there is manual changes needed in the SDK to enable RTC0 in the non-secure domain?

    I do not have a good answer here, other than the inherited behavior from Cortex M33 core, as all peripherals reset value is secure mode. Since the modem requires you to be in non-secure mode in order to communicate with it, it is then normal that the application would also reside in this defined area. I'll input this to the developers as a feature request, ie: set most peripherals to non-secure.

     

    Kind regards,

    Håkon

Related