Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

ASIC TNT4882

Hello,
Two interrupts at the same time.
I have set TLCHLTE to 1 that causes Halt on IMR2/1/0 interrupts.
Also I used "Immediate Holdoff" at the entry of the ISR and "Finish Handshake" at the exit of the ISR.
I'm using  two interrupts, TLCINT for receiving string and DONE for acknowledging that reply completely transferred.
Here is the problem.
It's a random problem and occurs between (3-5)hours of running loop of {  Ibwrt() and Ibrd()  } in the software.
         Software  side                                                          MCU side
1      ibwrt(Str1)                                                           TLCINT, due ISR1<END-RX>
                                                                                     reply is sent and expecting DONE INT
--------------------------------------------------------------------------------------------------------------------
2     ibr() // reply is received                                       
       Delay()
3     Ibwrt(Str2)
                                                                                   TLCINT and DONE INT occurred at the same time
                                                                                    CNT0 reported zero bytes is received.
                                                                                     therefore no reply to send
---------------------------------------------------------------------------------------------------------------------
4  ibrd() //  time out
----------------------------------------------------------------------------------------------------------------------
GPIB analyzer shows Str2 has been passed over the bus and GPIB is waiting for the ASIC to talk.
This problem occurs even under 3 or 10 second time delay between ibwrt() and ibrd(), also even if I increase
ibrd() time out for 10 second, this problem still occur randomly.
0 Kudos
Message 1 of 16
(4,846 Views)
It is possible that DONE will set following the TNT receiving data, in addition to END setting. DONE will set following a read when the FIFO is empty and the acceptor is in ACRS. Is it possible there is a race condition and in the failing condition the FIFO has been emptied by the MCU, causing DONE to set prior to the interrupt service routine executing?
0 Kudos
Message 2 of 16
(4,837 Views)
ibwrt()  generates INT(TLCINT) for the MCU
ibr()      generates INT(DONE)  for the MCU
 
In both interrupts before exiting the ISR, I set the configuration for the next coming string and also use the command GO
to clear stop and halt as well as it clears DONE bit that is set as a result of reading the string from FIFOB.

GPIB registers interrupt flags are cleared with GO command, then I clear MCU hardware interrupt flag.
I clear END-RX by reading ISR1 if the interrupt was TLCINT.
Therefore ibrd() is the only one that would cause hardware interrupt.
 
I tried to find if DONE interrupt has been serviced before the new lost string arrived.  I set a flag, this
flag is cleared if DONE interrupt is serviced. When the problem occurs, I find this flag still set, which means DONE interrupts
didn't occur yet.
 
When the problem occurs, the last interrupt occurs with both DONE and TLCINT are set. I serve it as TLCINT
and I found number of bytes received is zero. However, the GPIB analyzer shows string has been delivered to the ASIC and waiting
for reply.
0 Kudos
Message 3 of 16
(4,825 Views)
ibwrt()  generates INT(TLCINT) for the MCU AND INT(DONE) for the MCU. Will your interrupt service routine handle this correctly?
ibr()      generates INT(DONE)  for the MCU

Both ibwrt() and ibrd() can cause a DONE interrupt in the TNT. The definition of done is on page 3-129 of the TNT4882 manual.

Are you setting up transfers based on completing the previous transfer? For example, do you always set up a write from the TNT after finishing a read from the TNT?

In the failing case where you detect both interrupts, what is the addressing state of the TNT? You can read this in the ADSR. Is it addressed to talk, listen, or neither?


0 Kudos
Message 4 of 16
(4,822 Views)
Are you setting up transfers based on completing the previous transfer? For example, do you always set up a write from the TNT after finishing a read from the TNT?
-----------------
Yes,
After completing reading of TNT FIFOB, I set it again for accepting a new data which would be sent by ibwrt() function.
But If I have to send reply, I have to wait for ibrd() to finish reading and that would cause DONE interrupt to occurs. When DONE interrupt occurs I set the TNT again for receiving data that would be sent by ibwrt().

 
0 Kudos
Message 5 of 16
(4,816 Views)
Can you confirm your firmware will correctly handle the case of ibwrt() generating a DONE interrupt?

Transfers are usually set up based on the addressing state of the TNT. When it becomes addressed to listen a read transfer is set up and when it becomes addressed to talk a write transfer is set up.

In the failing case where you detect both interrupts, what is the addressing state of the TNT? You can read this in the ADSR. Is it addressed to talk, listen, or neither?
0 Kudos
Message 6 of 16
(4,813 Views)
I'll do the experiment, to read ADSR, it may take 2-6 hours to fail, hopefully it fails fast.
0 Kudos
Message 7 of 16
(4,805 Views)
Can you confirm your firmware will correctly handle the case of ibwrt() generating a DONE interrupt?
0 Kudos
Message 8 of 16
(4,800 Views)
Can you confirm your firmware will correctly handle the case of ibwrt() generating a DONE interrupt?
------------------
I'm using the term ibwrt() and ibrd() to reference to the software that communicates with the firmware.
 
ibwrt() sends string to TNT and TNT interrupts the MCU with TLCINT INT based on END-RX is enabled in IMR1.
DONE only occurs after reading the string from FIFOB which I clear it with GO command after finishing reading the buffer
and before exiting the ISR .
 
ibrd() causes the TNT to generate interrupt.
 
Both interrupts are handled correctly. When Ibrd() interrupts occurs, just I set the TNT configuration for the next coming string, meaning, expecting ibwrt() would send something.
 
 
 
0 Kudos
Message 9 of 16
(4,797 Views)
Let me clarify:

When the host does an ibwrt(), that can cause an END or DONE interrupt in the TNT.
When the host does an ibrd(), that can cause a DONE interrupt in the TNT.

When the TNT generates a DONE interrupt it may be from either a read or write.

The definition of DONE is given on page 3-129 of the TNT4882 manual.
0 Kudos
Message 10 of 16
(4,793 Views)