Skip to content

fndl fails to find secondary devices #87

Description

@hb020

Right now, during the secondary device test in fndl_h, the logic is:

      if (gpibBus.isAsserted(NDAC_PIN)) {
        gpibBus.assertSignal(ATN_BIT);
        gpibBus.writeByte(GC_UNL, false);
        gpibBus.writeByte( (pri+0x20), false ); // LAD

        for (uint8_t sec=0x60; sec<0x7F; sec++){
          gpibBus.writeByte(sec, false);
          gpibBus.clearSignal(ATN_BIT);
          delayMicroseconds(1600);
          if (gpibBus.isAsserted(NDAC_PIN)) {
            if (acnt>0) dataPort.print(',');
            acnt++;
            dataPort.print(pri);
            dataPort.print(':');
            dataPort.print(sec);

            gpibBus.assertSignal(ATN_BIT);
            gpibBus.writeByte(GC_UNL, false);
            gpibBus.writeByte((pri+0x20), false); // LAD
          }else{
            gpibBus.assertSignal(ATN_BIT);
            gpibBus.writeByte(GC_UNT, false);
          }
        }

        gpibBus.clearSignal(ATN_BIT);
        delayMicroseconds(1600);

      }

The

          }else{
            gpibBus.assertSignal(ATN_BIT);
            gpibBus.writeByte(GC_UNT, false);     // <-- this is the problem
          }

section is the problem.

This NOT compliant according to IEEE-488.1, 2.6.3.5:

The LE function shall exit LPAS and enter LPIS if the primary command group (PCG) message is true, the MLA
message is false and ACDS is active.

UNT and UNL are both PCG messages. As a result, the device MUST lose all memory of being addressed. And the LAD is therefore lost.

The result is that any secondary address device that is not on 0 or that is not immediately following another existing device, will not be found.

It is best to use:

      if (gpibBus.isAsserted(NDAC_PIN)) {
        for (uint8_t sec=0x60; sec<0x7F; sec++){
          gpibBus.assertSignal(ATN_BIT);
          gpibBus.writeByte(GC_UNL, false);
          gpibBus.writeByte( (pri+0x20), false ); // LAD
          gpibBus.writeByte(sec, false);
          gpibBus.clearSignal(ATN_BIT);
          delayMicroseconds(1600);
          if (gpibBus.isAsserted(NDAC_PIN)) {
            if (acnt>0) dataPort.print(',');
            acnt++;
            dataPort.print(pri);
            dataPort.print(':');
            dataPort.print(sec-0x60);
          }
        }

        gpibBus.clearSignal(ATN_BIT);
        delayMicroseconds(1600);

      }

That repairs the addressing, the unneeded actions at the end of the loop, and also the print (subtract 0x60 from the SAD output).

The loop just before this code section is a nice touch though. Better than what a E5810 does, which is: if secondary address 0 does not reply, do not test for any more secondary addresses.

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