I am using the MK22FN256LVH12 micro on a custom pcb board. With KDS v3.2 and Processor Expert.
I am trying to use two GPIO pins to control a 12V relay through controlling a BJT. One of my GPIO is the logic to turn the gate on and off and the other GPIO acts as the ground for this circuit. A general circuit diagram is shown below. However my circuit will not work if I use the GPIO as the ground. It does work when I tie it to another ground via on the board. I am not quite sure why using my GPIO as the ground is not working could someone provide some insight on this? I measured the voltage between the GPIO I set low and the ground on my board and there is no difference. I have set the ground GPIO to pulldown and having it set to 0. The difference between the two is 3.3V (which is what I expect), and when it is connected to the BJT the difference is about .5V which is enough to allow the current to flow and the relay switch to throw. The current is very low however, only 30mA which is probably why it is not throwing the switch, but why is this?