i am using a custom arduino bootloader on an AT90CAN128,
the chip has 7 analog pins like most arduinos,
the Aref pin has a capacitor to ground on it.
analog pins 0 to 4 hover around the 800 mark when floating and drop to 0 when tied to ground
but analog pins 5 and 6 (PF5 and PF6) float at 1023 and when grounded drop to around 15.
so for some reason they are being pulled high by something.
the pins go directly to the MCU, there is no components in between and all analog pins take the same route on the PCB meaning that if there was any crosstalk from anything else it should affect all the pins not just the last two.
can anyone shed some light on this? is it possible to accidently activate an internal pullup resistor on an analog pin?
for those who are interested, i think i have solved the problem. turns out those pins are also used for the JTAG interface and if that is active then internal pull up resistors will hold those pins high as i suspected.
Well done and thanks for reporting back, and explaining the cause. It's not uncommon for people to not bother reporting back that they have fixed a problem, or given up, or simply lost interest, with the result that forum members waste time replying, trying to help or requesting more information. Others report back that they fixed the problem, but, perhaps out of embarrassment, say nothing about how they did it, which must be frustrating for others searching for answers to similar problems. +1 karma
PaulRB:
Well done and thanks for reporting back, and explaining the cause. It's not uncommon for people to not bother reporting back that they have fixed a problem, or given up, or simply lost interest, with the result that forum members waste time replying, trying to help or requesting more information. Others report back that they fixed the problem, but, perhaps out of embarrassment, say nothing about how they did it, which must be frustrating for others searching for answers to similar problems. +1 karma
thanks, it has literally taken all day, after actually reading the datasheet, i found it was the JTAG holding the pins high and i just had to change a fuse bit. but then for some reason the drivers stopped working on my AVRISP Mkii, so that took a bit of research (pro tip if your ISP seems to disconnect during programming saying "cannot find usb device" then try this program https://zadig.akeo.ie/ uninstall your device and delete the drivers, boot the program and install the libUSBk driver, the other drivers don't work)
after getting the ISP working i couldn't get the bootloader to work, turns out i had moved the original copy of the AT90CAN128 bootloader i had and was using a version which worked but didn't allow programming over serial so kinda useless.
after i got the right bootloader, i couldn't get the fuses calculated right, it kept saying the extended fuses were wrong but actually it was the second set of fuses that were wrong (i was setting the programming space to include the area for the bootloader meaning the bootloader would be overwriting itself and AVRdude was bombing out.)
after the ISP, bootloader and fuses were fixed, i ran some test code and the analog pins work fine. only took 8 hours!