Hi, I would like to use the SWDIO and SWCLK pins on a Sodaq One as I/O but can’t work out how to do that. Any ideas?
I’ve only every used the Serial Wire interface for programming and debugging via a SAMD programmer. Specifically, I’ve use the ATMEL-ICE. With an appropriate IDE (e.g. Atmel Studio), it is possible to properly debug code which is running on the device (e.g. add breakpoints and step through etc).
The SWDIO and SWCLK pins don’t appear to be GPIO pins.
According to the data sheet and schematics, the SWDIO and the SWCLK pins are attached to PA30 and PA31 of the SAMD21.
The I/O multiplexing table on page 21/22 of the data sheet show that these pins can be connected to:
MUX A - EXTINT[10] / EXTINT[11]
MUX D - SECOM[1] PAD[2] / SECOM[1] PAD[3]
MUX E - TCC1 WO[0] / TCC1 WO[1]
MUX G - SWDIO / SWCLK
MUX H - GCLK_IO[0] / N/A
This suggests that those pins could indeed be used as some kind of I/O, using the EXTINTs perhaps?
But its MUX B that includes the ADC and AC operations, which means that you wouldn’t be able to do an analogue read or write of those pins.
Perhaps somebody else could expand more on this.
What is it you were wanting to use these pins for?
The data sheet also says:
6.2.2 Serial Wire Debug Interface Pinout
Only the SWCLK pin is mapped to the normal PORT functions. A debugger cold-plugging or hot-plugging detection will automatically switch the SWDIO port to the SWDIO function.
Which suggests that if you’re not using a debugger on these pins it will automatically use one of the other MUX functions, possible A by default?? But once you plug in a debugger it will switch to MUX G.