Can't set a pin LOW

I have been programming on Arduino successfully, and regularly use AVR ICs in projects where I program in C (which is to say, I don’t think I’m a complete moron - who knows?) I have set up a quick EEPROM (actually flash in this case - Micro SST39SF010A - but it programs the same as normal EEPROMS) programmer using two 74HC595s and the same code that everyone typically uses:

 EEPROM Programmer 
 In this case, programming a SST39SF010A
 55ns read access, 22us write time
 Software Data Protection to write:
 (0x5555, 0xAA)
 (0x2AAA, 0x55)
 (0x5555, 0xA0)

#define SHIFT_DATA  13
#define SHIFT_CLK   12
#define SHIFT_LATCH 11
#define ROM_D0      2
#define ROM_D1      3
#define ROM_D2      4
#define ROM_D3      5
#define ROM_D4      6
#define ROM_D5      7
#define ROM_D6      8
#define ROM_D7      9
#define WRITE_EN    10

void setAddress(int address, bool outputEnable) {
  shiftOut(SHIFT_DATA, SHIFT_CLK, MSBFIRST, ((address >> 8) | (outputEnable ? 0x00 : 0x80))); // High bits
  shiftOut(SHIFT_DATA, SHIFT_CLK, MSBFIRST, address); // Low bits
  digitalWrite(SHIFT_LATCH, LOW);
  digitalWrite(SHIFT_LATCH, HIGH);
  digitalWrite(SHIFT_LATCH, LOW);

byte readROM(int address) {
  for (int pin = ROM_D0; pin <= ROM_D7; pin++) {
    pinMode(pin, INPUT);
  byte data = 0;
  setAddress(address, /* outputEnable */ true);
  // Read each pin
  for (int pin = ROM_D7; pin >= ROM_D0; pin--) {
    data = (data << 1) + digitalRead(pin);
  return data;

void printContents() {
  for (int base = 0; base < 256; base += 16) {
    byte data[16];
    char buf[80];
    for (int offset = 0; offset < 16; offset++) {
      data[offset] = readROM(base + offset);
    // buffer (string) to hold the formatted data
    sprintf(buf, "%03x:  %02x %02x %02x %02x %02x %02x %02x %02x  %02x %02x %02x %02x %02x %02x %02x %02x",
      base, data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7],
      data[8], data[9], data[10], data[11], data[12], data[13], data[14], data[15]);

void writeROM(int address, byte data) {
  for (int pin = ROM_D0; pin <= ROM_D7; pin++) {
    pinMode(pin, OUTPUT);
    digitalWrite(pin, LOW);
  setAddress(address, /* outputEnable */ false);
  for (int pin = ROM_D0; pin <= ROM_D7; pin++) {
    digitalWrite(pin, (data & 0x01));
    data = (data >> 1);
  digitalWrite(10, LOW);
  digitalWrite(10, HIGH);

void setup() {
  // put your setup code here, to run once:

  // Set pull-up resistor
  digitalWrite(WRITE_EN, HIGH);
  pinMode(WRITE_EN, OUTPUT);

  writeROM(0x5555, 0xAA);
  writeROM(0x2AAA, 0x55);
  writeROM(0x5555, 0xA0);
  for (int i = 0; i < 256; i++)
    writeROM(i, i % 13);

void loop() {
  // put your main code here, to run repeatedly:

Everything works, except the WRITE_EN pin (active low) never goes low. I can put it at any pin on the Nano and it always stays high throughout the entire write process. All the address pins and data pins give the correct data, but it never gets written because WRITE_EN doesn’t clock it in.

I am stymied by this one - I can recreate on a second Nano, I have used every pin as #WE, etc. Has anyone ever had this happen?

This is my first parallel non-volatile memory programmer setup, I have always been able to program serial flash and ROMs easily, so maybe there is just something obvious I am missing from the parallel world?

I should also mention I get the same results with another memory (EEPROM - Greenliant GLS29EE010)

Logic analyzer example below - Channel 1 is LSB data, Channel 7 is bit 7 data (only 8 channel analyzer, but everything else is correct, I have tested all the other pins), and Channel 0 is WRITE_EN. You can see it stuck high.

The code that you posted does not compile

Sorry, moved a declaration when I was getting rid of comments. Compiles now.

It works as expected for me.

Do you have the sample rate in Saleae Logic set high enough to catch those 10 us pulses on pin 10?

Does the problem still occur with only the Nano connected to the logic analyzer, with no flash chip in the circuit?

Have you done a sanity check by running the Blink sketch on pin 10?