0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Red PitayaでAgilent Technologies 82357Aを使えるようにする

Last updated at Posted at 2025-10-19

概要

UbuntuでAgilent Technologies 82357A(以降82357A)が使用できるようになったので,Red Pitayaでもできるかを試してみる.

↓Ubuntuの場合の手順

環境

ボード : Red Pitaya STEMLab 125-10
OS : Ubuntu 22.04.4 LTS

手順

基本的にはUbuntuの時と変わらないが,makeコマンドを実行した時にエラーが出力された.

$ make -C /lib/modules/`uname -r`/build V=0 modules \
                M="/root/Linux-GPIB/linux-gpib-4.3.7/linux-gpib-kernel-4.3.7/drivers/gpib" \
                GPIB_TOP_DIR=/root/Linux-GPIB/linux-gpib-4.3.7/linux-gpib-kernel-4.3.7 \
                CONFIG_GPIB_ISA="" \
                GPIB_CONFIG_PCMCIA="0" \
                HAVE_DEV_OF_NODE= \
                CLASS_CREATE1ARG=0 \
                GPIB_CONFIG_KERNEL_DEBUG=0
make[1]: Entering directory '/usr/kernel'
warning: the compiler differs from the one used to build the kernel
  The kernel was built by: arm-linux-gnueabihf-gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
  You are using:           gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
  CC [M]  /root/Linux-GPIB/linux-gpib-4.3.7/linux-gpib-kernel-4.3.7/drivers/gpib/agilent_82350b/agilent_82350b.o
/tmp/ccKL8uMW.s: Assembler messages:
/tmp/ccKL8uMW.s:61: Error: selected processor does not support `dsb ' in ARM mode
/tmp/ccKL8uMW.s:75: Error: selected processor does not support `dsb ' in ARM mode
/tmp/ccKL8uMW.s:137: Error: selected processor does not support `dsb st' in ARM mode
/tmp/ccKL8uMW.s:173: Error: selected processor does not support `dsb st' in ARM mode
/tmp/ccKL8uMW.s:185: Error: selected processor does not support `dsb st' in ARM mode
/tmp/ccKL8uMW.s:198: Error: selected processor does not support `dsb st' in ARM mode
/tmp/ccKL8uMW.s:418: Error: selected processor does not support `dsb st' in ARM mode
/tmp/ccKL8uMW.s:434: Error: selected processor does not support `dsb st' in ARM mode
/tmp/ccKL8uMW.s:459: Error: selected processor does not support `dsb st' in ARM mode
/tmp/ccKL8uMW.s:585: Error: selected processor does not support `dsb st' in ARM mode
/tmp/ccKL8uMW.s:721: Error: selected processor does not support `dsb st' in ARM mode
/tmp/ccKL8uMW.s:787: Error: selected processor does not support `dsb st' in ARM mode
/tmp/ccKL8uMW.s:802: Error: selected processor does not support `dsb ' in ARM mode
/tmp/ccKL8uMW.s:810: Error: selected processor does not support `dsb st' in ARM mode
/tmp/ccKL8uMW.s:917: Error: selected processor does not support `dsb st' in ARM mode
/tmp/ccKL8uMW.s:960: Error: selected processor does not support `dsb ' in ARM mode
/tmp/ccKL8uMW.s:1246: Error: selected processor does not support `dsb ' in ARM mode
/tmp/ccKL8uMW.s:1278: Error: selected processor does not support `dsb st' in ARM mode
/tmp/ccKL8uMW.s:1296: Error: selected processor does not support `dsb st' in ARM mode
/tmp/ccKL8uMW.s:1314: Error: selected processor does not support `dsb st' in ARM mode
/tmp/ccKL8uMW.s:1351: Error: selected processor does not support `dsb ' in ARM mode
/tmp/ccKL8uMW.s:1444: Error: selected processor does not support `dsb ' in ARM mode
/tmp/ccKL8uMW.s:1452: Error: selected processor does not support `dsb st' in ARM mode
/tmp/ccKL8uMW.s:1542: Error: selected processor does not support `dsb st' in ARM mode
/tmp/ccKL8uMW.s:1573: Error: selected processor does not support `dsb ' in ARM mode
/tmp/ccKL8uMW.s:1608: Error: selected processor does not support `dsb st' in ARM mode
/tmp/ccKL8uMW.s:1625: Error: selected processor does not support `dsb st' in ARM mode
/tmp/ccKL8uMW.s:1643: Error: selected processor does not support `dsb st' in ARM mode
/tmp/ccKL8uMW.s:1661: Error: selected processor does not support `dsb st' in ARM mode
/tmp/ccKL8uMW.s:1673: Error: selected processor does not support `dsb st' in ARM mode
/tmp/ccKL8uMW.s:1685: Error: selected processor does not support `dsb st' in ARM mode
/tmp/ccKL8uMW.s:1711: Error: selected processor does not support `dsb st' in ARM mode
/tmp/ccKL8uMW.s:1722: Error: selected processor does not support `dsb st' in ARM mode
/tmp/ccKL8uMW.s:1844: Error: selected processor does not support `dsb st' in ARM mode
/tmp/ccKL8uMW.s:1935: Error: selected processor does not support `dsb st' in ARM mode
/tmp/ccKL8uMW.s:1950: Error: selected processor does not support `dsb ' in ARM mode
/tmp/ccKL8uMW.s:1958: Error: selected processor does not support `dsb st' in ARM mode
/tmp/ccKL8uMW.s:2013: Error: selected processor does not support `dsb st' in ARM mode
/tmp/ccKL8uMW.s:2039: Error: selected processor does not support `dsb st' in ARM mode
/tmp/ccKL8uMW.s:2114: Error: selected processor does not support `dsb ' in ARM mode
/tmp/ccKL8uMW.s:2141: Error: selected processor does not support `dsb st' in ARM mode
make[3]: *** [scripts/Makefile.build:277: /root/Linux-GPIB/linux-gpib-4.3.7/linux-gpib-kernel-4.3.7/drivers/gpib/agilent_82350b/agilent_82350b.o] Error 1
make[2]: *** [scripts/Makefile.build:540: /root/Linux-GPIB/linux-gpib-4.3.7/linux-gpib-kernel-4.3.7/drivers/gpib/agilent_82350b] Error 2
make[1]: *** [Makefile:1868: /root/Linux-GPIB/linux-gpib-4.3.7/linux-gpib-kernel-4.3.7/drivers/gpib] Error 2
make[1]: Leaving directory '/usr/kernel'
make: *** [Makefile:16: all] Error 2

上の記事で言えば4.ドライバのインストールの項目で発生した.
エラーの根幹は

Error: selected processor does not support `dsb ' in ARM mode

