AVRISP MKII doesn't work with AVRDUDE on Linux - linux

The system sees something is plugged in when I plug and unplug it:
bluehat#Matapan:/dev$ tail -f /var/log/syslog
Mar 23 15:36:35 Matapan kernel: [156082.112874] usb 7-1: new full speed USB device using uhci_hcd and address 6
Mar 23 15:47:19 Matapan kernel: [156726.248081] usb 7-1: USB disconnect, address 6
Mar 23 15:47:29 Matapan kernel: [156736.200148] usb 6-1: new full speed USB device using uhci_hcd and address 3
AVRISP MKII should rely on cdc-acm:
bluehat#Matapan:/dev$ modinfo cdc-acm -V
module-init-tools version 3.12
So it should be able to see it just fine, and yet I am unable to write to it.
avrdude -p m1280 -c avrispmkII -P usb -U test.hex
Returns
avrdude: usb_open(): cannot read serial number "error sending control message: Operation not permitted"
avrdude: usb_open(): cannot read product name "error sending control message: Operation not permitted"
avrdude: usbdev_open(): error setting configuration 1: could not set config 1: Operation not permitted
avrdude: usbdev_open(): did not find any USB device "usb"

It turns out that Ubuntu will acknowledge that the object is there but not play nicely with it until you fix up some of your udev rules. Thanks to http://steve.kargs.net/bacnet/avr-isp-mkii-on-ubuntu-hardy/ which provided files that only needed a little updating.
Create new file /etc/udev/avrisp.rules
SUBSYSTEM!="usb", ACTION!="add", GOTO="avrisp_end"
# Atmel Corp. JTAG ICE mkII
ATTR{idVendor}=="03eb", ATTR{idProduct}=="2103", MODE="660", GROUP="dialout"
# Atmel Corp. AVRISP mkII
ATTR{idVendor}=="03eb", ATTR{idProduct}=="2104", MODE="660", GROUP="dialout"
# Atmel Corp. Dragon
ATTR{idVendor}=="03eb", ATTR{idProduct}=="2107", MODE="660", GROUP="dialout"
LABEL="avrisp_end"
Now create a virtual link to the file and give it a rule priority
cd /etc/udev/rules.d
sudo ln ../avrisp.rules 60-avrisp.rules
Check you're in the dialout group
groups
Restart udev
sudo service udev restart
Hooray!

For Ubuntu 12.04, there's a minor change that must be carried out to the configuration that Katy posted:
All occurrences of SYSFS should be replaced with ATTR
Additionally, if you're still having problems, make sure you have installed all the required dependent libraries. I found that I had to install the uisp package as well.
If restarting udev doesn't make a difference, unplugging the programmer and plugging it in back in does.

Updated rule that works for 13.10:
SUBSYSTEM!="usb", ACTION!="add", GOTO="avrisp_end"
# Atmel Corp. JTAG ICE mkII
ATTR{idVendor}=="03eb", ATTR{idProduct}=="2103", MODE="660", GROUP="dialout"
# Atmel Corp. AVRISP mkII
ATTR{idVendor}=="03eb", ATTR{idProduct}=="2104", MODE="660", GROUP="dialout"
# Atmel Corp. Dragon
ATTR{idVendor}=="03eb", ATTR{idProduct}=="2107", MODE="660", GROUP="dialout"
LABEL="avrisp_end"
Based on previous posts about changes.

Seems they changed it again in 12.10
The Subsystem is now "usb"
I found a command which shows what you need.
For that you just need to know the Bus and Device number from the plugged device
(use lsusb)
Bus 003 Device 010: ID 03eb:
lsusb
So my Bus number from the isp is 003 and Device is 010
(edit the end /003/010 to your needs)
udevadm info --attribute-walk --name=bus/usb/003/010
shows among many other things
SUBSYSTEM=="usb"
ATTR{idVendor}=="03eb"
ATTR{idProduct}=="2104"
Replace/change the created rule above and everything should work
If there are other Problems the Command will show them to you, it checks the rules (found a typo that way :))
If there is no error it won't show anything (Didn't realise for some time)

