Hello,
i made a little custom board based on the SAMD21G18A / Arduino Zero.
I accidently attached PA27 as an important output, and now i do not know how to use that Pin.
I already found out, that this pin is defined in the variant-file:
#define PIN_LED_TXL (26u)
and also in the bootloader pin-definition files:
#define BOARD_LEDTX_PIN (27)
I cannot use that definitions, that does not working as expected.
I don't know how to get it working. Everything i tried, went wrong so far 
Basically, i would not need the bootloader or USB-flashing, if that makes it easier somehow!?
I hope you can help me to use that PA27 Pin as simple Output for High and Low.
many thanks in advance.
When you say you "attached an Enable-Pin" what do you mean? Is "Enable-Pin" something particular to your board?
If the Arduino bootloader is using that pin, and you're using the Arduino bootloader to upload your code, then to keep the bootloader from changing the state of that pin you might need to compile your own bootloader. (You could perhaps modify the Arduino bootloader source and recompile and flash it.)
Regardless of how you get your code onto the chip, if your code wants to use PA27 you should be able to do that. You could perhaps use the Arduino/Wiring pinMode(PIN_LED_TXL, OUTPUT), or you could read the SAMD21 datasheet and set the PORT registers yourself.
drewfish:
When you say you "attached an Enable-Pin" what do you mean? Is "Enable-Pin" something particular to your board?
yes, sorry, this means, it is an output pin, that will enable another module on the board.
i adopted the first post to make it clear.
drewfish:
Regardless of how you get your code onto the chip, if your code wants to use PA27 you should be able to do that. You could perhaps use the Arduino/Wiring pinMode(PIN_LED_TXL, OUTPUT), or you could read the SAMD21 datasheet and set the PORT registers yourself.
This is what i already tried, but it just does not work.
i would not be affraid, that the bootloader will actively toggle this pin, when normal code is running!? or should i?
The bootloader shouldn't be doing anything once your code is running.
Strange that pinMode() didn't work for you. Once you do that (typically once in setup()) you should be able to use digitalWrite() to set the pin either high or low.
The following might be useful to see how the pin is configured:
Serial.println(PORT->Group[0].DIR.reg & (1<<27) ? "dir=OUT" : "dir=IN");
Serial.println(PORT->Group[0].PINCFG[27].bin.INEN ? "INEN=yes" : "INEN=no");
Serial.println(PORT->Group[0].PINCFG[27].bin.PULLEN ? "PULLEN=yes" : "PULLEN=no");
Serial.println(PORT->Group[0].PINCFG[27].bin.PMUXEN ? "PMUXEN=yes" : "PMUXEN=no");
Serial.print("PMUX=");
Serial.println(PORT->Group[0].PMUX[13].reg.PMUXO);
drewfish:
The bootloader shouldn't be doing anything once your code is running.
Strange that pinMode() didn't work for you. Once you do that (typically once in setup()) you should be able to use digitalWrite() to set the pin either high or low.
The following might be useful to see how the pin is configured:
Serial.println(PORT->Group[0].DIR.reg & (1<<27) ? "dir=OUT" : "dir=IN");
Serial.println(PORT->Group[0].PINCFG[27].bin.INEN ? "INEN=yes" : "INEN=no");
Serial.println(PORT->Group[0].PINCFG[27].bin.PULLEN ? "PULLEN=yes" : "PULLEN=no");
Serial.println(PORT->Group[0].PINCFG[27].bin.PMUXEN ? "PMUXEN=yes" : "PMUXEN=no");
Serial.print("PMUX=");
Serial.println(PORT->Group[0].PMUX[13].reg.PMUXO);
ok, thanks for your support! i will try this in a simple test-program.
ok, thanks for your support!
it's now working as expected. The problem was on another part of the code.
thread can be closed.