Attempt to generate a fast software pin toggle | Cypress Semiconductor
Attempt to generate a fast software pin toggle
Hi, I'm using the PSoC 4 CY8CKIT-049 and trying to get the fastest SW pin toggle.
I set all the clocks to the maximum of 48MHz, and set TestPin to P0.
then, I toggled the pin using
TestPin_DR |= TestPin_MASK;
TestPin_DR &= ~IndexPin_MASK;
However, i only get a 1.337 MHz square wave, which means the pin is being toggled at 2 * 1.337 MHz.
Why is there such a discrepancy with the 48MHz speed? Shouldn't it only take two cycles to toggle a pin in this method? Would there be anyway to do it faster using asm?
Thanks so much!