JEDEC JEP106 vendor ID/manufacturer lookup command

Added a quick command to lookup JEP106 IDs. It’s not yet in main, but I’ll do help/docs/etc tomorrow and push it. Any thoughts?

There are several formats of JEDEC manufacturer IDs. The one we run into most often is the two byte JEP106 ID.

[0][0x7e - 1] = "Numonyx Corporation",
[1][0x01 - 1] = "Cirrus Logic",

Byte 1 is the bank ID. That’s the first number in the array (0, 1 here). Currently the number uses at most the lower 4 bits (16 banks, numbered 0-15).

Byte 2 is the manufacturer ID. Here are some fun facts about manufacturer ID numbers:

  • ID are 7 bits and 1 indexed (not 0!). So there are 126 IDs in each bank (0x1 to 0x7e)
  • ID 0x00 is invalid (indexed from 1)
  • IF the bank == 0 then ID bit 7 will be 0. Thus IDs in bank 0 range from 0x01 to 0x7e.
  • IF the bank > 0 then ID bit 7 will be 1. Thus IDs in bank 1+ range from 0x81 to 0xff.
    //error if bank = 0 and id bit 7 is set
    if((bank == 0) && (id & 0x80)){
        printf("Invalid JEP106 ID: bank 0 cannot have bit 7 set in device id\r\n");
        return;
    }
    
    //error if bank > 0 and id bit 7 is clear
    if((bank > 0) && !(id & 0x80)){
        printf("Invalid JEP106 ID: bank > 0 must have bit 7 set in device id\r\n");
        return;
    }

This is our sanity check for ID numbers:

  • Bank = 0 then ID bit 7 must also be 0.
  • Bank > 0 then ID bit 7 must be 1.
    bank=(bank & 0xf); //only lower 4 bits are valid for bank
    id=(id & 0x7f); //SPD JEDEC ID is lower 7 bits, no parity bit. Bit 7 = 1 = bank > 0

Some prep is needed before we can lookup the manufacturer in the JEP106 table:

  • bank & 0xf - Only use the lower four bits of bank
  • id & 0x7f - zero out bit 7 of the ID and keep the lower 7 bits.
  • id-- - subtract one to adjust the ID for the 0 indexed lookup array (not shown, done in the lower lookup function).

Completed the help, and added the command to the global help as well. Pushing this to main. It might not be flashy, but I think this command will be genuinely useful when probing at things.

ETA: