Agilent 66332A DC Source RS232 Ubuntu 12.04 SCPI - serial-port

I have an Agilent 66332A DC Source, and I want to program it so that I can set the current, voltage, and output on/off. I'm using Ubuntu 12.04 64bit so the drivers don't work. I've contacted Agilent support, and they gave me nothing. I know that the DC source uses SCPI. Is there some way that I can talk to the DC source using the terminal and send SCPI commands? I've tried minicom, but I couldn't get it to work. I'm using a RS232 connection.

There might be manual for this DC source so read SCPI commands from there.
I assume that minicom sends line-feed character after each enter you press, but SCPI requires \n for command separator. Hence the Minicom does not work.
However you can just echo commands to serial port from bash command line.
Setup serial port
stty -F /dev/ttyS0 raw speed 9600 -cstopb cs8 -ixon
Echo commands to /dev/ttyS0
echo -en '*RST\n' > /dev/ttyS0
Notice: I'm assuming your device is connected to /dev/ttyS0.

Related

Android Things: Connect to Serial Debug Console

I've been trying to connect to the serial console of a Raspberry Pi 3 with Android Things using USB to TTL cable from my Linux (Ubuntu) machine. Despite I connected the cable as per the documentation, all I get when executing the minicom command is the following
with no chance to type in any character. So I neither can see any kernel messages nor shell into the device.
What am I missing?
Linux (Ubuntu)
What's in?
GNU Screen
Minicom
minicom one-line-command (short answer)
minicom UI (long answer, detailed)
GNU Screen
Run in terminal
sudo screen port_name 115200
See below (step 2) to find out port_name, e.g /dev/ttyUSB0. Hit Ctrl-A, then K, then Y to exit screen. Execute sudo apt-get install screen if not installed.
Minicom
Short answer
Run in terminal
sudo minicom -b 115200 -o -D port_name
See below (step 2) to find out port_name, e.g /dev/ttyUSB0. Hit Ctrl-A, then X to exit minicom.
Long answer (UI)
minicom should be properly configured in order to open the connection. The general steps are as follows:
Install minicom with
sudo apt-get install minicom
Connect Rpi3 with your host machine using USB-to-TTL cable and open the terminal. Find the tty connections with
dmesg | grep -e tty
In my case I get
where ttyUSB0 is the board.
Run minicom and select the serial port setup with
sudo minicom -s
You should see
Check (or set) the settings for the tty connection. Make sure that /dev/ttyX corresponds to your connection, the one you get in the step 2 instead of X, and Bps/Par/Bits set as per the documentation.
Similar to
Now hit Exit and, if everything had been properly set up, the connection should be running. If you type the ls command you should see Android Thing's root directory
For exiting minicom hit Ctrl-A, then hit Q, then Yes:
Windows (with PuTTY)
Install PuTTY
Connect the board to machine with USB-to-TTL cable and find out the COM port using Windows Device Manager. You should look for the the one called USB Serial Port (in my case it was COM3).
Run PuTTY and set it up. Use the speed as per the documentation (115200):
Hit Open and type a command in a terminal window popped up.
I'm going to suggest some troubleshooting advice based in my own experience:
Make sure you have the Tx and Rx cables connected correctly because all the other settings won't give you any warning, minicom would connect beautifully to the USB adapter but no info on your screen from your Pi.
I didn't use a USB to TTL like the one you are using, mine has the labels for Tx and Rx inverted on the board. Took me some time and the help of an oscilloscope to figure out what was going on.

How to read arduino flash memory

Imagine i'have lost my source code.
Is there a way to dump an arduino flash memory ?
What i want to do is to get an hex file on my PC that represent byte per byte the arduino flash memory (including bootloader)
I have 3 arduino types:
Arduino UNO (rev3)
Arduino MEGA
Leonardo Ethernet
Thanks
avrdude can do that for you. The specifics will depend on which arduino you have, but something like:
avrdude -p m328p -P usb -c usbtiny -U flash:r:flash.bin:r
will get you the contents of the flash memory.
Here's a site with more info:
http://www.evilmadscientist.com/2011/avr-basics-reading-and-writing-flash-contents/
It seems that using an Arduino board, the programmer (option -c) must be set to arduino (see the avrdude manual for details). Also, I had to specify the ACM port (in my case /dev/ttyACM0 on a Linux machine).
The full command to read (and backup the flash to flash.bin) is thus:
avrdude -p m328p -P /dev/ttyACM0 -c arduino -U flash:r:flash.bin:r
And to restore the flash, you can use:
avrdude -p m328p -P /dev/ttyACM0 -c arduino -U flash:w:flash.bin

