GPIO8_DR_SET is not working correctly

Why does this not work for pin 34 - 39? Am I doing something wrong?


Code:
// Teensy 4.1 direct register I/O access

void setup() {
  for (int i = 0; i <= 39; i++) {
    pinMode(i, OUTPUT);
    digitalWrite(i, LOW);
  }

  delay(1000);
  // pin 28,30,31,34,35,36,37,38,39
  GPIO8_DR_SET = 1<<18 | 1<<23 | 1<<22 | 1<<15 | 1<<14 | 1<<13 | 1<<12 | 1<<17 | 1<<16;
}

void loop() {}
 
Because those pins don't belong to GPIO8.
Pins 34-37 are on GPIO7.
Pins 38, 39 are on GPIO6.
The bits you are setting for them aren't correct either.
 
Because those pins don't belong to GPIO8.
Pins 34-37 are on GPIO7.
Pins 38, 39 are on GPIO6.
The bits you are setting for them aren't correct either.
Thank you, you saved my day. I don't know how I got this so wrong. I have the entire table of pin numbers, bits, and registers in my program. The table was correct up to pin 31.It works fine now. Thanks!
 
Back
Top