Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

how the nat9914 initialized found by GPIB-USB-B

I am in the process of programming a ARM microcontroller for use with the NAT 9914.My question is how the nat9914 initialized found by GPIB-USB-B.I use the application note AN110 to test.I read and write to each register except the hidden registers in ACCR .All the registers are OK.So the NAT9914 is connected properly.My initialized programm is:

AT91F_GPIBWrite(TAUXMR,GPIB_SW9914);
  
  AT91F_GPIBWrite(GpibAUXCR,GPIB_CHIPRST);/*=>the chip is logically disconnected from the GPIB*/
  AT91F_GPIBWrite(GpibACCR,NAT9914_5MHZ);
  AT91F_GPIBWrite(GpibAUXCR,GPIB_VSTDL);
  
  AT91F_GPIBWrite(GpibIMR0,0x28);/*BI(bit5),END(bit3) enable.*/         
  AT91F_GPIBWrite(GpibIMR1,0x99);/*GET(bit7), DCAS(bit3), APT(bit4), IFC(bit0) enable.*/
  AT91F_GPIBWrite(GpibAUXCR,GPIB_PIIMR2);
  AT91F_GPIBWrite(GpibIMR2,0xe0); /*GLINT(bit7=1), STBO IE(bit6=1), NLEN(bit5=1), */
  
  AT91F_GPIBWrite(GpibAUXCR,GPIB_PIEOSR);      
  AT91F_GPIBWrite(GpibEOSR,GpibEosrReg);/*Set end of string: CR                          */
  AT91F_GPIBWrite(GpibAUXCR,GPIB_PIACCR);       
  AT91F_GPIBWrite(GpibACCR,0x94);   /*BIN=1, REOS=1                     */
  
  AT91F_GPIBWrite(GpibADR,PRI_ADDR);/*Default gpib address 8.                        */
  AT91F_GPIBWrite(GpibAUXCR,GPIB_NSWRST);

 

they similar to the application note A110.

But when I open the Measurement & Automation Explorer to scan the  instrument,tell me EBUS error.

So how do to find the NAT9914.

Thank you!

0 Kudos
Message 1 of 7
(5,435 Views)

Hello Ellyshao,

 

It doesn't look like this code follows the 9914 reference manual.  At the beginning of chapter 5 it goes over a very detailed list of things necessary to get the chip initialized.  From your code, I do not see where you are writing the clock frequency.  It should be written to the ICR register (not the ACCR).

 

Here is a link to the 9914 manual.

 

https://www.ni.com/docs/en-US/bundle/370876a/resource/370876a.pdf 

 

Thanks,

Steven T.

0 Kudos
Message 2 of 7
(5,416 Views)

Thank you reply to me.

Refer to the NAT9914 manual,I write to the NAT9914 initialized like this:

/*Asert the local pon message. NAT9914 is idle and ignore gpib signals.Ref1 P5-1*/
  AT91F_GPIBWrite(GpibAUXCR,GPIB_CHIPRST);/*=>the chip is logically disconnected from the GPIB*/
  AT91F_GPIBWrite(GpibAUXCR,GPIB_SW7210);/*change to NEC7210 mode*/
  AT91F_GPIBWrite(TAUXMR,0x50);
  AT91F_GPIBWrite(GpibAUXCR ,0x81);   /*set the MICR bit ICR2[0]*/
  AT91F_GPIBWrite(TAUXMR,GPIB_SW9914);   /*return 9914 mode*/
  AT91F_GPIBWrite(GpibAUXCR,GPIB_PIACCR);  /*Page in ACCR.                                  */ 
  AT91F_GPIBWrite(GpibACCR,NAT9914_5MHZ);/*Set clock frequency 20/4=5 MHz.                */
  
  AT91F_GPIBWrite(GpibADR,PRI_ADDR);/*Default gpib address 8.                        */
  
  /*Set T1 delay 2us.     (Ref2 P9-29) */
  AT91F_GPIBWrite(GpibAUXCR,GPIB_PIACCR);  /*Page in ACCR.                                  */         
  AT91F_GPIBWrite(GpibACCR,0xe0);   /*USTD =0 */
  AT91F_GPIBWrite(GpibAUXCR,GPIB_NVSTDL); /*USTD =0 */
  AT91F_GPIBWrite(GpibAUXCR,GPIB_NSTDL);   /*stdl =0 */
  
  /*Set interrupt mask register.*/        
  AT91F_GPIBWrite(GpibIMR0,0x28);/*BI(bit5),END(bit3) enable.*/         
  AT91F_GPIBWrite(GpibIMR1,0x99);/*GET(bit7), DCAS(bit3), APT(bit4), IFC(bit0) enable.*/
  AT91F_GPIBWrite(GpibAUXCR,GPIB_PIIMR2);
  AT91F_GPIBWrite(GpibIMR2,0xe0); /*GLINT(bit7=1), STBO IE(bit6=1), NLEN(bit5=1), */
       
  
  /*Set End of String register.                              (Ref2 P.B-7)  */
  AT91F_GPIBWrite(GpibAUXCR,GPIB_PIEOSR);      
  AT91F_GPIBWrite(GpibEOSR,GpibEosrReg);/*Set end of string: CR                          */
  AT91F_GPIBWrite(GpibAUXCR,GPIB_PIACCR);       
  AT91F_GPIBWrite(GpibACCR,0x94);   /*BIN=1, REOS=1                     */
   
  /*Configure the initial parallel poll response register. */
  AT91F_GPIBWrite(GpibACCR,0xe4);    /*PP1 = 1*/
  AT91F_GPIBWrite(GpibPPR,temp_zero);    /*It's not necessary for NAT9914(using GPIB_CHIPRST).*/   
  AT91F_GPIBWrite(GpibACCR,0xb0);     /*ISS=0,SPEOI=0*/
  AT91F_GPIBWrite(GpibACCR,0xcc);     /*DHADT,DHADC = 1*/   
 
  AT91F_GPIBWrite(GpibAUXCR,GPIB_SWRST);


 When I open the Measurement & Automation Explorer to scan the  instrument,tell me EBUS error too.

 I want to know when scan the instrument,whether PC transmits command to the NAT9914,the NAT9914 how reply.

