/* Raw blink sketch for DUE revealing SAM3X8E registers used Turns on an LED on for one second, then off for one second, repeatedly. */

// Pin 13 maskuint32_t led = (1u << 27);

void setup(){ // Output Enable Register REG_PIOB_OER = led; }

// the loop routine runs over and over again forever: void loop(){ REG_PIOB_SODR = led; // Set Output Data Register, turns LED on delay(1000); // wait for a second REG_PIOB_CODR = led; // Clear Output Data Register, turns LED off delay(1000); // wait for a second }

In C/C++, at a core level, the definition of a single (or brief) pin, controlled by a parallel I/O port is approached masking a correspondent bit.In order to do that, a standard syntax is used. In our case, with the format: (1u << x) where:

1u (left operator) is an unsigned value with the single bit 0 set, and all the other bits cleared. i.e. 1u = unsigned value 1.<< is a bit shifting operator.x (right operator) is the number of bits of the shifting.

In other words, (1u << 27) means create an unsigned value 1 shifted to the left 27 times (or bits). Thus, your posted code is correct.

// the loop routine runs over and over again forever: void loop(){ REG_PIOB_SODR = led; // Set Output Data Register, turns LED on delay(1000); // wait for a second REG_PIOB_CODR = led; // Clear Output Data Register, turns LED off delay(1000); // wait for a second

I've read the spec sheet and see the reference to them and the pins that they control. Curious how it has been implemented in Arduino 1.5.4 to access them, as you have... Guess I can extrapolate what I see you have written, but would like to see any docs.

I haven't found much in the way of docs but you have the source take a look through the forum, you'll find several threads. One was titled how to definue physical addresses/registers? It's down below CMSIS in The tree.