I used the following udev rules file to get it working on Fedora 19:
SUBSYSTEM!="usb", ACTION!="add", GOTO="avrisp_end"
# Atmel Corp. JTAG ICE mkII
ATTR{idVendor}=="03eb", ATTR{idProduct}=="2103", MODE="660", GROUP="dialout"
# Atmel Corp. AVRISP mkII
ATTR{idVendor}=="03eb", ATTR{idProduct}=="2104", MODE="660", GROUP="dialout"
# Atmel Corp. Dragon
ATTR{idVendor}=="03eb", ATTR{idProduct}=="2107", MODE="660", GROUP="dialout"
LABEL="avrisp_end"
As you can see, some minor things are different from what is suggested above. Also I had to restart the computer. Using "udevadm control --reload" was not enough.

Related

How can I get the port of my Rflink (Arduino Mega) to show in /dev on my Raspberry pi 3?

I bought a RFlink Gateway from Nodo-shop.nl, the the RFLink 433.42 Somfy RTS version, to use with Domoticz on a RPI. I had Nodo to solder the components of my Rflink, so there should not be any problem on this end :)
I connected it to my MacbookAir, and followed the instructions on Domoticz wiki to upload the firmware into the RFlink. It apparently uploaded the firmware successfully.
Then I updated and upgraded my RPI (Linux raspberrypi 5.4.79-v7+ #1373 SMP Mon Nov 23 13:22:33 GMT 2020 armv7l GNU/Linux) and hooked it up to my Raspberry Pi 3 .
I tried to identify the port with Dmesg. If the Arduino Mega is detected, I cannot see the ttyAMCO or ttyUSB everyone is referring to in various posts.
Here is the output of the dmesg command:
[3902580.423329] usb 1-1.1.2: new full-speed USB device number 9 using dwc_otg [3902580.568650] usb 1-1.1.2: New USB device found, idVendor=2341, idProduct=0042, bcdDevice= 0.01 [3902580.568671] usb 1-1.1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=220 [3902580.568685] usb 1-1.1.2: Manufacturer: Arduino (www.arduino.cc) [3902580.568699] usb 1-1.1.2: SerialNumber: 55037313237351714260
I also tried to look for the port using this command ls /dev | grep tty*. I can only see these ports : ttyXX, ttyAMA0 and ttyprintk. But no sign of the port of my RFlink Gateway.
When I use this command lsusb, it shows it recognizes the Arduino:
Bus 001 Device 009: ID 2341:0042 Arduino SA Mega 2560 R3 (CDC ACM).
I read tons of posts on the internet but I did not find any answer to my problem.
I even bought a power supply for my Arduino Mega as some wrote that it may not get enough power from the RPI's USB. But I still have the same problem...
What I'm not doing right ? Or what am I not looking at ?
Thank you for your help
Sorry, bit late but it might be useful to someone else...
It might well be the /dev/ttyAMA0 you found - it depends what else you've got on there.
listing by id should identify it definitively though:
$ ls -l /dev/serial/by-id/
total 0
lrwxrwxrwx 1 root root 13 Mar 18 2021 usb-0658_0200_12345678-9012-3456-7890-123456789012-if00 -> ../../ttyACM1
lrwxrwxrwx 1 root root 13 Mar 18 2021 usb-Arduino__www.arduino.cc__0042_55639313533351509150-if00 -> ../../ttyACM0
So, in my case it's on /dev/ttyACM0.
If you've got multiple USB serial adapters, reboot the pi with them all plugged in to get the default mapping (I've seen hotplugged AMA0 and AMA1 swap after a reboot).

openvino crashes after running inference some seconds in raspberry pi 4

