Skip to content

"Write PES" and "Erase All" issues with 22V10 #71

@ceteras

Description

@ceteras

I've found a few issues while working with a Lattice GAL22V10D which had its PES erased (10 FFs).
Replicating the issues will have to start with a completely erased chip.

Steps I followed are:

  1. attempt to write a new PES:

./afterburner_osx -d /dev/tty.usbmodem101 p -v -t GAL22V10 -nc -pes "00:05:49:A1:CD:A4:03:00"

I took the PES from another chip.

This would send data in the wrong place in the chip, the result looks like this:

L5720 11111111111111111111111111111111111111111111*
L5764 11111111111111111111111111111111111111111111*
L5808 10101100000000000000*
N UES FF FF FF FF FF FF FF FF*
L5828 1111111111111111111111111111111111111111111111111111111111111111*
N PES FF FF FF FF FF FF FF FF FF FF*
CDB57

Line starting at 5808 was affected.
I fixed this by treating GAL22V10 similarly to GAL6001/2:
In writePes() function I've added a case to switch(gal)

    case GAL22V10:
      setRow(0);
      for (rbit = 0; rbit < 64; rbit++) {
        b = pes[rbit >> 3];
        p = b & (1 << (rbit & 0b111));
        sendBit(p);
      }
      sendBits(52, 0);
      sendAddress(6, galinfo.pesrow);
      setSDIN(0);
      break;

Using info from http://www.armory.com/%7Erstevew/Public/Pgmrs/GAL/algo.htm I tried adding the 52 L bits.

This caused the data to be sent to the proper row in the chip, but because the PES sent was 8 bytes not 10 as 22V10 requires, the data was shifted two bytes to the right:

L5764 11111111111111111111111111111111111111111111*
L5808 11111111111111111111*
N UES FF FF FF FF FF FF FF FF*
L5828 1111111111111111111111111111111111111111111111111111111111111111*
N PES 00 00 00 05 49 A1 CD A4 03 00*
CDD2F
  1. attempt to erase the wrong PES
    The erase with -all argument does not execute if a chip cannot be identified (-nc is required if you have a bad PES).

I've changed the check in afterburner.c in main:

if (opErase /*&& 0 == result*/) {
         result = operationEraseGal();
     }

Another issue seems to be the Erase All row address, in galInfoList[] I've set the eraseallrow to 57 for GAL22V10 (value taken from the same web page above).
I was able to erase the bad PES value.

  1. Hack to shift the PES to its correct location
    As we can only send 8 bytes for PES, I've changed the number of L bits sent from 52 to 68 :
    case GAL22V10:
      setRow(0);
      for (rbit = 0; rbit < 64; rbit++) {
        b = pes[rbit >> 3];
        p = b & (1 << (rbit & 0b111));
        sendBit(p);
      }
      sendBits(68, 0);
      sendAddress(6, galinfo.pesrow);
      setSDIN(0);
      break;

After these hacks I could have a proper PES written in my chip:

L5720 11111111111111111111111111111111111111111111*
L5764 11111111111111111111111111111111111111111111*
L5808 11111111111111111111*
N UES FF FF FF FF FF FF FF FF*
L5828 1111111111111111111111111111111111111111111111111111111111111111*
N PES 00 05 49 A1 CD A4 03 00 00 00*
CDD2F

... and identify it:

./afterburner_osx -d /dev/tty.usbmodem101 i -t GAL22V10   
PES info: 5V Lattice GAL22V10  VPP=13.0 Timing: prog=40 erase=25

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions