This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Timer with a constant and stable period

Hello!

I am trying to sample a digital signal with 12-bits (In a later stage I will need to sample two 12-bits signals). At the moment I am storing the recorded signal in an SD card, but the final goal is to send it via BLE. For this purpose, I was using an interrupt triggered by a timer, but the signal is not being correctly sampled:

Input:

Output:

I configured a GPIO pin to go high when entering the timer interrupt routine and low when leaving it. The measured timing profile is shown next:

As seen, the period is not stable. Searching here in the forum, I found that for a timer with a constant and stable period we should use PPI. But I don't see how to configure the PPI to read the GPIO_IN register. Could anyone guide me on how to do it?

Alternatively, is there any other way to perform a periodic task with a constant and stable period?

Parents
  • Thank you for the response, Karl.

    What I don't get is what task should I configure the PPI to perform to read the GPIO_IN register. Other peripheral have TASK registers, but not the GPIO. Also, the sampled value should be stored in an array for later SD card storage or BLE transmission. Any idea how could it be done?

  • Oh, I understand - what you are looking for then is the GPIOTE peripheral which is GPIO with tasks and events. The reason for this compartmentalization is so that you could achieve lower power consumption in the case that you only need to toggle GPIO's, without actually needing the tasks and events part.

    Thiago said:
    Also, the sampled value should be stored in an array for later SD card storage or BLE transmission. Any idea how could it be done?

    Storing in an array might fill up your RAM, depending on how much you will be storing between each transfer.
    Regarding storing to flash we have got some libraries for this, namely fstorage and FDS which you could look into using. We have also got examples demonstrating the usage of the FDS library and the fstorage library which could be helpful to have a look at to see how this could be done.

    Best regards,
    Karl

Reply
  • Oh, I understand - what you are looking for then is the GPIOTE peripheral which is GPIO with tasks and events. The reason for this compartmentalization is so that you could achieve lower power consumption in the case that you only need to toggle GPIO's, without actually needing the tasks and events part.

    Thiago said:
    Also, the sampled value should be stored in an array for later SD card storage or BLE transmission. Any idea how could it be done?

    Storing in an array might fill up your RAM, depending on how much you will be storing between each transfer.
    Regarding storing to flash we have got some libraries for this, namely fstorage and FDS which you could look into using. We have also got examples demonstrating the usage of the FDS library and the fstorage library which could be helpful to have a look at to see how this could be done.

    Best regards,
    Karl

Children
No Data
Related