arduino serial monitor not opening

I have been working with my arduino Uno on Ubuntu Linux (It won't work on Windows with my laptop). For a few days it worked fine, but recently I have been working with the Serial Port. It was all good, until the Serial Monitor stopped opening. It would have a process open, and using alt+tab it would show the window for it, but I couldn't get it to show normally or be interacted with in any way. I have opened it going tools>Serial Monitor, ctrl+shift+m, and the button for it. I can upload fine. I can't find the dynamic IP address for the arduino, or for just fun remotely interacting with it.
open the terminal and tap the following commands:
sudo usermod -a -G dialout xxxxx
sudo chmod a+rw /dev/ttyACM0
NOTE: xxxxx is your username

Arduino Serial Monitor shows strange ASCII characters

I connected an ArduiMU v3+ via a FTDI-cable to my Mac (OS X 10.10) (latest VC FTDI driver is installed and loaded).
Inside the Arduino-software the Serial Monitor (monitoring /dev/cu.usbserial-AJ038NZ3) shows
a lot of weird ASCII characters.
What could be the reason for this problem?
Instead of using the Arduino Serial Monitor, use OS X's ability to determine the baud rate automatically. Whenever, I use my FTDI cable, I monitor the input using the screen command.
In this case you can grep for the name of the device:
ls /dev | grep tty\.[Uu]sb | awk '{print "/dev/"$1}' | xargs screen
check out man screen for a bit more background.
or use the simple version by finding the name of the port in the /dev folder then using
screen <name_of_FTDI>

Can´t upload code to Arduino Uno using stino and Ubuntu 12.04 (Precise Pangolin)

I have installed stino on Sublime Text 2 succesfully, but when I try to upload my code to Arduino Uno, the output is the following:
Uploading /home/lucas/Arduino_Build/programa_teste/programa_teste.hex to Arduino Uno...
avrdude: ser_open(): can't open device "/dev/ttyACM0": Permission denied
ioctl("TIOCMGET"): Inappropriate ioctl for device
[Stino - Error while uploading.]
I have the Arduino IDE installed, and it is working fine, only Sublime Text can´t upload the code.
well, as #Bibhas says, your problem is that /dev/ttyACM0 is having the wrong permissions, and that has nothing to do with Arduino or sublime text. It's the linux kernel who creates character devices per default with no user permissions.
But good thing is that it can be changed!
The fast and easy solution is to add your current user to the dialout group:
sudo adduser YOU dialout
where YOU is your username and then log out and log back in to have those new permissions propagated into your shells.
Hint:
There's a solution that is a bit more complicated, is to create a udev rule such as:
/etc/udev/rules.d/48-arduino.rules
SUBSYSTEM!="usb_device", ACTION!="add", GOTO="arduino_end"
SUBSYSTEM=="tty", ATTRS{idVendor}=="2341", ATTRS{idProduct}=="0036", MODE="660", GROUP="arduino", SYMLINK+="arduino.leonardo"
LABEL="arduino_end"
which creates a /dev/arduino device readable and writable by the arduino group, that you need to create (or you can use the default dialout group which is perfectly fine):
addgroup arduino
adduser YOU arduino
and then reload your rules:
sudo udevadm control --reload-rules
The nice thing about that second hint is that when you unplug replug your arduino, you won't have it change device number oddly, it will be kept to the name. If you're not using an arduino leonardo, you can check your device idvendor/idproduct using lsusb:
% lsusb
… ↓↓↓↓ ↓↓↓↓
Bus 006 Device 105: ID 2341:0036 Arduino SA
…
HTH
Accoding the Troubleshooting doc, I use
sudo usermod -a -G tty yourUserName
sudo usermod -a -G dialout yourUserName
fix my problem.
I have the same problem today, and the incredible happend. The USB cable gave power to the Arduino, but doesn't allow the communication. The solution for us was to change the USB cable, and after that everything worked

Resources