Unable to communicate with GDM-8341 DMM on Raspberry pi - raspberry-pi

The GDM-8341 DMM is not recognized as a VCP when you plug it into the raspberry pi, which means you can't use pyserial or pyvisa to talk to the instrument.

This problem was really frustrating, but this post here sent me on the right path:
https://www.raspberrypi.org/forums/viewtopic.php?t=219232
sudo modprobe cp210x
sudo sh -c 'echo 2184 0030 > /sys/bus/usb-serial/drivers/cp210x/new_id'
(verify your vid/pid match 2184 and 0030 respectively)
After entering that "dmesg | grep tty" shows "usb 1-1.3: cp210x converter now attached to ttyUSB0"
Now pyvisa works.
Hope this saves someone a lot of time.

Related

Image dump fails during operation

I use the openocd script below to dump the flash memory of a STM32 microcontroller.
mkdir -p dump
openocd -f board/stm3241g_eval_stlink.cfg \
\
-c "init" \
-c "reset halt" \
-c "dump_image dump/image.bin 0x08000000 0x100000" \
-c "shutdown" \
FILENAME=dump/image.bin
FILESIZE=$(stat -c%s "$FILENAME")
echo "Size of $FILENAME = $FILESIZE bytes."
The script is supposed to read the whole memory which is 1MB in my case but it does it very rarely. Generally it stops reading the memory before the end.
Why can't I obtain 1MB each time I execute this script? What is the problem here to cause openocd stop dumping the rest of the memory?
You can use dfu-utils to reflash your STM32 micros.
In Ubuntu/Debian distros you can install dfu-utils with apt:
$ sudo apt-get install dfu-util
$ sudo apt-get install fwupd
Boot your board in DFU mode (check datasheet). Once in DFU mode, you should see something similar to this:
$ lsusb | grep DFU
Bus 003 Device 076: ID 0483:df11 STMicroelectronics STM Device in DFU Mode
Once booted in DFU mode, reflash your binary:
$ sudo dfu-util -d 0483:df11 -a 0 -s 0x08000000:leave -D build/$(PROJECT).bin
With -d option you choose product:vendorid such as listed by lsusb in DFU mode.
With the -a 0 option you select alternate mode 0, check the options available as in the following example:
$ sudo dfu-util -l
Found DFU: [0483:df11] ver=2200, devnum=101, cfg=1, intf=0, alt=1, name="#Option Bytes /0x1FFFF800/01*016 e", serial="FFFFFFFEFFFF"
Found DFU: [0483:df11] ver=2200, devnum=101, cfg=1, intf=0, alt=0, name="#Internal Flash /0x08000000/064*0002Kg", serial="FFFFFFFEFFFF"
As you can see, alt=0 is for internal flash memory.
With the -s option you specify the flash memory address where you save your binary. Check your memory map in datasheet.
Hope this helps! :-)

Emulate Raspberry Pi zero W with Qemu failed due to missing dtb

I am trying to emulate a Raspberry Pi zero W with Qemu based on an image I used on a real Raspberry Pi zero W.
The command I am using is:
sudo qemu-system-arm \
-kernel ./qemu-rpi-kernel/kernel-qemu-4.9.59-stretch \
-append "root=/dev/sda2 panic=1 rootfstype=ext4 rw" \
-hda pi_zero_kinetic_raspbian.qcow \
-cpu arm1176 -m 512 \
-M versatilepb \
-no-reboot \
-serial stdio \
-net nic -net user \
-net tap,ifname=vnet0,script=no,downscript=no
But Qemu complain that Error: unrecognized/unsupported machine ID (r1 = 0x00000183)
So added this option:
-dtb linux/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts
But In this case:
qemu-system-arm: Unable to copy device tree in memory
Couldn't open dtb file qemu-rpi-kernel/tools/linux/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts
So I tried to compile the dts in order to get the dtb with:
dtc -O dtb -o bcm2835-rpi-zero-w.dtb bcm2835-rpi-zero-w.dts
But the compilation fail and I get:
Error: bcm2835-rpi-zero-w.dts:13.1-9 syntax error
FATAL ERROR: Unable to parse input tree
I couldn't find any tutorial about Pi zero and all the tutorial about the first Rapsberry Pi seems to be outdated. I am not sure that compiling the dtb on my own is the way to go.
Any input would be appreciated, thanks!
This isn't going to work, because the QEMU option "-M versatilepb" says "emulate a VersatilePB development board", which will not run a kernel that is intended to boot on the Pi Zero. The versatilepb board does not have devices in the places that a Pi Zero DTB file says they are, so if you provide the kernel with a Pi Zero DTB then the kernel is going to crash immediately because it can't find anything where it expects.
In general Arm devboards are not like x86 -- they are all different, and you can't just boot a kernel intended for one on a different one. This is in fact what the "unrecognized machine ID" error is telling you -- it's from the guest kernel, and it's saying "I can't boot on this board".
You need to either:
use -M versatilepb and pass QEMU a kernel and dtb intended for that machine, not some other one
use some other -M option and a kernel and dtb that work with it (for instance we support 'raspi2' now for a RaspberryPi 2 board model, with some notable caveats including "no USB, no networking")
Also, as you seem to have discovered, -dtb wants a DTB file (the compiled binary), not a DTS file (the source).

