twilight-logic / ar488 Goto Github PK
View Code? Open in Web Editor NEWAR488 Arduino GPIB Interface
License: GNU General Public License v3.0
AR488 Arduino GPIB Interface
License: GNU General Public License v3.0
I have an old device that doesn´t responds to *idn. So I set the interface to respond to that.
But the program sends the *IDN - command in uppercase, so the interface doesn´t react to this command.
My Solution:
change the line (837)
if (strncmp(buffr, "*idn?", 5)==0) {
to
if (strncasecmp(buffr, "*idn?", 5)==0) {
I found a problem that EOS characters will send for every 128 characters when sending long commands.
In AR488.ino, line 2548
if (!err) {
sould be
if (!err && !dataBufferFull) {
Please confirm.
Hello WaveyDipole, greetings from a felow eevblogger!
I downloaded version 0.48.24 and tried to compile it with USE_MACROS defined, but it fails, giving an error about processLine(pBuf, pbPtr, 1) not defined.
Indeed, the function is not present in the code, so I searched through the archives and find it on 0.46.32 code, so I simply copy/pasted it to 0.48.24. After that, it compiled, uploaded ok and I could test it ok with MACRO_0 defined.
I´m lazy enough to no check if there is any update on this function, between these versions, but maybe you want to double check on that.
Thank you for the awesome job on creating this code, I have four adapters built, two using Nanos and two using the LGT8F328P clone and now got all of them upgraded to latest code.
Best Regards,
1xrtt
i have built the interface with an Arduino Mega board, i can not get a connection with the software because it does not recognize it.
i tried a blank Arduino uno and every thing woks so the issue is limited to the Mega boards. other software works fine.
Comments and help file have the incorrect value for the ++mode for device and controller
Hi,
I think I have detected an incompatibility between the AR488 and the Prologix adapter that seems to cause an issue with the KE5FX VNA toolbox.
The issue is with the ++spoll command. The KE5FX software issues it with an address, i.e. ++spoll 16, where 16 is the primary GPIB address of the polled instrument.
Here is the command sequence that works successful with the Prologix adapter in combination with the HP8510B VNA:
++addr
16
++spoll
1
++spoll 16
1
For better visibility I have indented the adapter responses. So far so good.
Now, here is the same sequence using the AR488:
++ver real
AR488 GPIB controller, ver. 0.51.09, 20/06/2022
++addr
16
++spoll
1
++spoll 16
=> no response from the AR488 which causes the KE5FX VNA tool to lock up.
Have I misunderstood something or can there be done something about this problem?
Thanks and best regards,
Tom DG8SAQ
Hi,
Build myself a controller with an ATMEGA328P chip and FR232R module and the 2 SN7516X transceivers.
Using IDE 1.18.15 (Win10) I can compile and upload the sketch just fine, but when I enable SN7516x support bij changing the relevant config lines to:
#define SN7516X
#ifdef SN7516X
#define SN7516X_TE 6
#define SN75161_DC 13
// #define SN7516X_SC 12
#endif
I get a compile error: "AR488 was not declared in this scope" in line 511 of AR488.ino
if (AR488.cmode==2) {
(I did change the pin number for TE from 7 to 6 because I built the controller based on the schematic in the manual that uses pin 6 for TE and 13 for DC, but when I changed TE back to 7 I got the same compile error)
Am I missing something that I should configure?
Thanks,
Mario
I test the device mode function of AR488:
Scenario 1: I connect AR488 and NI-ENET to the GPIB bus at the same time, AR488 as the device, and NI-ENET as the control terminal. NI-ENET lists AR488 in MAX, and AR488 and NI-ENET can read and write data with each other.
Scenario 2: NI-USB-HS as the control terminal and NI-ENET as the device. They can also read and write each other;
Scenario 3: NI-USB-HS is used as the control terminal, and AR488 is used as the device. NI-USB-HS can't find AR488 in MAX. Sending "ibwrt" after connecting directly with "ibdev" command will report an error: "EBUS".
In scenario 3, what do I need to do to make the normal communication between NI-USB-HS and AR488?
three major and three minor questions
0.does this support labview?
1.only use atmega328p/168p direct to rs232 with max232/max3232?
detailed :
1.does atmega 168 works ok?
2.I burn atmega 328/168 with ardunio uno and move to a pcb with power supply, max232/max3232 rs232 TTL voltage converter and then connect COM1 port of computer, and ardunio connect to gbip?
3. I see almost full of converter has sn7516x as isolation why there is no such things?Is it easy to damage atmega328p?
4. If I use another arduino but some pin is occupied by led, can I change the pin?
thanks!
5 atmega 32u4 has internal usb can it be modified to use this?(use lufa get a serial port?)
Thanks for creating this and releasing with a GPL license.
I found changes that improve the ability to send data without needing arbitrary delays.
#if used or of not defines so if any of the USE_SERIAL weren't defined it activated the polling code. Since normally only one is defined the polling was always active.
#if not defined (USE_SERIALEVENT) && not defined (SERIALEVENT1) && not defined (SERIALEVENT2) && not defined (SERIALEVENT3)
And this didn't terminate the loop when it found a command so if two commands were sent close enough together they would be concatenated and it would try to parse them as one command. I made it exit and process the command when found.
while (arSerial->available() && lnRdy == 0) {
This gets it to the state for me on an Uno board that I can send ++ commands without delays and they are correctly processed for the commands I tried.
With these changes I can send another instrument command while the current is processing without delay but can't send more than that without it getting corrupted.
I had started doing some work on a more complete fix before I found the issues above. I think to allow buffering of multiple commands up to buffer size the parsing needs to be separate from the buffering so we don't loose where the command boundaries are. I was looking at changing the serial interrupt/polling to copy to a buffer with a new routine. Those polls could also be put in the instrument transfer loops to allow the non interrupt version to not loose serial data while sending/receiving data. The main loop would then use a modified parseInput which removes the next command from the buffer for processing.
This does complicate readBreak. I wasn't sure how that was supposed to work. Should read exit if anything is received, only if ++ is received, what about if a non ++ command is received before a ++?
Was looking at using circular buffer to make it easy to remove the command processed without clearing the entire buffer and not have race conditions with interrupt.
I also removed this line since it was unlikely to be doing anything useful. If it needs to check those three characters it needs to be three separate comparisons.
Currently its checking for *buffr == 1 since (0 || 10 || 13) == 1
//if (*buffr == (NULL || CR || LF) ) return; // empty line: nothing to parse.
Changes in pull request.
ESP32 directly with wireless builtin would be very great, what is the status of being able to use a nodemcu or equivalent in pin count ?
This is "straight out of the box" no mods /***** FWVER "AR488 GPIB controller, ver. 0.49.14, 02/03/2021" *****/
I have a Sainsmart UNO and a duinotech screw sheild. The IDE is 2:1.0.5+dfsg2-4.1 under Kubuntu.
Below is the error out put after a verify compile.
I have no idea where I should start to sort this.
Help please.
In file included from AR488.ino:13:0:
AR488_Eeprom.h: In function ‘void epViewData(T*)’:
AR488_Eeprom.h:32:12: error: ‘class EEPROMClass’ has no member named ‘get’
EEPROM.get(addr, dbuf);
^
AR488.ino: In function ‘void setup()’:
AR488.ino:564:13: error: ‘flushPbuf’ was not declared in this scope
AR488.ino:603:13: error: ‘initAR488’ was not declared in this scope
AR488.ino:647:36: error: ‘initDevice’ was not declared in this scope
AR488.ino:650:40: error: ‘initController’ was not declared in this scope
AR488.ino: In function ‘void loop()’:
AR488.ino:707:24: error: ‘execCmd’ was not declared in this scope
AR488.ino:714:35: error: ‘sendToInstrument’ was not declared in this scope
AR488.ino:718:25: error: ‘gpibReceiveData’ was not declared in this scope
AR488.ino:723:25: error: ‘gpibReceiveData’ was not declared in this scope
AR488.ino:730:19: error: ‘spoll_h’ was not declared in this scope
AR488.ino:735:52: error: ‘gpibReceiveData’ was not declared in this scope
AR488.ino:741:51: error: ‘sendToInstrument’ was not declared in this scope
AR488.ino:743:15: error: ‘lonMode’ was not declared in this scope
AR488.ino:745:31: error: ‘attnRequired’ was not declared in this scope
AR488.ino:746:51: error: ‘sendToInstrument’ was not declared in this scope
AR488.ino:761:22: error: ‘serialIn_h’ was not declared in this scope
AR488.ino: In function ‘void initDevice()’:
AR488.ino:778:23: error: ‘setGpibControls’ was not declared in this scope
AR488.ino: In function ‘void initController()’:
AR488.ino:788:23: error: ‘setGpibControls’ was not declared in this scope
AR488.ino:792:9: error: ‘ifc_h’ was not declared in this scope
AR488.ino: In function ‘uint8_t serialIn_h()’:
AR488.ino:810:47: error: ‘parseInput’ was not declared in this scope
AR488.ino: In function ‘uint8_t parseInput(char)’:
AR488.ino:867:20: error: ‘addPbuf’ was not declared in this scope
AR488.ino:873:23: error: ‘flushPbuf’ was not declared in this scope
AR488.ino:874:36: error: ‘showPrompt’ was not declared in this scope
AR488.ino:882:38: error: ‘isCmd’ was not declared in this scope
AR488.ino:886:27: error: ‘flushPbuf’ was not declared in this scope
AR488.ino:892:64: error: ‘isIdnQuery’ was not declared in this scope
AR488.ino:894:25: error: ‘flushPbuf’ was not declared in this scope
AR488.ino:911:20: error: ‘addPbuf’ was not declared in this scope
AR488.ino:923:18: error: ‘addPbuf’ was not declared in this scope
AR488.ino:935:19: error: ‘isCmd’ was not declared in this scope
AR488.ino:939:17: error: ‘flushPbuf’ was not declared in this scope
AR488.ino: At global scope:
AR488.ino:1020:23: error: ‘addr_h’ was not declared in this scope
AR488.ino:1021:40: error: ‘aspoll_h’ was not declared in this scope
AR488.ino:1022:23: error: ‘amode_h’ was not declared in this scope
AR488.ino:1023:40: error: ‘clr_h’ was not declared in this scope
AR488.ino:1024:40: error: ‘dcl_h’ was not declared in this scope
AR488.ino:1025:40: error: ‘default_h’ was not declared in this scope
AR488.ino:1026:23: error: ‘eoi_h’ was not declared in this scope
AR488.ino:1027:23: error: ‘eor_h’ was not declared in this scope
AR488.ino:1028:23: error: ‘eos_h’ was not declared in this scope
AR488.ino:1029:23: error: ‘eot_char_h’ was not declared in this scope
AR488.ino:1030:23: error: ‘eot_en_h’ was not declared in this scope
AR488.ino:1031:40: error: ‘ifc_h’ was not declared in this scope
AR488.ino:1032:23: error: ‘id_h’ was not declared in this scope
AR488.ino:1033:23: error: ‘idn_h’ was not declared in this scope
AR488.ino:1034:23: error: ‘llo_h’ was not declared in this scope
AR488.ino:1035:23: error: ‘loc_h’ was not declared in this scope
AR488.ino:1036:23: error: ‘lon_h’ was not declared in this scope
AR488.ino:1037:23: error: ‘macro_h’ was not declared in this scope
AR488.ino:1038:23: error: ‘cmode_h’ was not declared in this scope
AR488.ino:1039:40: error: ‘ppoll_h’ was not declared in this scope
AR488.ino:1040:23: error: ‘read_h’ was not declared in this scope
AR488.ino:1041:23: error: ‘rtmo_h’ was not declared in this scope
AR488.ino:1042:23: error: ‘ren_h’ was not declared in this scope
AR488.ino:1043:23: error: ‘repeat_h’ was not declared in this scope
AR488.ino:1044:40: error: ‘rst_h’ was not declared in this scope
AR488.ino:1045:23: error: ‘trg_h’ was not declared in this scope
AR488.ino:1046:40: error: ‘save_h’ was not declared in this scope
AR488.ino:1047:23: error: ‘setvstr_h’ was not declared in this scope
AR488.ino:1048:23: error: ‘spoll_h’ was not declared in this scope
AR488.ino:1049:40: error: ‘srq_h’ was not declared in this scope
AR488.ino:1050:23: error: ‘srqa_h’ was not declared in this scope
AR488.ino:1051:23: error: ‘stat_h’ was not declared in this scope
AR488.ino:1052:23: error: ‘ton_h’ was not declared in this scope
AR488.ino:1053:23: error: ‘ver_h’ was not declared in this scope
AR488.ino:1054:40: error: ‘verb_h’ was not declared in this scope
AR488.ino:1055:23: error: ‘tmbus_h’ was not declared in this scope
AR488.ino:1056:23: error: ‘xdiag_h’ was not declared in this scope
AR488.ino: In function ‘void sendToInstrument(char*, uint8_t)’:
AR488.ino:1083:28: error: ‘gpibSendData’ was not declared in this scope
AR488.ino: In function ‘void execCmd(char*, uint8_t)’:
AR488.ino:1128:14: error: ‘getCmd’ was not declared in this scope
AR488.ino: In function ‘void read_h(char*)’:
AR488.ino:1502:21: error: ‘gpibReceiveData’ was not declared in this scope
AR488.ino: In function ‘void clr_h()’:
AR488.ino:1509:29: error: ‘addrDev’ was not declared in this scope
AR488.ino:1513:25: error: ‘gpibSendCmd’ was not declared in this scope
AR488.ino:1517:16: error: ‘uaddrDev’ was not declared in this scope
AR488.ino:1522:23: error: ‘setGpibControls’ was not declared in this scope
AR488.ino: In function ‘void llo_h(char*)’:
AR488.ino:1533:31: error: ‘gpibSendCmd’ was not declared in this scope
AR488.ino:1539:33: error: ‘addrDev’ was not declared in this scope
AR488.ino:1544:29: error: ‘gpibSendCmd’ was not declared in this scope
AR488.ino:1549:20: error: ‘uaddrDev’ was not declared in this scope
AR488.ino:1556:23: error: ‘setGpibControls’ was not declared in this scope
AR488.ino: In function ‘void loc_h(char*)’:
AR488.ino:1577:33: error: ‘addrDev’ was not declared in this scope
AR488.ino:1582:29: error: ‘gpibSendCmd’ was not declared in this scope
AR488.ino:1587:20: error: ‘uaddrDev’ was not declared in this scope
AR488.ino:1592:27: error: ‘setGpibControls’ was not declared in this scope
AR488.ino: In function ‘void trg_h(char*)’:
AR488.ino:1650:30: error: ‘addrDev’ was not declared in this scope
AR488.ino:1655:29: error: ‘gpibSendCmd’ was not declared in this scope
AR488.ino:1660:20: error: ‘uaddrDev’ was not declared in this scope
AR488.ino:1667:25: error: ‘setGpibControls’ was not declared in this scope
AR488.ino: In function ‘void spoll_h(char*)’:
AR488.ino:1750:26: error: ‘gpibSendCmd’ was not declared in this scope
AR488.ino:1758:40: error: ‘gpibSendCmd’ was not declared in this scope
AR488.ino:1766:26: error: ‘gpibSendCmd’ was not declared in this scope
AR488.ino:1787:36: error: ‘gpibSendCmd’ was not declared in this scope
AR488.ino:1796:27: error: ‘setGpibControls’ was not declared in this scope
AR488.ino:1799:41: error: ‘gpibReadByte’ was not declared in this scope
AR488.ino:1829:26: error: ‘gpibSendCmd’ was not declared in this scope
AR488.ino:1837:26: error: ‘gpibSendCmd’ was not declared in this scope
AR488.ino:1845:26: error: ‘gpibSendCmd’ was not declared in this scope
AR488.ino:1853:23: error: ‘setGpibControls’ was not declared in this scope
AR488.ino: In function ‘void stat_h(char*)’:
AR488.ino:1884:17: error: ‘setSrqSig’ was not declared in this scope
AR488.ino:1887:17: error: ‘clrSrqSig’ was not declared in this scope
AR488.ino: In function ‘void dcl_h()’:
AR488.ino:1963:26: error: ‘gpibSendCmd’ was not declared in this scope
AR488.ino:1968:23: error: ‘setGpibControls’ was not declared in this scope
AR488.ino: In function ‘void ppoll_h()’:
AR488.ino:2004:23: error: ‘setGpibControls’ was not declared in this scope
AR488.ino: In function ‘void setvstr_h(char*)’:
AR488.ino:2073:16: error: ‘id_h’ was not declared in this scope
AR488.ino: In function ‘void repeat_h(char*)’:
AR488.ino:2159:42: error: ‘gpibSendData’ was not declared in this scope
AR488.ino:2161:25: error: ‘gpibReceiveData’ was not declared in this scope
AR488.ino: In function ‘void xdiag_h(char*)’:
AR488.ino:2241:29: error: ‘setGpibControls’ was not declared in this scope
AR488.ino:2243:29: error: ‘setGpibControls’ was not declared in this scope
AR488.ino: In function ‘void attnRequired()’:
AR488.ino:2394:23: error: ‘setGpibControls’ was not declared in this scope
AR488.ino:2403:42: error: ‘gpibReadByte’ was not declared in this scope
AR488.ino:2434:29: error: ‘unl_h’ was not declared in this scope
AR488.ino:2437:29: error: ‘unt_h’ was not declared in this scope
AR488.ino:2452:11: error: ‘mla_h’ was not declared in this scope
AR488.ino:2463:13: error: ‘spe_h’ was not declared in this scope
AR488.ino:2467:13: error: ‘mta_h’ was not declared in this scope
AR488.ino:2477:11: error: ‘spd_h’ was not declared in this scope
AR488.ino: In function ‘void mla_h()’:
AR488.ino:2495:19: error: ‘gpibReceiveData’ was not declared in this scope
AR488.ino: In function ‘void spe_h()’:
AR488.ino:2526:18: error: ‘gpibSendStatus’ was not declared in this scope
AR488.ino: In function ‘void lonMode()’:
AR488.ino:2558:19: error: ‘gpibReceiveData’ was not declared in this scope
AR488.ino: In function ‘bool gpibSendCmd(uint8_t)’:
AR488.ino:2576:23: error: ‘setGpibControls’ was not declared in this scope
AR488.ino:2579:31: error: ‘gpibWriteByte’ was not declared in this scope
AR488.ino: In function ‘void gpibSendStatus()’:
AR488.ino:2601:23: error: ‘setGpibControls’ was not declared in this scope
AR488.ino:2602:27: error: ‘gpibWriteByte’ was not declared in this scope
AR488.ino: In function ‘void gpibSendData(char*, uint8_t)’:
AR488.ino:2620:33: error: ‘addrDev’ was not declared in this scope
AR488.ino:2637:25: error: ‘setGpibControls’ was not declared in this scope
AR488.ino:2640:25: error: ‘setGpibControls’ was not declared in this scope
AR488.ino:2652:34: error: ‘gpibWriteByte’ was not declared in this scope
AR488.ino:2655:94: error: ‘gpibWriteByte’ was not declared in this scope
AR488.ino:2671:23: error: ‘gpibWriteByte’ was not declared in this scope
AR488.ino:2678:23: error: ‘gpibWriteByte’ was not declared in this scope
AR488.ino:2701:22: error: ‘uaddrDev’ was not declared in this scope
AR488.ino:2712:25: error: ‘setGpibControls’ was not declared in this scope
AR488.ino:2716:25: error: ‘setGpibControls’ was not declared in this scope
AR488.ino: In function ‘bool gpibReceiveData()’:
AR488.ino:2751:31: error: ‘addrDev’ was not declared in this scope
AR488.ino:2759:45: error: ‘Wait_on_pin_state’ was not declared in this scope
AR488.ino:2761:25: error: ‘setGpibControls’ was not declared in this scope
AR488.ino:2766:25: error: ‘setGpibControls’ was not declared in this scope
AR488.ino:2794:45: error: ‘gpibReadByte’ was not declared in this scope
AR488.ino:2827:42: error: ‘isTerminatorDetected’ was not declared in this scope
AR488.ino:2873:18: error: ‘uaddrDev’ was not declared in this scope
AR488.ino:2878:25: error: ‘setGpibControls’ was not declared in this scope
AR488.ino:2882:25: error: ‘setGpibControls’ was not declared in this scope
AR488.ino: In function ‘uint8_t gpibReadByte(uint8_t*, bool*)’:
AR488.ino:2963:45: error: ‘Wait_on_pin_state’ was not declared in this scope
AR488.ino:2983:46: error: ‘Wait_on_pin_state’ was not declared in this scope
AR488.ino: In function ‘bool gpibWriteByte(uint8_t)’:
AR488.ino:3007:34: error: ‘gpibWriteByteHandshake’ was not declared in this scope
AR488.ino: In function ‘bool gpibWriteByteHandshake(uint8_t)’:
AR488.ino:3027:46: error: ‘Wait_on_pin_state’ was not declared in this scope
AR488.ino:3032:47: error: ‘Wait_on_pin_state’ was not declared in this scope
AR488.ino:3044:46: error: ‘Wait_on_pin_state’ was not declared in this scope
AR488.ino:3050:47: error: ‘Wait_on_pin_state’ was not declared in this scope
This code handling UNT and UNL seems to set its flags in a strange way
AR488.ino line 2382
if (ustat & 0x01) {
if (!device_unl_h()) ustat &= 0x01; // Clears bit if UNL was not required
}
/***** Try to untalk bus *****/
if (ustat & 0x01) { // ? 0x2
if (!device_unt_h()) ustat &= 0x02; // Clears bit if UNT was not required
}
Second one would appear should if(ustat & 0x2) and to clear the bit maybe an XOR rather than &= ? Don't think the bit clearing is very important though!
First I want to thank you for your efforts. I have built some AR488 with 32U pro micro boards (Artags design) and contributed the 3d printed case for it in EEVBlog. I used the version 0.49.12 from your site but as I ran into some issues, I compiled the latest with no change (besides having ++help).
I can use basic communication with my instruments using a terminal software. Simple commands and queries like "++addr 29", "++auto 1" and "*IDN?" are working fine.
First I found out that the prologix configurator from John Miles sites checks the version string of the adapter. It scans for "ersion %d.%d" into major and minor and uses major*1000+minor (and an optional character at byte position 11). It seems to distinguish three versions: 3.12C, 4.40 and 6.102 to fine tune settings. So I changed the reported version with ++id verstr AR488 version 6.102 to the highest version. This solved the issue that the configurator was not able to use the AR488. Sending and receiving is working in the terminal window and settings control and device mode as well as autoread checkboxes and/or the manual read. Lower versions where tested but I found no obvious differences.
The 7470 plotter emulater is not working, neither in "request plot from supported device at address 29" (Tek in full control @29), which will "hang" at received bytes 0, nor with "wait for device initiated plot" in listen-only (Tek in talk-only), which will receive 0 bytes as well. Both functions work well using a Agilent 82357B with Agilent IOlibrary.
The tdsdump.bat example from the KE5FX packages is not working either with the AR488.
Using the terminal, I can send the corresponding commands to the device and perform a "++read" after "HARDCOPY START" command. It reads the HPGL data from the device.
Using 7470.exe with "request plot from supported device at address 29" and stopping the program, I can read the hardcopy with the terminal program just performing a "++read" after switching to "++mode 1", the KE5FX library seems to swich to listen. I can crash the 7470 program by performing two "request plot from supported device at address 29", the second being aborted with a message that the identification is invalid and stating parts of the HPGL plot, presumingly from the first initated hardcopy that was aborted by keypress.
Any help how to proceed in systematic testing is appreciated.
Experimenting further, I was not able to use the listen-only in success with the Tek. Sending "++lon 1", it keeps reading "1 bytes" in a loop with timeout. Initiating a hardcopy from the Tek does not produce any data. Furthermore I was not able to stop the polling loop with any ++ command, how is this expected to work?
As this is not a real problem report, any other method of communication (email, chat) is of course accepted to not fill the tracker with bloat. I can produce logs and dumps if needed. Haven't recompiled the KE5FX software yet as my VS2019 compiler spit out some errors.
Hello,
I tried to run the AR488.ino on Arduino Pro Micro, but I do not get any answer from the FW.
After the debug I found that if I comment out USE_SERIALEVENT, the code is working.
This is not request for bug fixing, just a tip for workaround if somebody have the same problem.
I do not have time to investigate why the original code does not work.
Regards,
Krasimir Kostadinov
noticed tmbus is commented out at several places in source
ex;
AR488.ino: line 981 // { "tmbus", 3, tmbus_h },
line 2192-2206
AR488_GPIBbus.cpp line 871 // delayMicroseconds(AR488.tmbus);
AR488_GPIBbus.h line 108 // uint16_t tmbus;
I'm not quite a good enough programmer, so I went back down to a copy of 0.49.14 from the source archive. Thanks.
also: I've selected Nano, and Uno commented in config.h, if that makes a diff
I'm sorry if this issue/question has already been posted, but I have been using my AR488 with an old Tektronix 'scope. With default AR488 settings it works well for sending and receiving 'standard' messages, such as *idn?.
However, I wanted to receive binary data which contains LF and CR characters, so I configured my AR488 to use EOI to signal the end of each message with "++eoi 1" and "++eos 3". But this stopped all communication from working.
Clearly the issue was with the EOI signal, and a quick look at the AR488 source code showed that the AR488 asserts EOI (for 40us) after the last character of a message has been read and acknowledged by the device. I'm not an IEEE488 expert by any means, but I think that the standard says EOI will be asserted during the last character of the message, rather than afterwards. The really strange thing is that the AR488 firmware has clearly been written to function as I would expect, but then modified to behave differently.
As soon as I changed the firmware to assert EOI during the last character of each message, everything starting working. Has anyone else encountered this, and is it a bug or a feature, please?
Best wishes to you all, Alan.
Hi,
I thought I had a uno with blown pin 3 (REN), as it is always ~0v (active), but with another sketch (blink sketch, modified to use that pin) it cycles.
I tried another uno and a duemilanove (which also uses the atmega328p) - on both, the pin works with a test sketch but doesn't seem to work with the AR488 sketch uploaded.
None of the following change the state of that pin:
++xdiag 1 32
(assert REN)++xdiag 1 255
(assert all)++xdiag 1 0
(assert none)The latter two do change the state of other pins.
++mode
reports 1, so it should be in controller mode.
Is it to be expected that the pin is not driven high? The documentation of xdiag
makes it sound like it should change state, same as other pins...
I'm using rev ae02a63 (Mar 18), which looks to still be HEAD.
Hello, i have strange issue with AR488.
My configuration:
AR488 GPIB controller, ver. 0.49.14, 02/03/2021
AR488_NANO
AR_SERIAL_BAUD 115200
++auto 1
++addr 5
When i send first 3 commands to HP7475A plotter, it is recognized and processed:
Initialised GPIB control mode
parseInput: Received SP0;
R: 2
BufferStatus: 2
sendToInstrument: Received for sending: 53 50 30 3B
Set GPIB lines for sending a command
Set GPIB lines for sending a command
Set GPIB lines for sending a command
Device addressed.
Set GPIB lines for writing data
Set write data mode.
Send->SP0;<-End.
Appended CR
Appended LF
Set GPIB lines for sending a command
Set GPIB lines for sending a command
Unlisten done
Set GPIB lines to idle state
<- End of send.
sendToInstrument: Sent.
Set GPIB lines for sending a command
Set GPIB lines for sending a command
Set GPIB lines for sending a command
Set GPIB lines for reading data
gpibReceiveData: Start listen ->
Before loop flags:
TRNb: 0
rEOI: 0
ATN: 0
0
After loop flags:
ATN: 0
TMO: 1
Set GPIB lines for sending a command
Set GPIB lines for sending a command
Set GPIB lines to idle state
<- End listen.
parseInput: Received SP1;
R: 2
BufferStatus: 2
sendToInstrument: Received for sending: 53 50 31 3B
Set GPIB lines for sending a command
Set GPIB lines for sending a command
Set GPIB lines for sending a command
Device addressed.
Set GPIB lines for writing data
Set write data mode.
Send->SP1;<-End.
Appended CR
Appended LF
Set GPIB lines for sending a command
Set GPIB lines for sending a command
Unlisten done
Set GPIB lines to idle state
<- End of send.
sendToInstrument: Sent.
Set GPIB lines for sending a command
Set GPIB lines for sending a command
Set GPIB lines for sending a command
Set GPIB lines for reading data
gpibReceiveData: Start listen ->
Before loop flags:
TRNb: 0
rEOI: 0
ATN: 0
0
After loop flags:
ATN: 0
TMO: 1
Set GPIB lines for sending a command
Set GPIB lines for sending a command
Set GPIB lines to idle state
<- End listen.
parseInput: Received SP2;
R: 2
BufferStatus: 2
sendToInstrument: Received for sending: 53 50 32 3B
Set GPIB lines for sending a command
Set GPIB lines for sending a command
Set GPIB lines for sending a command
Device addressed.
Set GPIB lines for writing data
Set write data mode.
Send->SP2;<-End.
Appended CR
Appended LF
Set GPIB lines for sending a command
Set GPIB lines for sending a command
Unlisten done
Set GPIB lines to idle state
<- End of send.
sendToInstrument: Sent.
Set GPIB lines for sending a command
Set GPIB lines for sending a command
Set GPIB lines for sending a command
Set GPIB lines for reading data
gpibReceiveData: Start listen ->
Before loop flags:
TRNb: 0
rEOI: 0
ATN: 0
0
After loop flags:
ATN: 0
TMO: 1
Set GPIB lines for sending a command
Set GPIB lines for sending a command
Set GPIB lines to idle state
<- End listen.
But after 3 command, its sended only part of string (S, instead SP3;)
(line: Send->S<-End.), and working again after plotter turn off/on.
parseInput: Received SP3;
R: 2
BufferStatus: 2
sendToInstrument: Received for sending: 53 50 33 3B
Set GPIB lines for sending a command
Set GPIB lines for sending a command
Set GPIB lines for sending a command
Device addressed.
Set GPIB lines for writing data
Set write data mode.
Send->S<-End.
Set GPIB lines to idle state
<- End of send.
sendToInstrument: Sent.
Set GPIB lines for sending a command
Set GPIB lines for sending a command
Set GPIB lines for sending a command
Set GPIB lines for reading data
gpibReceiveData: Start listen ->
Before loop flags:
TRNb: 0
rEOI: 0
ATN: 0
0
After loop flags:
ATN: 0
TMO: 1
Set GPIB lines for sending a command
Set GPIB lines for sending a command
Set GPIB lines to idle state
<- End listen.
If i use ++auto 0 or swith DIPs on plotter to only listener mode, it is work without problems, but i need also use listen mode for OA; command (pen position), that's not work without listener is active.
Thanks for help.
This is a great project, and it worked first time for me, using a nano. I had one problem though: the macro 0 example ends the last line with \n, but I found this gave an "Unrecognized command" error. Changing to just \ (ie omitting the LF on the final line) fixed things. So
#define MACRO_0 "\ ++auto 3\n\ ++read\ "
works, but ending ++read\n\
does not.
..does not compile. Errors are
AR488-0-45-10:758: error: invalid conversion from 'void ()()' to 'void ()(char*)' [-fpermissive]
plenty of them..
AR488-0-45-10:758: error: invalid conversion from 'void ()()' to 'void ()(char*)' [-fpermissive]
UPDATE:
error handling seems to have been downgraded to warnings after updating Arduino IDE fro 1.6.5 to 1.8.19
Kutte
Thanks for the great work, I have a number of these devices connected to instruments here and there, incredibly useful.
I'm atm working with a Tektronix scope, trying to get binary data from it, using a atmega32u4 device (back of the connector board). ++ver AR488 GPIB controller, ver. 0.51.15, 12/10/2022
I'm seeing a reproducible crash once the transfer reaches a certain point. Several 10s of kB. It is not clear if it is data dependent (although there is nothing special about the place in the data stream where the crash occurs), byte or transfer count dependent (although it does happen at the same place with the same data), or something related to the instrument (e.g. timeout).
The symptom is at a certain point, the AR488 device will appear to hang, and then disappear from the USB bus. It leaves the MacOS CDC driver in an inconsistent state also. It is not certain that the instrument will crash, but it often hangs... causality of that is unclear.
What is a good way to debug this? That is, how have the developers been debugging such issues?
Thanks again in advance.
Shouldn't the manual point out that it is good to have a ground connection?
(Or, actually, seven of them?)
Maybe too obvious to an EE :-)
Fresh install of Arduino IDE 2.0 and 1.8.19 generates a compile time error w/ AR488 0.51.09:
"DEVNULL.h missing"
solved by adding official DEVNULL library using Arduino IDE "Libraries Manager"
described more here: https://www.arduino.cc/reference/en/libraries/devnull/
The value of the 'auto' setting is not being saved in EEPROM when using the ++savecfg command.
Reported after testing by maxwell3e10 via EEVblog.
Hello,
When attempting a first-time compile with MEGA 2560 board selected, I receive this error. I looked through the documentation and prior issues, but was unable to find a match for what I'm facing. Thanks very much in advance!
AR488_Layouts.cpp:1241:3: error: 'mcpPinAssertedReg' was not declared in this scope
mcpPinAssertedReg = 0;
^~~~~~~~~~~~~~~~~
AR488_Layouts.cpp:1310:7: error: 'mcpPinAssertedReg' was not declared in this scope
mcpPinAssertedReg = mcpByteRead(MCPINTCAPA);
^~~~~~~~~~~~~~~~~
AR488_Layouts.cpp:1314:39: error: 'gpibsig' was not declared in this scope
return (mcpPinAssertedReg & (1<<gpibsig));
^~~~~~~
exit status 1
'mcpPinAssertedReg' was not declared in this scope
With current master branch (hash: f5c948f with the patch below) 0.51.18 on a handwired protoboard using a PJRC Teensy 3.1 and SN75160/SN75161 transceiver chips.
diff --git a/src/AR488/AR488.ino b/src/AR488/AR488.ino
index efe34c9..2d54271 100644
--- a/src/AR488/AR488.ino
+++ b/src/AR488/AR488.ino
@@ -288,6 +288,10 @@ void setup() {
digitalWrite(LED_BUILTIN, LOW);
#endif
+#ifdef SN7516X_PE
+ pinMode(SN7616X_PE, OUTPUT);
+ digitalWrite(SN7616X_PE, HIGH);
+#endif
#ifdef PIN_REMOTE
pinMode(PIN_REMOTE, OUTPUT);
@@ -1480,7 +1484,7 @@ void rst_h() {
};
#else
// Otherwise restart program (soft reset)
- asm volatile (" jmp 0");
+ // asm volatile (" jmp 0");
#endif
}
diff --git a/src/AR488/AR488_Config.h b/src/AR488/AR488_Config.h
index 057a973..f98c865 100644
--- a/src/AR488/AR488_Config.h
+++ b/src/AR488/AR488_Config.h
@@ -24,7 +24,7 @@
/*
* Uncomment to use custom board layout
*/
-//#define AR488_CUSTOM
+#define AR488_CUSTOM
/*
* Configure the appropriate board/layout section
@@ -155,14 +155,15 @@
* This will require the use of an additional GPIO pin to control
* the read and write modes of the ICs.
*/
-//#define SN7516X
+#define SN7516X
#ifdef SN7516X
// #define SN7516X_TE 6
// #define SN7516X_DC 13
// #define SN7516X_SC 12
// ONLYA board
- #define SN7516X_TE 13
- #define SN7516X_DC 5
+ #define SN7516X_TE 16
+ #define SN7516X_DC 17
+ #define SN7616X_PE 19
#endif
@@ -265,24 +266,25 @@
/***** vvvvvvvvvvvvvvvvvvv *****/
#ifdef AR488_CUSTOM
-#define DIO1 A0 /* GPIB 1 */
-#define DIO2 A1 /* GPIB 2 */
-#define DIO3 A2 /* GPIB 3 */
-#define DIO4 A3 /* GPIB 4 */
-#define DIO5 A4 /* GPIB 13 */
-#define DIO6 A5 /* GPIB 14 */
-#define DIO7 4 /* GPIB 15 */
-#define DIO8 5 /* GPIB 16 */
-
-#define IFC 8 /* GPIB 9 */
-#define NDAC 9 /* GPIB 8 */
-#define NRFD 10 /* GPIB 7 */
-#define DAV 11 /* GPIB 6 */
-#define EOI 12 /* GPIB 5 */
-
-#define SRQ 2 /* GPIB 10 */
-#define REN 3 /* GPIB 17 */
-#define ATN 7 /* GPIB 11 */
+// PORT D
+#define DIO1 2
+#define DIO2 14
+#define DIO3 7
+#define DIO4 8
+#define DIO5 6
+#define DIO6 20
+#define DIO7 21
+#define DIO8 5
+
+// PORT C
+#define IFC 15
+#define NDAC 22
+#define NRFD 23
+#define DAV 9
+#define EOI 10
+#define SRQ 11
+#define REN 13
+#define ATN 12
#endif
/***** ^^^^^^^^^^^^^^^^^^^ *****/
I started to play with AR488 in order to talk to an HP 7440A Pen Plotter. Not getting any response, I began probing with a DVM and ++xdiag, and found that two pins (SRQ and DAV) leading to from the Teensy to the SN75161 were not asserting successfully, instead of zero volts, I see about 0.5V instead, not low enough to cause the GPIB side of the SN75161 chip to go low. I don't see an electrical problem on the board (no shorts or opens that I can find).
When compiling the following error is returned:
AR488-0-45-10.ino: In function 'bool gpibSendData(char*, uint8_t)':
AR488-0-45-10:1964: error: return-statement with no value, in function returning 'bool' [-fpermissive]
If you have a read from device in progress such as ++read eoi and the device wasn't set to send eoi you can't use a ++ command to recover.
hello,
I have here 34401a and was just wondering which MCU is best option. For my own situation: i have a variety here. But do not want to be bothered too much with custom PCB. Unless it can be justified, for example to make a better compatibility etc.
PC runs linux
Please let me know what to choose. Many thanks
I am getting incorrect characters when trying to read HP3478A calibration memory at locations 10 and 27.
I am writing Wxx\n (87,xx,10) to the AR488 where xx is the memory location from 0 to 255, for escaped characters I am writing (87,27,xx,10), but if xx is 10, 13, or 27 nothing is written to the bus.
Monitoring the GPIB bus with another AR488 it appears the numbers 10, 13 and 27 are not being sent on the bus even though they are escaped with 27 (0x1B). Other numbers escaped with 27 get through to the bus.
Is this a firmware bug or am I doing something wrong?
There only seem to be a few instances of digitalWrite(SN7516X_DC, LOW or HIGH). And yet, according to the SN75161 datasheet on the second page's "SN75161B RECEIVE/TRANSMIT" function table, this is an important bit in setting the direction of the control lines through the chip to allow the appropriate handshaking. Furthermore, the pin directions set in the AR488_GPIBbus.cpp code seem inconsistent with the TE and DC levels set, according to the table.
Sorry for interrupting your recovery but I think you want to know this.
/***** FWVER "AR488 GPIB controller, ver. 0.51.07, 05/05/2022" *****/
++id verstr
Returns "Unrecognized command"
Got it working by changing line 2231 in AR488.ino from
if (strncmp(keyword, "verstr", 6)==0) {
to
if (strncasecmp(keyword, "verstr", 6)==0) {
"#ifdef AVR" in the manual shows two lines of " #endif" but the actual file has three lines of " #endif" . So which is correct? Do I remove or add a" #endif" ?
Reported by user Krampmeier on EEVblog, using version v0.46.10.
Version 0.46.01:
Communication with my HP 4192A impedance analyzer sees to work fine, but when I sent *IDN? to a Keithley 2001, the first 1 to 3 characters of the response were always wrong. Same with a Keithley 2010.
I just tried it again:
Quote
*idn?
++read
OEITHLEY INSTRUMENTS INC.,MODEL 2010,0632912,A15 /A02
fetch?
++read
m9.59916086E-01
:SENS:FUNC?
++read
bVOLT:DC"
Edit: I just noticed that the Keithley's display twitches when I send the ++read command. The instrument also clears the "REM" indicator, so it goes out of remote mode. Hmmm. Did I make a mistake in the wiring?
Version 0.46.10:
It compiled just fine, but I still get the problems with the first character of the device response, and the device going out of remote mode.
Keithley 2010
Code: [Select]
AR488 GPIB controller, version 0.46.10, 02/03/2019
⸮5.49378228E-01
OEITHLEY INSTRUMENTS INC.,MODEL 2010,0632912,A15 /A02
Keysight E36312A
Code: [Select]
⸮eysight Technologies,E36312A,MY57290136,1.1.1-1.0.2-1.05
Keithley 196 - no communication at all, does not go into remote mode. Broken GPIB interface?
Adret 103A - works fine, but this is a "listen only" device.
Any ideas on what might be going wrong with the Keithley and Keysight devices?
I use about one meter of ribbon cable, not a genuine GPIB cable, but I have seen GPIB work fine with much longer ribbon cables, and 8 devices on the bus...
Edit:
The effect changes when DEBUG7 is defined and I switch verbose mode on:
Code: [Select]
*idn?
++read
OAfter loop:
2
0
0
Bytes read: 1
++read
MTHLEY INSTRUMENTS INC.,MODEL 2010,0632912,A15 /A02
After loop:
2
0
0
Bytes read: 54
I don't quite understand the current state of device mode.
Is it possible to use the arduino as a device with a specific IEEE488 address, so i can communicate with it without just forwarding the data to a serial port?
For example making write/read/query operations to the device over GPIB to e.g. return the state of a I/O?
Hi,
this project looks very interesting, and I'd like to help for an ESP32 version of the code.
However a few things look a bit strange with the way the git repo is managed:
Would you consider these improvements? Would you like some help for this?
Thank you
David
in ArduinoDroid apk
AR488.ino: In function 'void setup()':
AR488.ino:383:13: error: 'flushPbuf' was not declared in this scope
AR488.ino: In function 'void loop()':
AR488.ino:568:24: error: 'execCmd' was not declared in this scope
AR488.ino:575:35: error: 'sendToInstrument' was not declared in this scope
AR488.ino:620:15: error: 'tonMode' was not declared in this scope
AR488.ino:622:15: error: 'lonMode' was not declared in this scope
AR488.ino:625:20: error: 'attnRequired' was not declared in this scope
AR488.ino:631:33: error: 'flushPbuf' was not declared in this scope
AR488.ino:659:48: error: 'serialIn_h' was not declared in this scope
AR488.ino: In function 'uint8_t serialIn_h()':
AR488.ino:702:46: error: 'parseInput' was not declared in this scope
AR488.ino: In function 'uint8_t parseInput(char)':
AR488.ino:746:20: error: 'addPbuf' was not declared in this scope
AR488.ino:752:23: error: 'flushPbuf' was not declared in this scope
AR488.ino:755:26: error: 'showPrompt' was not declared in this scope
AR488.ino:764:38: error: 'isCmd' was not declared in this scope
AR488.ino:768:27: error: 'flushPbuf' was not declared in this scope
AR488.ino:774:70: error: 'isIdnQuery' was not declared in this scope
AR488.ino:776:25: error: 'flushPbuf' was not declared in this scope
AR488.ino:793:20: error: 'addPbuf' was not declared in this scope
AR488.ino:805:18: error: 'addPbuf' was not declared in this scope
AR488.ino:817:19: error: 'isCmd' was not declared in this scope
AR488.ino:821:17: error: 'flushPbuf' was not declared in this scope
AR488.ino: At global scope:
AR488.ino:904:23: error: 'addr_h' was not declared in this scope
AR488.ino:905:40: error: 'aspoll_h' was not declared in this scope
AR488.ino:906:23: error: 'amode_h' was not declared in this scope
AR488.ino:907:40: error: 'clr_h' was not declared in this scope
AR488.ino:908:40: error: 'dcl_h' was not declared in this scope
AR488.ino:909:40: error: 'default_h' was not declared in this scope
AR488.ino:910:23: error: 'eoi_h' was not declared in this scope
AR488.ino:911:23: error: 'eor_h' was not declared in this scope
AR488.ino:912:23: error: 'eos_h' was not declared in this scope
AR488.ino:913:23: error: 'eot_char_h' was not declared in this scope
AR488.ino:914:23: error: 'eot_en_h' was not declared in this scope
AR488.ino:915:23: error: 'help_h' was not declared in this scope
AR488.ino:916:40: error: 'ifc_h' was not declared in this scope
AR488.ino:917:23: error: 'id_h' was not declared in this scope
AR488.ino:918:23: error: 'idn_h' was not declared in this scope
AR488.ino:919:23: error: 'llo_h' was not declared in this scope
AR488.ino:920:23: error: 'loc_h' was not declared in this scope
AR488.ino:921:23: error: 'lon_h' was not declared in this scope
AR488.ino:922:23: error: 'macro_h' was not declared in this scope
AR488.ino:923:40: error: 'sendmla_h' was not declared in this scope
AR488.ino:924:23: error: 'cmode_h' was not declared in this scope
AR488.ino:925:23: error: 'sendmsa_h' was not declared in this scope
AR488.ino:926:40: error: 'sendmta_h' was not declared in this scope
AR488.ino:927:40: error: 'ppoll_h' was not declared in this scope
AR488.ino:928:23: error: 'prom_h' was not declared in this scope
AR488.ino:929:23: error: 'read_h' was not declared in this scope
AR488.ino:930:23: error: 'rtmo_h' was not declared in this scope
AR488.ino:931:23: error: 'ren_h' was not declared in this scope
AR488.ino:932:23: error: 'repeat_h' was not declared in this scope
AR488.ino:933:40: error: 'rst_h' was not declared in this scope
AR488.ino:934:23: error: 'trg_h' was not declared in this scope
AR488.ino:935:40: error: 'save_h' was not declared in this scope
AR488.ino:936:23: error: 'setvstr_h' was not declared in this scope
AR488.ino:937:23: error: 'spoll_h' was not declared in this scope
AR488.ino:938:40: error: 'srq_h' was not declared in this scope
AR488.ino:939:23: error: 'srqa_h' was not declared in this scope
AR488.ino:940:23: error: 'stat_h' was not declared in this scope
AR488.ino:941:23: error: 'ton_h' was not declared in this scope
AR488.ino:942:40: error: 'unlisten_h' was not declared in this scope
AR488.ino:943:40: error: 'untalk_h' was not declared in this scope
AR488.ino:944:23: error: 'ver_h' was not declared in this scope
AR488.ino:945:40: error: 'verb_h' was not declared in this scope
AR488.ino:946:23: error: 'xdiag_h' was not declared in this scope
AR488.ino: In function 'void execCmd(char*, uint8_t)':
AR488.ino:1036:15: error: 'getCmd' was not declared in this scope
AR488.ino: In function 'void setvstr_h(char*)':
AR488.ino:1958:16: error: 'id_h' was not declared in this scope
AR488.ino: In function 'void attnRequired()':
AR488.ino:2450:21: error: 'device_listen_h' was not declared in this scope
AR488.ino:2457:23: error: 'device_unl_h' was not declared in this scope
AR488.ino:2462:23: error: 'device_unt_h' was not declared in this scope
AR488.ino:2521:26: error: 'execGpibCmd' was not declared in this scope
AR488.ino:2548:23: error: 'device_listen_h' was not declared in this scope
AR488.ino:2560:21: error: 'device_talk_h' was not declared in this scope
AR488.ino: In function 'void execGpibCmd(uint8_t)':
AR488.ino:2615:22: error: 'device_spe_h' was not declared in this scope
AR488.ino:2622:22: error: 'device_spd_h' was not declared in this scope
AR488.ino:2626:22: error: 'device_unl_h' was not declared in this scope
AR488.ino:2630:22: error: 'device_unt_h' was not declared in this scope
AR488.ino:2634:22: error: 'device_sdc_h' was not declared in this scope
Return code is not 0
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.