How to use PA03/AREF as output ?
It is not mapped on arduino.
Set it as output ?
Raise it and lower it?
How to use PA03/AREF as output ?
It is not mapped on arduino.
Set it as output ?
Raise it and lower it?
Solved:
PORT->Group[PORTA].DIRSET.reg = PORT_PA03; // Set Out5 digital pin as Output
#define setOut5 PORT->Group[PORTA].OUTSET.reg = PORT_PA03
#define resOut5 PORT->Group[PORTA].OUTCLR.reg = PORT_PA03
Don’t you need to do something with pinmux as well?
I do not know what pinmux is, it's not in the samd datasheet.
This works.
What should do and why?
See Section 6: "6. I/O Multiplexing and Considerations"
and the PMUXn description in the section on PORT (section 22) ("22.8.12 Peripheral Multiplexing n")
something like (untested!):
PORT->Group[PORTA].PINCFG.PMUXEN = 0; // disable alternate peripherals on pin
72: error: request for member 'PMUXEN' in '1090536448u->Port::Group[0].PortGroup::PINCFG', which is of non-class type 'volatile PORT_PINCFG_Type [32]'
SerialUSB.print(PORT->Group[PORTA].PINCFG.PMUXEN);
Too complicated for my little head.
But does it disable only the PA03 functions? Or what else?
I do not see bit 3 in the code.
I also use PA31 and PA30 as input.
How do I disable SW debug?
#define In11 !( REG_PORT_IN0 & PORT_PA31 ) // SWDIO - PA31
#define In12 !( REG_PORT_IN0 & PORT_PA30 ) // SWDCLK - PA30
Too complicated for my little head.
But does it disable only the PA03 functions? Or what else?
I do not see bit 3 in the code.
OK; I actually ran this through the compiler this time. And you're right - it was missing anything about bit3!
It should be:
PORT->Group[PORTA].PINCFG[3].bit.PMUXEN = 0;
At least, that compiles. It does seem horribly complex, doesn't it? Fortunately, everything resolves to constants at compile time, so it doesn't actually generate much code...
Not work.
I believe that that command disables all functions, including IO.
If i read imput on this way:
#define In11 !( REG_PORT_IN0 & PORT_PA31 ) // SWDIO - PA31
#define In12 !( REG_PORT_IN0 & PORT_PA30 ) // SWDCLK - PA30
There are a pullup (not wanted), but i read imput.
If i put, this on setp, the pullup is gone, but I do not read the input anymore.
PORT->Group[PORTA].PINCFG[30].bit.PMUXEN = 0; // Remove other function from In11
PORT->Group[PORTA].PINCFG[31].bit.PMUXEN = 0; // Remove other function from In12