I tried to use Intel Neural Compute Stick 2 as an inference engine for my smart car.
I installed l_openvino_toolkit_runtime_raspbian_p_2019.2.242.tgz followed by this link, and run the code for testing.
Everything was fine at the beginning of 10 - 20 seconds(sometimes less, sometimes longer), Then crashed with the following errors:
E: [xLink] [ 327401] [EventRead00Thr] dispatcherEventReceive:336 dispatcherEventReceive() Read failed (err -4) | event 0xaf1fdddc XLINK_READ_REL_REQ
E: [xLink] [ 327401] [EventRead00Thr] eventReader:223 eventReader thread stopped (err -4) E: [xLink] [ 327402] [python3] XLinkReadDataWithTimeOut:1323 Event data is invalid
E: [ncAPI] [ 327402] [python3] ncFifoReadElem:3445 Packet reading is failed. terminate called after throwing an instance of 'InferenceEngine::details::InferenceEngineException'
what(): Failed to read output from FIFO: NC_ERROR
Aborted
I tried to insert it into the USB hub with a self-power adapter, but it still got the same errors.
I also tried to insert it into the USB2.0, but still not working.
I checked out the dmesg, I found the Intel Neural Compute Stick 2 will be auto-mounted when I called net.forward() at some point.
I got dmesg information by following steps:
check the ncs2 device is ok(I can find the device) before running the code.
clear dmesg
running the code
waiting for it crashed. then, check out the dmesg.
the dmesg showing:
[87255.685160] usb 1-1.1: USB disconnect, device number 25
[87255.831256] usb 2-1: new SuperSpeed Gen 1 USB device number 18 using xhci_hcd
[87255.861963] usb 2-1: New USB device found, idVendor=03e7, idProduct=f63b, bcdDevice= 1.00
[87255.861970] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[87255.861975] usb 2-1: Product: VSC Loopback Device
[87255.861980] usb 2-1: Manufacturer: Intel Corporation
[87255.861985] usb 2-1: SerialNumber: 41440410119541BC00
[87280.181479] usb 1-1.1: new high-speed USB device number 26 using xhci_hcd
[87280.312042] usb 1-1.1: New USB device found, idVendor=03e7, idProduct=2485, bcdDevice= 0.01
[87280.312048] usb 1-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[87280.312053] usb 1-1.1: Product: Movidius MyriadX
[87280.312058] usb 1-1.1: Manufacturer: Movidius Ltd.
[87280.312063] usb 1-1.1: SerialNumber: 03e72485
[87280.691784] usb 2-1: USB disconnect, device number 18
My environment is:
Raspberry Pi 4 (4GB)
Raspbian Buster
I have debugged it serval days, but have no idea to solve this problem.
Is there anything I missed?
Thanks!
The error seems to be related to the NCS2 device being reset for inference and fail to initialize during runtime. Verify you have added the USB Rules for the Intel® Neural Compute Stick 2 device by performing the following steps.
Add the current Linux user to the users group:
$ sudo usermod -a -G users "$(whoami)"
Log out and log in for it to take effect.
Run setupvars.sh again after logging in:
$ source /opt/intel/openvino/bin/setupvars.sh
Install the USB rules running the install_NCS_udev_rules.sh script:
$ sh /opt/intel/openvino/install_dependencies/install_NCS_udev_rules.sh
Proceed to run the demo application:
$ python3 SingleStickSSDwithUSBCamera_OpenVINO_NCS2.py
Note the l_openvino_toolkit_runtime_raspbian_p_2019.2.242 is now quite outdated, and there have been newer software packages released. Checkout the OpenVINO™ Toolkit packages storage for the most recent release available (at the time of this post, 2021.4.1 - l_openvino_toolkit_runtime_raspbian_p_2021.4.689.tgz).
I've executed the demo application you listed with OpenVINO 2021.4.1 for longer than 10 minutes and the error can't reproduce:

"failed to open this device: LIBUSB_ERROR_ACCESS" on ubuntu16.04, have tried some solutions