上の部分であり,これはコンパイラがdsbというARMアセンブリ命令を生成したものの「コンパイルのターゲットとして設定されているCPUがその命令をサポートしていない」とアセンブラが判断したために発生している.
そのため,使用しているCPUをコンパイラに教えてあげればよい.
ついでに他の詳細も,コンパイラに伝える.

$ make -C /lib/modules/`uname -r`/build V=0 modules \
     EXTRA_CFLAGS="-march=armv7-a" \
     M="/root/Linux-GPIB/linux-gpib-4.3.7/linux-gpib-kernel-4.3.7/drivers/gpib" \
     GPIB_TOP_DIR=/root/Linux-GPIB/linux-gpib-4.3.7/linux-gpib-kernel-4.3.7 \
     CONFIG_GPIB_ISA="" \
     GPIB_CONFIG_PCMCIA="0" \
     HAVE_DEV_OF_NODE= \
     CLASS_CREATE1ARG=0 \
     GPIB_CONFIG_KERNEL_DEBUG=0

結果

上のコマンドを実行したところ無事コンパイルできた.
その他の手順については特にエラーは出力されず,無事接続することができた.

おまけ

この変換アダプタを利用して機器と通信してみた.
機器 : ADVANTEST WAVELENGTH METER TQ8325

本機器は通信規格がIEEE規格488-1978であるため,*IDN?コマンドに応答しない.
そのため,送信ができた場合は存在するとした.

import gpib
import time

print("GPIBデバイスをスキャンしています...")

found_devices_list = []

