nrfx timer read actual value

Hi

How can I readout the actual timer value on the fly? I use the timer in capture compare mode and like to read out the timer value.

nrfx_timer_clear(&m_pyq5848_timer); is to clear. Which function is to read?

Thanks a lot

Parents
  • Thanks. This works, but doesn't solve my problem.

    I set and reset an IO PIN in the IRQ to implement a single wire communication. I can't use the GPIOTE because I have to switch between Input and Output Config of this PIN. Now the problem is, that sometimes, the frame is corrupt when something in parallel is working on the nRF (GPIOTE, BLE Mesh, ...)

    I like to delete this frame by checking the complete time of this bit frame. Reading out the timer value (Timer1) after the last Bit doesn't fix the problem, I have the same timer value even in a frame which is too long. Maybe I need to check it with Systick or what do you suggest?

    Here is the Picture with the frames with timegaps:

    The green CH2 is the 10ms tick which start this timer

  • Hello again,

    Dominik Eugster said:
    This works, but doesn't solve my problem.

    No problem, let us look closer at the application and see what we can do!

    Dominik Eugster said:
    I set and reset an IO PIN in the IRQ to implement a single wire communication. I can't use the GPIOTE because I have to switch between Input and Output Config of this PIN. Now the problem is, that sometimes, the frame is corrupt when something in parallel is working on the nRF (GPIOTE, BLE Mesh, ...)

    In general you may never guarantee that a GPIO toggle by the CPU directly will happen at a specific time in a task-event system, since the CPU may be busy processing a higher priority interrupt (such as an BLE radio event). The only way to ensure this is thus to cut the necessary CPU intervention out of the loop, such as when using PPI to have a peripheral event trigger another peripherals task.

    Dominik Eugster said:
    I like to delete this frame by checking the complete time of this bit frame. Reading out the timer value (Timer1) after the last Bit doesn't fix the problem, I have the same timer value even in a frame which is too long. Maybe I need to check it with Systick or what do you suggest?

    I am not sure I understand what you mean when you say that you are getting the same value for frames of different length. What frequency is the TIMER instance you are using configured to?

    Best regards,
    Karl

Reply
  • Hello again,

    Dominik Eugster said:
    This works, but doesn't solve my problem.

    No problem, let us look closer at the application and see what we can do!

    Dominik Eugster said:
    I set and reset an IO PIN in the IRQ to implement a single wire communication. I can't use the GPIOTE because I have to switch between Input and Output Config of this PIN. Now the problem is, that sometimes, the frame is corrupt when something in parallel is working on the nRF (GPIOTE, BLE Mesh, ...)

    In general you may never guarantee that a GPIO toggle by the CPU directly will happen at a specific time in a task-event system, since the CPU may be busy processing a higher priority interrupt (such as an BLE radio event). The only way to ensure this is thus to cut the necessary CPU intervention out of the loop, such as when using PPI to have a peripheral event trigger another peripherals task.

    Dominik Eugster said:
    I like to delete this frame by checking the complete time of this bit frame. Reading out the timer value (Timer1) after the last Bit doesn't fix the problem, I have the same timer value even in a frame which is too long. Maybe I need to check it with Systick or what do you suggest?

    I am not sure I understand what you mean when you say that you are getting the same value for frames of different length. What frequency is the TIMER instance you are using configured to?

    Best regards,
    Karl

Children
No Data
Related