Re: [EXTERNAL] Re: GPIB as a pure slave

Frank Mori Hess <[email protected]> Tue, 17 Jan 2023 13:20:07 -0500
Newsgroups gmane.linux.hardware.gpib.general
Message-ID <CAJz5Opd51_8hacHSHbkbxEEjsOC3wXRY1dnho6z7fn9WbPfPtg@mail.gmail.com>
You might want to check that your board is generating interrupts.  I
had to set the "pci=nomsi" kernel command line option in order to get
interrupts working with an ARM SOC system.

On Mon, Jan 16, 2023 at 12:38 PM Stefan Olejnik
<[email protected]> wrote:
>
> Hi Dave,
>
> I have the same results with slave_test2 :
>
> root@imx8mm-var-dart:/home/stefan/bin# ./slave_test2
> [  135.918117] tnt4882: minor 0 read timed out
> [  135.922325] tnt4882: read timed out
> Got *IDN?
>
> [  138.990013] tnt4882: write timed out
> error: ibwrt fail
>  - EABO 6: Operation aborted
> root@imx8mm-var-dart:/home/stefan/bin#
>
>
> I am using computer with Win10 and National Instruments GPIB packages -> NI-VISA interactive control program for GPIB. As a commands I am using "query", send the request and waiting for the answer. This Win10 computer is connected to HW (Variscite board with NI PCIe-GPIB (rev 02)) with Yocto linux 5.10 image via NI GPIB-USB-HS+ connector.
>
> I am handling scenarios as follows:
>
> No TACS or LACS is set => use poll timer to check if It is any change - 1second.
>
> LACS is set => use poll timer 200ms to check if read ( ibrd ) returns any data. If yes, read till end-of-the data and save them. Set flag to answer. When CIC do not address slave as a TACS ( use e.g. only write command ) I am getting, of course, read time out. But this is  OK, no data on the GPIB bus.
>
> TACS is set => try send the data back to the master - CIC. Clear flag to send data.
>
> I am not getting any notifier from the kernel to activate communication. Therefore I am using polling mechanism. It is OK for me now.
>
> As I have mentioned already. Reading seems to me OK. When data are on the GPIB bus, I am reading them. When no data, I am getting read time out. But I have somehow to check, if any data are ready to be read => poll mechanism.
>
> Write seems to me bigger problem, as I have already described.
>
> Stefan
>
>
> On 1/16/23 14:01, dave penkler wrote:
>
> CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.
>
>
>
> Hi Stefan,
> It looks like in your case the slave board was already addressed as a listener before you started slave_test which is why you got the timeout.
> Here is a new version that deals with this case. It loops until it reads a string when addressed as a listener and then writes back that string when addressed as talker. If the read times out it prints "read timeout" and goes back to the loop.
> On the master side once a string has been written the response must be read before writing another. Are you using ibterm on the master or something else ?
>
> $ ./slave_test2
> read timeout
> read timeout
> Got hello
> Got bye
> Got quit
> slave done
> $
>
> cheers,
> -Dave
>
> On Sun, 15 Jan 2023 at 09:46, Stefan Olejnik <[email protected]> wrote:
>>
>>  Hi, Dave
>>
>> Thanks a lot for Your effort.
>>
>> I have tested Your program, but it is almost the same as I have used. The result are as follows:
>>
>> root@imx8mm-var-dart:/home/stefan/bin#
>> root@imx8mm-var-dart:/home/stefan/bin# ./slave_test
>> [  124.896503] tnt4882: minor 0 read timed out
>> [  124.900712] tnt4882: read timed out
>> Got hello
>> [  127.968496] tnt4882: write timed out
>> error: ibwrt fail
>>  - EABO 6: Operation aborted
>> root@imx8mm-var-dart:/home/stefan/bin# ./slave_test
>> [  187.105354] tnt4882: minor 0 read timed out
>> [  187.109563] tnt4882: read timed out
>> Got *IDN?
>>
>> [  190.177371] tnt4882: write timed out
>> error: ibwrt fail
>>  - EABO 6: Operation aborted
>> root@imx8mm-var-dart:/home/stefan/bin#
>>
>> READING:
>>
>> Interesting is that during "ibrd" even read timeout is coming from TNT4882, the data are read OK. I am using reading per char,  till END or END-OF-STRING => "\n"  and I am getting no time-out during reading.
>>
>> WRITTING:
>>
>> First "ibwrt" is always time-outed, the second also, but data are delivered, as I am already described. Therefore I am using short TIMO ( e.g. 10ms ) for ibwrt, and on the receiver device is TIMO set to 3s, and I am getting the data. Of course from second "ibwrt".
>>
>> Stefan.
>>
>>
>
>
> _______________________________________________
> Linux-gpib-general mailing list
> [email protected]
> https://urldefense.com/v3/__https://lists.sourceforge.net/lists/listinfo/linux-gpib-general__;!!KPww_GFiJXw!dStM8yAfuh3c-g2DADHbI16c9tjl3JGNosqI3Iot8J8ca4a2dFSpRfVPrlbgFg5WJ_2JeC33Gjy440iMy6p_$
>
> _______________________________________________
> Linux-gpib-general mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/linux-gpib-general



-- 
Frank