Multiplexing Digital pins as ADC's. SAMD21

Hi, I have a SAMD21 Dev board and am trying to add ADC functionality to some of the digital pins. One of the best features of the SAMD21 is that the pins can be multiplexed, but Arduino have not made any effort to explain how to do it in their environment. I am surprised by the lack of support that Arduino give to their Zero considering it is the flagship of their portfolio. They seem to have just put it out there and expect the broader community to develop support for it. I digress.

I followed the instructions posted here https://forum.arduino.cc/index.php?topi … msg4049447 on the Arduino forum with some limited success. I managed to get D8 and D9 working as A6 and A7 respectively, but A6 has issues. I use two 68K resistors to make a voltage divider between VCC and ground; 3.3V/2 = 1.65V. If I analogRead() this voltage on pins A1 to A5 I get a stable return between 510 and 514; working as expected. I get the same stable result for A7, but A6 gives a reading that fluctuates between 470 and 500, so there is definitely something wrong there. Using the same code mods in variants.cpp to try and make D3 or D4 into A8 did not work. I managed to get D3 working as A8 if I changed its pin definition entirely, from PIO_TIMER to PIO_ANALOG, but it is terrible, returning values between 450 and 520.

Has anyone got experience at multiplexing these pins?

THX.

Problem solved: see thread at arduino forum: Topic: Arduino Zero additional analog inputs? Thx