After searching for long time on internet I think there is no proper answer so I put up this problem. As being new here, I apology if I made any mistakes.
I have a tof camera connected to ubuntu16.04 through usb and a software to operate it. When I try to receive the image through software:
./smartTOFViewer
it gives these error repeatedly:
2018/07/06 20:27:20.297[3249948416][DBG] [dmcam_dev_open] open dmcam device # 0x7f8ab88e29c0
2018/07/06 20:27:20.297[3249948416][DBG] [_usb_ll_dev_open] create usb context
2018/07/06 20:27:20.300[3249948416][ERR] [dmcam_dev_open] open device failed!
2018/07/06 20:27:21.301[3249948416][DBG] [dmcam_dev_open] open dmcam device # 0x7f8ab88e29c0
2018/07/06 20:27:21.301[3249948416][DBG] [_usb_ll_dev_open] create usb context
2018/07/06 20:27:21.303[3249948416][ERR] [dmcam_dev_open] open device failed!
2018/07/06 20:27:22.304[3249948416][DBG] [dmcam_dev_open] open dmcam device # 0x7f8ab88e29c0
2018/07/06 20:27:22.304[3249948416][DBG] [_usb_ll_dev_open] create usb context
2018/07/06 20:27:22.307[3249948416][DBG] [_usb_ll_dev_open] found dmcam device (speed=3) # 001:002:020
2018/07/06 20:27:22.307[3249948416][WRN] [_usb_ll_dev_open] failed to open this device: LIBUSB_ERROR_ACCESS, try next ...
2018/07/06 20:27:22.308[3249948416][ERR] [dmcam_dev_open] open device failed!
but if I run this command:
sudo ./smartTOFViewer
it works normally. So I think it's a permission issue, and create a udev rule file:
sudo nano /etc/udev/rules.d/99-persistent-usb.rules
and content:
SUBSYSTEMS=="usb",ATTRS{idVendor}=="111b", \
ATTRS{idProduct}==1238",GROUP="root", OWNER="root", \
MODE="0666"
The idVendor and idProduct are checked with:
$ lsusb
Bus 001 Device 002: ID 8087:8001 Intel Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 002 Device 006: ID 0bda:0129 Realtek Semiconductor Corp. RTS5129 Card Reader Controller
Bus 002 Device 005: ID 8087:07dc Intel Corp.
Bus 002 Device 004: ID 064e:920b Suyin Corp.
Bus 002 Device 003: ID 046d:c530 Logitech, Inc.
Bus 002 Device 021: ID 111b:1238
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
I also tried setting something:
GROUP="dongtu" or "adm" or "usrs" or "plugdev",
OWNER="dongtu" or just removing it,
adding TAG+="uaccess",
putting in one line and remove " \"
I run this command for reload:
sudo udevadm control --reload
However, all these make no change. I observed that there is no change under /dev/ when I connect the tof, but I failed to figure out why.
I hope to do my job in anaconda with python, which means I can't use sudo in case run under system python environment. Is there any one could help me? Apologize again if I wasted your time.

Arduino to Ubuntu USB connection

