Issue with shift register - stops working after a few seconds

For some reason when using a shift register, to control a MOSFET to run a motor, I can get it to work but then it seems that the MOSFET closes after a few seconds.

I have attached the gate of the MOSFET to a normal I/O pin and held it high to show that it isnt the MOSFET.

My circuit is essentially just the one showed here

http://bildr.org/2012/03/rfp30n06le-arduino/

with a 595 shift register in between the arduino and gate. As stated, when the gate is connected directly to the I/0 instead of the shift register the circuit works fine.

Any ideas?

#include <SPI.h>

void setup()
{
  SPI.begin();
  SPI.setDataMode(SPI_MODE0);
  SPI.setBitOrder(MSBFIRST);
  
  pinMode(2,OUTPUT);
  pinMode(3,OUTPUT);
  digitalWrite(2,HIGH);
  
  //digitalWrite(3,LOW);
  digitalWrite(2,LOW);
  SPI.transfer(128);
  digitalWrite(2,HIGH);
}

void loop()
{
}

Do you have a pullup resistor (10k) on the shifte register pin ?

yes i do, connecting the line between the shift registers h output (the output assoicated with the decimal value 128) and the gate of the MOSFET, and the shared ground line.

if it makes a difference, I believe there might not be an issue with low load circuits like LEDs.

I will do a test to see if the LED can run indefinitely, or if it eventually cuts out too.

Please don't start duplicate threads about this---that's called cross-posting
and wastes everyone's time.

Since you haven't shown us exactly how you've connected up this shift
register we can only guess what the problem is, my guesses are a lack
of decoupling, or noise on the clock line (long wires), or leaving some
of the inputs of the '595 unconnected.