Open dazz100 opened 8 months ago
Hi Some further tests point to the following statements being the source of the issue:
print("Save settings to eeprom")
emc30.control_in(0xa1, 0x40, 0, 0, 1); # Save readtermination setting in eeprom (non volatile)
emc30.write('!term store')
time.sleep(pause)
Also, unplugging the adapter from the PC, and plugging back in again allows the script to run normally. Cycling power on the emc-30 is not necessary. This indicates the receiver is OK and probably not the cause of the issue.
Hi Dazz,
So when you remove term store it works multiple times after each other as intended? Can you confirm? This would ease my bugfixing.
Best regards,
Kai Ps: Can you set write termination to "" right after connecting to the instrument and try it again? Suspicion is that the residual CRLF added by pyvisa might make the firmware hang. I tested it only with eoi termination, so this is my strong root cause suspicion. Easy to fix for me if this is the case.
Btw: Thanks for this excellent quality style of issue description!
TestAndMeasurement_Dazz&Maurice.zip
In case my suspicion is true and your experiments turn out to confirm this. Then this might be the fix.
I cannot test this today, but can try during the week. But I don't want to block you from getting a potential bugfix.
Best regards,
Kai
Hi The No.1 adapter is effectively bricked at present. I can't rule out a hardware fault.
I switched to a No.2 adapter. This one programs correctly. No error messages. I ran the following program to return the resource ID:
# EMC30 Select antenna test
import pyvisa
print("# Show the list of Resources")
rm = pyvisa.ResourceManager()
print(rm.list_resources())
exit()
The response was:
D:\My Documents\Electronics\Electro-Metrics EMC-30\GPIB_Test>python EMC30_gpib_select_antenna.py
Simple GPIB test to select antenna switch and antenna
# Show the list of Resources
('ASRL1::INSTR',)
No returned resource ID.
The red LED is flashing slow with the EMC-30 powered on. When I switch off power to the EMC-30, the red LED flashes fast.
My current hypothesis is that adapter No.2 has a hardware fault that is not reading one of the gpib control lines from the EMC-30. I need to study the code to figure out what signal the adapter is looking for, to go from slow flash LED to steady on.
If others see or don't see the same symptoms, that would help identify whether this is a hardware/software fault. Dazz
Hi I have encountered a problem where re-running a simple script causes the gpib firmware to time out and stop responding to commands. This occurs when the same simple script is run more than once. The script sets up the gpib adapter firmware, then reads the frequency once. That is all it does.
I have an adapter that is plugged into an Electro-Metrics Interference Analyser model EMC-30. It can be viewed here: https://www.eevblog.com/forum/testgear/electro-metrics-em-30-emc-receiver/
Basically it is a 1980's over-engineered radio receiver. Probably me and no-one else is trying to run gpib with it. It has a very basic, but adequate gpib command set. There are features that can only be controlled via gpib.
The EMC-30 was available with optional PC software that ran with the gpib. For that reason, I am reasonably confident the gpib firmware works but I could be wrong.
I am writing short scripts to test each command. There is no "ID" command or auto-ID feature. I can read the set frequency.
This is the output when the script succeeds:
The script runs to completion and outputs the band (4) and the frequency (0.11617MHz) exactly as expected. The script works.
This is the output when the exact same script fails:
The script always fails when an attempt is made to save the parameters to eeprom. This happens before any attempt is made to communicate (send commands) to the emc-30. It never gets to the part of the script that sends the frequency read (FR) command. It is for this reason that I suspect a bug with the firmware. I suspect is is related to the save to eeprom part of the code.
I can reproduce the bug by running the test script twice. I can clear the problem by switching off the emc-30 for about 15 seconds and then switch on power.
My test script is below. This should work with any instrument by changing the "FR" command to something else (eg. "ID")
Is there something I can do the help analyse and troubleshoot this issue?
Dazz