I am having trouble getting an Ubuntu device to connect to an Arduino Uno. Before I begin talking about the device in question the Arduino is communicating correctly with my Windows pc, and also an Ubuntu VM on that PC.
The device in question is an nVidia Jetson TX2. The Arduino IDE is installed, and when run using sudo the only serial port available is /dev/ttyS0.
The following line is lsusb being run and it detecting the Arduino.
Bus 001 Device 008: ID 2341:0001 Arduino SA Uno (CDC ACM)
The following lines is the output from dmesg from the time that the Arduino is connected.
[ 6609.813385] usb 1-2.3: new full-speed USB device number 13 using xhci-tegra
[ 6609.923568] usb 1-2.3: New USB device found, idVendor=2341, idProduct=0001
[ 6609.930495] usb 1-2.3: New USB device strings: Mfr=1, Product=2, SerialNumber=220
[ 6609.938049] usb 1-2.3: Product: Arduino Uno
[ 6609.942268] usb 1-2.3: Manufacturer: Arduino (www.arduino.cc)
[ 6609.948065] usb 1-2.3: SerialNumber: 7563830333735121D160
[ 6609.953998] usb 1-2.3: ep 0x82 - rounding interval to 1024 microframes, ep desc says 2040 microframes
And lastly the following is the output from ls -a /dev/tty*
/dev/tty /dev/tty18 /dev/tty28 /dev/tty38 /dev/tty48 /dev/tty58 /dev/ttyS1
/dev/tty0 /dev/tty19 /dev/tty29 /dev/tty39 /dev/tty49 /dev/tty59 /dev/ttyS2
/dev/tty1 /dev/tty2 /dev/tty3 /dev/tty4 /dev/tty5 /dev/tty6 /dev/ttyS3
/dev/tty10 /dev/tty20 /dev/tty30 /dev/tty40 /dev/tty50 /dev/tty60 /dev/ttyTHS1
/dev/tty11 /dev/tty21 /dev/tty31 /dev/tty41 /dev/tty51 /dev/tty61 /dev/ttyTHS3
/dev/tty12 /dev/tty22 /dev/tty32 /dev/tty42 /dev/tty52 /dev/tty62
/dev/tty13 /dev/tty23 /dev/tty33 /dev/tty43 /dev/tty53 /dev/tty63
/dev/tty14 /dev/tty24 /dev/tty34 /dev/tty44 /dev/tty54 /dev/tty7
/dev/tty15 /dev/tty25 /dev/tty35 /dev/tty45 /dev/tty55 /dev/tty8
/dev/tty16 /dev/tty26 /dev/tty36 /dev/tty46 /dev/tty56 /dev/tty9
/dev/tty17 /dev/tty27 /dev/tty37 /dev/tty47 /dev/tty57 /dev/ttyS0
I don't believe that a driver is being called to create /dev/ttyACM0 but I am not sure how to solve this issue. Any help would be great! Let me know if I need to update with the output from any other commands.
You haven't posted what the error is but I'm guessing it is an access type error, have you done the part at the end of the install for linux?
At the end of https://www.arduino.cc/en/Guide/Linux there is section on permissions for the serial port.

How do I connect to a terminal to a serial-to-USB device on Ubuntu 10.10 (Maverick Meerkat)?