for address in range(1, 31):
    inst = None  # finally ブロックで使うために先に定義
    write_success = False # writeが成功したかを追跡するフラグ

    try:
        # 1. デバイスへの接続を試みる (REMOTEランプ点灯)
        inst = gpib.dev(0, address, 0, 10) 
        
        # 2. *IDN? を送信
        print(f"[アドレス {address}] ... 接続成功、*IDN? 送信中...")
        gpib.write(inst, "*IDN?")
        write_success = True # ★ writeに成功したことを記録
        
        time.sleep(0.1) 
        
        # 3. 応答を読み取り
        response = gpib.read(inst, 100)
        
        # 4. 読み取り成功 (新しい機器の場合)
        device_info = response.decode('utf-8').strip()
        print(f"★★ [アドレス {address}] 発見: {device_info} ★★")
        found_devices_list.append(f"Address {address}: {device_info}")
        
    except gpib.GpibError as e:
        # エラーが発生
        print(f"[アドレス {address}] でエラー: {e}")
        
        # ★★★ ロジック修正 ★★★
        # write() には成功したが (write_success == True)、
        # read() で例外が発生した場合 (exceptブロックに入った場合)
        if write_success:
             print(f"★★ [アドレス {address}] 発見: (接続のみ成功, *IDN? 応答なし) ★★")
             found_devices_list.append(f"Address {address}: (TQ8325 or similar, No *IDN?)")
        # write() の時点で失敗した場合は (write_success == False)、何もしない

    finally:
        # スキャン後、必ずREMOTEを解除 (ローカルモードに戻す)
        if inst is not None:
            try:
                gpib.ibloc(inst) # ローカルモードに戻す
            except gpib.GpibError:
                pass # ローカル復帰失敗は無視

print("-" * 30)
if not found_devices_list:
    print("アクティブなGPIBデバイスは見つかりませんでした。")
else:
    print(f"{len(found_devices_list)} 台のデバイスが見つかりました:")
    for device in found_devices_list:
        print(device)
    
print("スキャン完了。")

実行について,Pythonにgpio.pyの場所を知らせてあげる必要があるため,オプションで伝える.

$ PYTHONPATH=/root/Linux-GPIB/linux-gpib-4.3.7/linux-gpib-user-4.3.7/language/python/build/lib.linux-armv7l-cpython-310 /usr/bin/python ./scan_Equipment.py

実行結果

