How many instructions can be executed in a single clock cycle of master clock

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
ArVi_4696011
Level 1
Level 1

i am trying to create a delay function using for loop in psoc 5, but for that i need to know about how many instructions should be executed.

0 Likes
1 Solution
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

Hi,

Probably you can find the information in the ARM Cortex-M3 Processor Technical Reference Manual from the URL below.

ARM Cortex‑M3 Processor Technical Reference Manual Revision r2p1 – Arm Developer

But I'm afraid that the delay using loop can be preempted by other interrupt(s) and may not be very accurate.

Depending on the requirement of granularity, I would recommend you to go with

either Hardware Timer (for fine timing) or SysTick for ms order or above.

moto

View solution in original post

0 Likes
2 Replies
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

Hi,

Probably you can find the information in the ARM Cortex-M3 Processor Technical Reference Manual from the URL below.

ARM Cortex‑M3 Processor Technical Reference Manual Revision r2p1 – Arm Developer

But I'm afraid that the delay using loop can be preempted by other interrupt(s) and may not be very accurate.

Depending on the requirement of granularity, I would recommend you to go with

either Hardware Timer (for fine timing) or SysTick for ms order or above.

moto

0 Likes
Len_CONSULTRON
Level 9
Level 9
Beta tester 500 solutions authored 1000 replies posted

arvi,

I believe "__asm("nop");" is the instruction to use.  RISC architectures in the the past besides being "Reduced Instruction Set Computing" claimed that each instruction completed on one CPU clock cycle.  I believe the ARM CPU of the PSoC5 does just that.

Additionally the CPU clock is the BUS_CLOCK which is derived from the MASTER_CLOCK.  Check your DWR/Clocks configuration which divisor is used on the MASTER_CLOCK to provide BUS_CLOCK.

Cypress provides a function called CyDelayUs(uint16 microseconds).  I understand that they compute the needed "NULL"  instructions to loop on based off the BUS_CLOCK.

Len

Len
"Engineering is an Art. The Art of Compromise."
0 Likes