I'm not sure if this is in the right forum section, so apologies if not.
Advanced warning I must be doing something very wrong for this to happen, so be prepared to despair.
We're building a small PCB with a few inputs and outputs, which was initially controlled by a 328p. The need then arised to do some more intense computation on the device, so it was decided to upgrade to the ATSAMD21G18A.
I am programming the chip by taking a hex file compiled by arduino, and using Atmel Studio to flash it to the chip using an atmel ICE and SWD. I have used a number of custom 'no bootloader' boards added to boards.txt, and all are exhibiting the same strange behavior described below.
To try to get programming working first, I am using the blink script, with the output of a pin going to the base of a 2N2222 transistor that is connecting power to ground via an LED and resistor. The chip itself is powered to 3.3V at all the appropriate pins with an adjustable power supply, with the recommended decoupling capacitors in place.
The strange behaviour is as follows: When pinmode is set to OUTPUT, nothing happens other than a very very faint glow of the LED. digitalwrite and analogwrite have no effect on the LED. Initially I just assumed the chip was not programming properly, and spent many hours troubleshooting the programming as such, however at one point I decided to change pinmode to INPUT instead, and was shocked to find the LED started blinking. This was with digitalwrite.
INPUT and INPUT_PULLUP have seemingly the same effect on an analog pin, with the LED blinking but only at a medium level of brightness. Considering the Transistor is sensitive enough to shine moderately brightly with just a finger on the wire, this is presumably due to lowered impedence in time with the digitalwrite. When moving to a digital pin and pinmode = INPUT (I haven't yet tried pullup), the same behavior is shown, however the LED shines brighter than on the analog pin. Metering the output from the pin, a voltage of 0.69V is measured each 'blink'.
I have tried using a few different methods of pin manipulation, but am yet to find something that works to get a correctly working output from the chip pins. If anyone could shine any light on the situation, or mention anything obvious that I'm ignoring that would be much appreciated!
Thanks very much.