Raspberry Pi / Octopi USB Camera Setup: What does this mean and how do I use it?

I'm very new to Raspberry Pi, and have no prior notable experience with Linux so this is all new to me...
Octoprint is a 3D printer spooler that you can run on your raspberry pi. One of the features on Octoprint is the ability to setup a USB camera to view either still images or a stream of your print.
I am using the Octopi prepackaged Octoprint image.
Octoprint's github contains the following info referring to my USB camera. But I have no idea how to implement this.
Hama PC-Webcam "AC-150" on Raspberry Pi
./mjpg_streamer -o output_http.so -w ./www -i input_uvc.so -y -r 640x480 -f 10
https://github.com/foosel/OctoPrint/wiki/Webcams-known-to-work
I'm guessing this is an easy command that I enter via console, but I've winged few commands with no luck. Can someone shed some light on how I use this? Like I said I'm an absolute beginner with the pi...
Any help is greatly appreciated!
Try this:
camera_usb_options="-r VGA -f 10 -y"
sudo service octoprint stop
fuser /dev/video0
/dev/video0: **1871m**
$ ps axl | grep **1871** *Change this number by yours*
$ kill -9 **1871**
./mjpg_streamer -i "input_uvc.so $camera_usb_options" -o "output_http.so -w ./www"
sudo service octoprint start

Capture/Record Audio Input in RaspberryPi

I bought a USB Audio Controller for RaspberryPi, in order to capture Audio input. I already done below steps on Rasbian but still unsure about Audio Capturing.
Can you please guide me on how do I get it?
Type the following commands to install the Audio device
pi#raspberrypi ~ $ sudo apt-get install alsa-utils
Detection Successfully by
pi#raspberrypi ~ $ lsusb
pi#raspberrypi ~ $ amixer
pi#raspberrypi ~ $ alsamixer
Also configure USB Audio device to make it default
/etc/modprobe.d/alsa-base.conf
by adding pound/hash symbol with
options snd-usb-audio index=2
#options snd-usb-audio index=2
simply write this command of Command Terminal, in order to record Audio
arecord -f cd -D plughw:0 -d 10 a.wav
Let me know if you get further any issue in recording sound

VLC won't start automatically at Ubuntu boot

I am trying to configure VLC to start streaming two streams automatically on boot with Upstart.
Here is my upstart script:
description "VLC streams"
start on (local-filesystems and net-device-up IFACE!=lo)
stop on runlevel [016]
exec /home/streamer/stream.sh
and stream.sh:
#!/bin/bash
cvlc -v "/home/administrator/Videos/Kastiel/kastiel.xspf" --sout '#std{access=udp{ttl=2},mux=ts,dst=239.220.220.31:9200}' --sout-keep --loop &
cvlc -v "/home/administrator/Videos/Rozpravky/rozpravky.xspf" --sout '#std{access=udp{ttl=2},mux=ts,dst=239.220.220.2:9200}' --sout-keep --random &
exit 0
However, after the computer boots, there is no stream and VLC process is not running. When I run stream.sh manually, it works with no problem.
Does anybody know what mistake am I doing?
I am using Ubuntu 12.10 and VLC 2.0.5.
Thank you in advance for any help.
Milan
Vlc doesn't support to be run as root due to security reasons.
You should use sudo -u user in script to change the user.
try as :
sudo -u username cvlc -v "/home/administrator/Videos/Kastiel/kastiel.xspf" --sout '#std{access=udp{ttl=2},mux=ts,dst=239.220.220.31:9200}' --sout-keep --loop &