how do to find the NAT9914?

Thank you very much!

0 Kudos
Message 3 of 7
(5,394 Views)

As I think, it's not easy to solve your problem by that Reference Manual.

 

Here you are: (old doc for NAT9914)

http://www.physics.brocku.ca/~edik/gpib/AN110.pdf

 

you must check all the Read/Write timing in this doc. Especially, the D0~D7 are reversed.

 

As I think, you should add this workaround for the AT91. https://www.ni.com/docs/en-US/bundle/371430a/resource/371430a.pdf 

 

Due to the system bus is faster than NAT9914. Accessing AUXCR must call delay()

 

if you can get correct responce(test3) from test.c(in the appendix B). That means all the R/W timing is good for your Hardware.

 

 

Then, try to execute gpibdev5.c an fully example of NAT9914.

 

That's all the experence for NAT9914. Good Luck!

 

Joe

0 Kudos
Message 4 of 7
(5,381 Views)

ellyshao,

 

Thank you for showing the initialization routine.  It looks like it goes through all of the necessary steps. 

 

At this point, you may want to verify that the registers are getting written.  Some of the registers are both read and write like the count registers.  Please verify that you can write to them and read the exact same value back. 

 

During a scan for instruments, the controller (the GPIB-USB-B) tries to address every GPIB primary address as listener one at a time.  When it gets to primary address 8 (your instrument), the NAT9914, should raise NRFD when it is addressed as listener.  If the NAT9914 is not initialized properly, nothing will happen and the controller will not see any listeners on the bus (hence the EBUS error).

 

Thanks,

Steven T.

0 Kudos
Message 5 of 7
(5,322 Views)

 Thank you  for Stenve T reply to me.I verify all the register.

The registers of NAT9914 are only read or only write.

So I use test.c in the application note 110 ,like this:

//check ADSR and ISR0 by programming to talk with 'ton'
 AT91F_GPIBWrite(TAUXMR,0x15);
 AT91F_GPIBWrite(GpibAUXCR,0x1c);
 AT91F_GPIBWrite(GpibAUXCR,0x80);
 AT91F_GPIBWrite(GpibAUXCR,0x00);
 AT91F_GPIBWrite(GpibAUXCR,0x1e);
 AT91F_GPIBWrite(GpibIMR2,0x00);
 AT91F_GPIBWrite(GpibIMR1,0x00);
 AT91F_GPIBWrite(GpibIMR0,0x00);
 AT91F_GPIBWrite(GpibAUXCR,0x8a);
 ten1 = AT91F_GPIBRead(GpibISR0);
 ten2 = AT91F_GPIBRead(GpibISR1);
 ten3 = AT91F_GPIBRead(GpibADSR);
 AT91F_GPIBWrite(GpibAUXCR,0x0a);
 ten3 = AT91F_GPIBRead(GpibADSR);
 //check ISR2 with CDOR
 AT91F_GPIBWrite(TAUXMR,0x15);
 AT91F_GPIBWrite(GpibAUXCR,0x1c);
 AT91F_GPIBWrite(GpibAUXCR,0x80);
 AT91F_GPIBWrite(GpibAUXCR,0x00);
 AT91F_GPIBWrite(GpibAUXCR,0x1e);
 AT91F_GPIBWrite(GpibIMR2,0x00);
 AT91F_GPIBWrite(GpibIMR1,0x00);
 AT91F_GPIBWrite(GpibIMR0,0x00);
 ten1 = AT91F_GPIBRead(GpibISR2);
 AT91F_GPIBWrite(GpibCDOR,0xaa);
 ten1 = AT91F_GPIBRead(GpibISR2);
 //check BCR by reading from a write to BSR
 AT91F_GPIBWrite(TAUXMR,0x15);
 AT91F_GPIBWrite(GpibAUXCR,0x1c);
 AT91F_GPIBWrite(GpibAUXCR,0x80);
 AT91F_GPIBWrite(GpibAUXCR,0x00);
 AT91F_GPIBWrite(GpibAUXCR,0x1e);
 AT91F_GPIBWrite(GpibIMR2,0x00);
 AT91F_GPIBWrite(GpibIMR1,0x00);
 AT91F_GPIBWrite(GpibIMR0,0x00);
 AT91F_GPIBWrite(GpibAUXCR,0x1f);
 AT91F_GPIBWrite(GpibBCR,0x40);
 ten1 = AT91F_GPIBRead(GpibBSR);

I test all the registers ,they are writted and read the exact same value back.

After I initialized the NAT9914,I measure the INT signal.The INT signal can not be drived low.It wire a external pullup resistor to it.

I do not kown what is wrong.

Thank you very much.

0 Kudos
Message 6 of 7
(5,304 Views)

For testing interrupt of NAT9914, may compare your code with tst12 function in test.c (AP 110).  Did you?

由 yytseng 在 10-24-2008 05:59 AM
上編輯的訊息
0 Kudos
Message 7 of 7
(5,293 Views)