I am trying to connect minicom to a serial device that is connected via a USB-to-serial adapter. This is a PL2303 and from everything I've read no additional drivers are required. The device is recognised as a PL2303.
I'm a beginner at minicom. Is this the correct command to execute? Or do I need to configure something?
$ sudo minicom --device /dev/ttyUSB0
minicom: cannot open /dev/ttyUSB0: No such file or directory
$ sudo lsusb -v
Bus 002 Device 006: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port
Device Descriptor:
bLength 18
bDescriptorType 1
$ tail /var/log/syslog #then removed and attached the device.
Mar 13 23:31:49 ubuntu kernel: [807996.786805] usb 2-1: pl2303 converter now attached to ttyUSB0
Mar 13 23:34:44 ubuntu kernel: [808172.155129] usb 2-1: USB disconnect, address 7
Mar 13 23:34:44 ubuntu kernel: [808172.156321] pl2303 ttyUSB0: pl2303 converter now disconnected from ttyUSB0
Mar 13 23:34:44 ubuntu kernel: [808172.156374] pl2303 2-1:1.0: device disconnected
Mar 13 23:34:52 ubuntu kernel: [808179.497856] usb 2-1: new full speed USB device using uhci_hcd and address 8
Mar 13 23:34:52 ubuntu kernel: [808179.785845] pl2303 2-1:1.0: pl2303 converter detected
Mar 13 23:34:52 ubuntu kernel: [808179.872309] usb 2-1: pl2303 converter now attached to ttyUSB0
First check with dmesg | grep tty if system recognize your adapter.
Then try to run minicom with sudo minicom -s, go to "Serial port setup" and change the first line to /dev/ttyUSB0.
Don't forget to save config as default with "Save setup as dfl". It works for me on Ubuntu 11.04 on VirtualBox.
You will need to set the permissions every time you plug the converter in.
I use PuTTY to connect. In order to do so, I have created a little Bash script to sort out the permissions and launch PuTTY:
#!/bin/bash
sudo chmod 666 /dev/ttyUSB0
putty
P.S. I would never recommend that permissions are set to 777.
Long time reader, first time helper ;)
I'm going through the same hellish experience here with a Prolific USB <> Serial adapter and so far Linux is the easiest to get it to work.
On CentOS, I didn't need to install any drivers etc.. That said,
dmesg | grep -i tty or dmesg | grep -i usb showed me /dev/ttyUSB0.
screen ttyUSB0 9600 didn't do the trick for me like it did in OSX
minicom is new to me but it was complaining about lack of /dev/modem
However, this helped: https://www.centos.org/forums/viewtopic.php?t=21271
So install minicom (yum install minicom) then enter its settings (minicom -s).
Then select Serial Port Setup and change the Serial Device (Option A) to /dev/ttyUSB0, or whatever your device file is as it slightly differs per distro.
Then change the Bps (Option E) to 9600 and the rest should be default (8N1 Y N)
Save as default, then simply minicom and Bob's your uncle.
HTH.
The serial port communication programs moserial or gtkterm provide an easy way to check connectivity and modify /dev/ttyUSB0 (or /dev/ttyUSB1!) settings. Even though there maybe only a single USB to RS232 adapter, the n designation /dev/ttyUSBn can and does change periodically! Both moserial and gtkterm will show what port designation is relevant in their respective pull down menus when selecting an appropriate port to use.
Check out help.ubuntu.com/community/Minicom for details on minicom.
I had fix this with adduser *username* dialout. I never had this error again, even though previously the only way to get it to work was to reboot the PC or unplug and replug the usb to serial adapter.
I get get the same minicom error, "cannot open /dev/ttyUSB0: No such file or directory"
Three notes:
I get the error when the device attached to the serial port end of my Prolific Technology PL2303 USB/Serial adapter is turned off. After turning on the device (an embedded controller running Linux) minicom connected fine.
I have to run as super user (i.e. sudo minicom)
Sometimes I have to unplug and plug back in the USB-to-serial adapter to get minicom to connect to it.
I am running Ubuntu 10.04 LTS (Lucid Lynx) under VMware (running on Windows 7). In this situation, make sure the device is attached to VM operating system by right clicking on the USB/Serial USB icon in the lower right of the VMware window and select Connect (Disconnect from Host).
Remember to press Ctrl + A to get minicom's prompt, and type X to exit the program. Just exiting the terminal session running minicom will leave the process running.
I had the exact same problem, and it was fixed by doing a chmod 777 /dev/ttyUSB0. I never had this error again, even though previously the only way to get it to work was to reboot the VM or unplug and replug the USB-to-serial adapter. I am running Ubuntu 10.04 (Lucid Lynx) VM on OS X.
I suggest that newbies connect a PL2303 to Ubuntu, chmod 777 /dev/ttyUSB0 (file-permissions) and connect to a CuteCom serial terminal. The CuteCom UI is simple \ intuitive. If the PL2303 is continuously broadcasting data, then Cutecom will display data in hex format
I just got my GUC232A cable with a molded-in PL2302 converter chip.
In addition to adding myself and br to group dialout, I found this helpful tip in the README.Debian file in /usr/share/doc/bottlerocket:
This package uses debconf to configure the /dev/firecracker symlink,
should you need to change the symlink in the future run this command:
dpkg-reconfigure -pmedium bottlerocket
That will then prompt you for your new serial port and modify the
symlink. This is required for proper use of bottlerocket.
I did that and voila! bottlerocket is able to communicate with my X-10
devices.
Putty on ubuntu
There is no need to install the driver for PL2303
So only type the command to enable the putty
Sudo chmod 666 /dev/ttyUSB0
Done
Open the putty.

Resources