Yesterday I found one interesting (For a green hand, I think so,) way to generate high frequency signal.
I post here, hope it will help anyone needed
#define PIN_B6_HIGH (GPIOB_BASE)->BSRR = BIT(6)
#define PIN_B6_LOW (GPIOB_BASE)->BRR = BIT(6)
void setup() {
pinMode(5, OUTPUT); // B6 is pin 5
}
void loop() {
myloop:
PIN_B6_HIGH;
PIN_B6_LOW;
goto myloop;
}
If you want to moderate frequency or duty,
you could use this delay
__asm__("nop\n\t");
it could offer a 30ns? I forget exact number but much shorter than the delayMicrosenonds();