06-23-2010 07:27 PM
06-24-2010 08:23 AM
Hello,
Please format your post so that it is readable. Right now, I am unable to figure out what is going wrong because I can't tell where the comment symbols end.
Thanks,
Steven T.
06-24-2010 08:51 AM
You did not need to create a new post. All you had to do was add a reply to this one. Please keep all discussion in the new post.
06-24-2010 07:05 PM
06-28-2010 10:19 AM
Hello Fujun,
I found a few small mistakes that could have made things not work very well.
1. Step one in initialization is to make sure that the 7210 is in 7210 mode. How are you insuring this? I just want to make sure this is accounted for.
2. In gpib_init() Set clock to 20MHz
I see that you are writing ICR correctly, however there is a problem when writing ICR2. 20 MHz requires that the MICR bit is set. When writing 0x80, this bit is cleared....so the correct value to write to ICR2 is 0x81
3. When configuring the GPIB Address, you set ADR0 to have listening disabled on address 15, then you set ADR1 to have talking disabled on address 15. I would recommend instead to enable both listening and talking on address 15 (ADR0) and completely disable a second address on ADR1.
outp(6,0x0F)
outp(6,0xE0)
After I found these two problems (plus my first question), I stopped verifying your routine, since these errors would be enough to stop communication from happening.
Let me know if correcting these issues does not help. Another posting of your code would be helpful.
Steven T.
06-28-2010 10:55 PM
06-29-2010 04:01 PM
Hello mxzh,
I found one more issue.
I also think that you are expecting the chip to automatically read data from the GPIB and let you know that it has data. In actuality, there is a whole list of steps that must happen before you get a message. Please check out Sending GPIB Data Messages in the manual. The first step is to see that the controller has addressed the NAT7210 as talker, then it must manually send the data out. The same steps must take place for receiving data.
One interrupt that should be seen is the ADSC line in ISR2. This will let you know that your addressing has changed. If the other interrupt bits are set correctly, this should result in the INT hardware line changing state.
Thanks,
Steven T.
06-30-2010 03:43 AM
07-01-2010 08:25 PM
07-08-2010 01:18 PM
Hello,
Sorry for the delay in replying. I was on vacation some of last week and this week.
You don't seem to be checking for th ADSC bit in the ISR2 register. This bit will set as soon as the GPIB controller addresses the NAT7210 as talker or listener. If this bit is set, it should generate an interrupt if the other interrupt bits are set correctly (GLINT bit in ISR0 must be set). The interrupt will tell you when you can start the transfer by using the DIR and CDOR registers.
Would it be possible to see what happens when your code detects the change in addressing? Also what happens when you attempt to send/receive data?
Thanks,
Steven T.