Thank you for the quick reply.
I removed pinMode() and DigitalWrite() in setup loop.
I replaced DigitalWrite() with your code with no effect.
Pin didn't toggle as expected.
Are you sure? I just tested the lines of code in a small sketch on my Feather M4 and it toggles D10:
// D10 Output Test
void setup() {
PORT->Group[PORTA].DIRSET.reg = PORT_PA20; // Set D10 to an output
}
void loop() {
PORT->Group[PORTA].OUTSET.reg = PORT_PA20; // Toggle D10 HIGH
delay(500); // Wait for half a second
PORT->Group[PORTA].OUTCLR.reg = PORT_PA20; // Toggle D10 LOW
delay(500); // Wait for half a second
}
My apologies, one of the lines read PORTB rather than PORTA for the OUTCLR register. I've now corrected that above. Probably the reason why your code didn't toggle the pin.
My apologies, one of the lines read PORTB rather than PORTA for the OUTCLR register. I've now corrected that above. Probably the reason why your code didn't toggle the pin.
Ok I will try this next monday back at my bench.
I think I find my problem, mostly not related to I/O speed issue but good to know how to do this.