GPIBデバイスをスキャンしています...
[アドレス 1] ... 接続成功、*IDN? 送信中...
[アドレス 1] でエラー: write() failed: A read or write of data bytes has been aborted, possibly due to a timeout or reception of a device clear command.
[アドレス 2] ... 接続成功、*IDN? 送信中...
[アドレス 2] でエラー: write() failed: A read or write of data bytes has been aborted, possibly due to a timeout or reception of a device clear command.
[アドレス 3] ... 接続成功、*IDN? 送信中...
[アドレス 3] でエラー: write() failed: A read or write of data bytes has been aborted, possibly due to a timeout or reception of a device clear command.
[アドレス 4] ... 接続成功、*IDN? 送信中...
[アドレス 4] でエラー: write() failed: A read or write of data bytes has been aborted, possibly due to a timeout or reception of a device clear command.
[アドレス 5] ... 接続成功、*IDN? 送信中...
[アドレス 5] でエラー: read() failed: A read or write of data bytes has been aborted, possibly due to a timeout or reception of a device clear command.
★★ [アドレス 5] 発見: (接続のみ成功, *IDN? 応答なし) ★★
[アドレス 6] ... 接続成功、*IDN? 送信中...
[アドレス 6] でエラー: write() failed: A read or write of data bytes has been aborted, possibly due to a timeout or reception of a device clear command.
[アドレス 7] ... 接続成功、*IDN? 送信中...
[アドレス 7] でエラー: write() failed: A read or write of data bytes has been aborted, possibly due to a timeout or reception of a device clear command.
[アドレス 8] ... 接続成功、*IDN? 送信中...
[アドレス 8] でエラー: write() failed: A read or write of data bytes has been aborted, possibly due to a timeout or reception of a device clear command.
[アドレス 9] ... 接続成功、*IDN? 送信中...
[アドレス 9] でエラー: write() failed: A read or write of data bytes has been aborted, possibly due to a timeout or reception of a device clear command.
[アドレス 10] ... 接続成功、*IDN? 送信中...
[アドレス 10] でエラー: write() failed: A read or write of data bytes has been aborted, possibly due to a timeout or reception of a device clear command.
[アドレス 11] ... 接続成功、*IDN? 送信中...
[アドレス 11] でエラー: write() failed: A read or write of data bytes has been aborted, possibly due to a timeout or reception of a device clear command.
[アドレス 12] ... 接続成功、*IDN? 送信中...
[アドレス 12] でエラー: write() failed: A read or write of data bytes has been aborted, possibly due to a timeout or reception of a device clear command.
[アドレス 13] ... 接続成功、*IDN? 送信中...
[アドレス 13] でエラー: write() failed: A read or write of data bytes has been aborted, possibly due to a timeout or reception of a device clear command.
[アドレス 14] ... 接続成功、*IDN? 送信中...
[アドレス 14] でエラー: write() failed: A read or write of data bytes has been aborted, possibly due to a timeout or reception of a device clear command.
[アドレス 15] ... 接続成功、*IDN? 送信中...
[アドレス 15] でエラー: write() failed: A read or write of data bytes has been aborted, possibly due to a timeout or reception of a device clear command.
[アドレス 16] ... 接続成功、*IDN? 送信中...
[アドレス 16] でエラー: write() failed: A read or write of data bytes has been aborted, possibly due to a timeout or reception of a device clear command.
[アドレス 17] ... 接続成功、*IDN? 送信中...
[アドレス 17] でエラー: write() failed: A read or write of data bytes has been aborted, possibly due to a timeout or reception of a device clear command.
[アドレス 18] ... 接続成功、*IDN? 送信中...
[アドレス 18] でエラー: write() failed: A read or write of data bytes has been aborted, possibly due to a timeout or reception of a device clear command.
[アドレス 19] ... 接続成功、*IDN? 送信中...
[アドレス 19] でエラー: write() failed: A read or write of data bytes has been aborted, possibly due to a timeout or reception of a device clear command.
[アドレス 20] ... 接続成功、*IDN? 送信中...
[アドレス 20] でエラー: write() failed: A read or write of data bytes has been aborted, possibly due to a timeout or reception of a device clear command.
[アドレス 21] ... 接続成功、*IDN? 送信中...
[アドレス 21] でエラー: write() failed: A read or write of data bytes has been aborted, possibly due to a timeout or reception of a device clear command.
[アドレス 22] ... 接続成功、*IDN? 送信中...
[アドレス 22] でエラー: write() failed: A read or write of data bytes has been aborted, possibly due to a timeout or reception of a device clear command.
[アドレス 23] ... 接続成功、*IDN? 送信中...
[アドレス 23] でエラー: write() failed: A read or write of data bytes has been aborted, possibly due to a timeout or reception of a device clear command.
[アドレス 24] ... 接続成功、*IDN? 送信中...
[アドレス 24] でエラー: write() failed: A read or write of data bytes has been aborted, possibly due to a timeout or reception of a device clear command.
[アドレス 25] ... 接続成功、*IDN? 送信中...
[アドレス 25] でエラー: write() failed: A read or write of data bytes has been aborted, possibly due to a timeout or reception of a device clear command.
[アドレス 26] ... 接続成功、*IDN? 送信中...
[アドレス 26] でエラー: write() failed: A read or write of data bytes has been aborted, possibly due to a timeout or reception of a device clear command.
[アドレス 27] ... 接続成功、*IDN? 送信中...
[アドレス 27] でエラー: write() failed: A read or write of data bytes has been aborted, possibly due to a timeout or reception of a device clear command.
[アドレス 28] ... 接続成功、*IDN? 送信中...
[アドレス 28] でエラー: write() failed: A read or write of data bytes aborted, possibly due to a timeout or reception of a device clear command.
[アドレス 30] ... 接続成功、*IDN? 送信中...
[アドレス 30] でエラー: write() failed: A read or write of data bytes has been aborted, possibly due to a timeout or reception of a device clear command.
------------------------------
1 台のデバイスが見つかりました:
Address 5: (TQ8325 or similar, No *IDN?)
スキャン完了。

返答はなかったものの,無事アドレス5番として認識された.

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?