Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

resolve the hang-up of TNT4882 after write-transfer

Hi,

    My GPIB device based on TNT4882  can correctly receive the data sent from my VISA app using viPrintf, and my GPIB device can also write data to my VISA app using viRead through GPIB, like "Acery,XXXXX,xxxxxxxxx,2.5-5.20-23". But Everytime my VISA app always poped up an TIMEOUT error on the function of viRead and I showed the maybe receiving data, my VISA app can show the correct data "Acery,XXXXX,xxxxxxxxx,2.5-5.20-23". Not only the VISA app pops up the TIMEOUT error, but also that my gpib program running on my device could not detect the termination condition like END,EOS,ERR,B_done,B_tlcint after it sent out the data .  I have no idea on how to solve this problem so far.

    The GPIB program for sending out data  in Programed I/O mode is coded following the example of ESP-488 (http://joule.ni.com/nidu/cds/view/p/id/223/lang/en) in the dir of ESP-488\NOTNT\NGPIB_IO.c and EX5.c)  as an example. I cannot find any defect about the register programming.

Now I would show the write-data code sequence:
         When I detect the TNT4882 is in Talker mode from ADSR, I will call the initializing writing code for writing-data-transfer:

TNT_Out(R_cmdr,F_resetfifo);

  TNT_Out(R_cnt0, (char)(twos_cnt));      /* Load twos compliment count     */
  TNT_Out(R_cnt1, (char)(twos_cnt>>8));   /*  into TNT count registers      */
  TNT_Out(R_cnt2, (char)(twos_cnt>>16));
  TNT_Out(R_cnt3, (char)(twos_cnt>>24));

  TNT_Out(R_imr0,B_glint);              /* Set write to imr0 to be sure   */
  TNT_Out(R_auxmr,HR_auxrj|0);          /*   B_to is cleared              */

  TNT_Out(R_imr1, B_err);         /* End transfer on err            */
  TNT_Out(R_eosr, 0);        /* Set EOS byte                   */
  TNT_Out(R_auxmr,HR_auxra|F_hlda)
  TNT_Out(R_cfg , (B_tlchlte | CCEN ));  // I don`t set time-out attribute.
  TNT_Out(R_auxmr,F_hldi);               /* Hold off immediately           */
  TNT_Out(R_cmdr, F_go);

------------------------------------------

During the writing-data-transfer, I use the status of END|EOS|ERR|B_done|B_tlcint to

control the data transfer. All the data is written to FIFOB for sending out.

--------------------------------------------
       After aborting transfer of writing:
 TNT_Out(R_cmdr,F_stop);
 TNT_Out(R_cmdr,F_resetfifo);

 if(TNT_In(R_isr1)&B_end)                /* If we received an END          */
    TNT_Out(R_auxmr,F_clrEND);            /*   Clear status bit             */

 if(TNT_In(R_isr1)&B_err) {
    TNT_Out(R_auxmr,F_clrERR);            /* Clear error bit                */
   
 if(io_type==OUTPUT) {
      TNT_Out(R_hssel,F_onechip|B_go2sids); /* if error set to idle state.    */
    }

------------------------------------

Now I showed up some registers of TNT4882 during different phase.

 

registers after initialization of write-transfer and before write-transfer:
isr0 0x21
isr1 0x0
isr3 0x48
------------
adsr ox4a
sasr 0x70
sts1 0x10
sts2 0x9a
bsr  0x21

 

registers after write-transfer:
isr0 0x21
isr1 0x2
isr3 0x48
------------
adsr ox4a
sasr 0x70
sts1 0x10
sts2 0x9a
bsr  0x21

 

registers after a few seconds(TNT was still Talker):
isr0 0x21
isr1 0x0
isr3 0x48
------------
adsr ox4a
sasr 0x70
sts1 0x10
sts2 0x9a
bsr  0x31


       After write-transfer, my device program cannot detect any condition of ERR,END,EOS,DONE,TLCINT in

isr0,isr1,isr2, isr3 to do the post-termination action.


       As you can see, some registers above almost donn`t change. I really donn`t know how to solve the

TIMEOUT problem and how to notify my VISA app that the transfer is completed.

 

       At last could you give me an example of how to initialize the write-transfer?

0 Kudos
Message 1 of 1
(3,045 Views)