iceprog .. Can't find iCE FTDI USB device (Linux permission issue??) - linux

I recently installed yosys on Ubuntu 15.1 (32-bit Arm-7 machine) and I compiled my first small project for a Lattice ice40hx8k dev board. However, the programming stage fails with:
iceprog counter.bin
Can't find iCE FTDI USB device (vedor_id 0x0403, device_id 0x6010).
ABORT.
It appears to be a permission problem, because if I run the programming stage as root, it works fine.
I created this udef file as part of the installation process:
cat /etc/udev/rules.d/53-lattice-ftdi.rules
ACTION=="add", ATTR{idVendor}
and also this file:
cat /etc/udev/rules.d/50-lattice-ftdi.rules
# FTDI USB-Serial
SUBSYSTEM=="usb", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6010", GROUP="users", MODE="0666"
Can someone help me fix this non-root user programming permission problem?
Thanks :)

Your /etc/udev/rules.d/53-lattice-ftdi.rules file seems to be truncated for some reason. The contents of this file should be:
ACTION=="add", ATTR{idVendor}=="0403", ATTR{idProduct}=="6010", MODE:="666"
After fixing that file, and disconnecting and reconnecting the device, you should be able to program the FPGA as normal user without sudo.

Related

avrdude: ser_open(): can't open device /dev/ttyACM0: Permission denied

I use vscode with Arduino extension on Ubuntu 22.04.1 LTS which had worked well until now.
If I'm trying to upload I'm getting the error:
avrdude: ser_open(): can't open device "/dev/ttyACM0: Permission denied"
When trying to upload a sketch to an Arduino Micro.
Then I tried it with the Arduino IDE 1.8.19 which produces the same error.
I have added my user to the dialout group even though it had worked before without that (and I restarted after that).
If I change chmod of /dev/ttyACM0 that does not help at all.
If I do:
~ $ ls -al /dev/ttyACM0
crw-rw----+ 1 root dialout 166, 0 Sep 14 00:15 /dev/ttyACM0
~ $ id
uid=1000(magraina) gid=1000(magraina) groups=1000(magraina),4(adm),20(dialout),24(cdrom),27(sudo),30(dip),46(plugdev),122(lpadmin),134(lxd),135(sambashare)
I was able to run avrdude manually with sudo
So I have now setup a rule under:
/etc/udev/rules.d named 50-myusb.rules
With:
SUBSYSTEM=="usb", MODE="0666", GROUP="dialout"
Now I'm able to run avrdude in the terminal to upload my sketch manually without sudo, but I'm still unable to run it through vscode or the Arduino IDE.
What else can I do?
It's more like a workaround but it's a solution that works for me.
Now the Arduino IDE in Version 2.0 has been released.
I downloaded it and run it.
With that version I'm now able to to upload a sketch as usual.
But sadly I could not find a solution for vscode as the Arduino extension only supports the old version for now.
Even though vscode runs avrdude from the same path as the new version of the Arduino IDE does.
It seems to me like, as if vscode has different user rights and I don't know how to change that.
sudo chmod a+rw /dev/ttyUSB0 or /dev/ttyACM0 which port used see Tools

Beyond Linux From Scratch: avrdude was compiled without usb support

Out of interest and learning purposes I have built Linux from scratch (LFS+BLFS, both version 10.0) according to the descriptions on www.linuxfromscratch.org.
In general the OS can boot and I can basically work with it. There are a few things which are not smooth, therefore I would like to address the experts here.
I would like to get going the AVRDragon, a programmer for Atmel microcontrollers. To use it on Linux, I work with the program "avrdude". My goal is to learn how avrdude works and interacts with the OS. Therefore I would like to build it from source with debug information.
For building avrdude from source, libusb/libusb_1_0 and libelf are required. I understand that libusb_1_0 was installed with BLFS. avrdude asks for either libusb and/or libusb_1_0. I cannot say if there is a problem with having only libusb_1_0. (libusb_1_0 is newer than libusb, isn't it?) Additionally I have installed libelf (since libelf is installed, I cannot build the kernel anymore, but this should not be a problem for now). In the kernel, USB support is enabled (Device Drivers -> USB Support -> Support for Host-side USB).
I have created a udev rule:
# Dragon
ATTR{idVendor}=="03eb", ATTR{idProduct}=="2107", GROUP="plugdev", MODE="0666"
...and lsusb says this:
# lsusb
...
Bus 003 Device 006: ID 03eb:2107 Atmel Corp. AVR Dragon
...
Also, I use a script to program a sample application onto the microcontroller, which works on my reference system.
However, running avrdude on my BLFS, I get an error message, that avrdude was not built with USB support:
# avrdude -p m328p -c dragon_isp -B5 -F -P usb -V -U flash:w:Debug/hello_world.elf
avrdude was compiled without usb support.
avrdude done. Thank you.
Researching the internet, indicated installing the prerequisites stated above and setting up the udev rule.
I have a good understanding of the Linux command line, the GCC tool chain and the usual Linux tools. But I am completely lost with how to correctly configure my BLFS with USB support. Is there somebody who can give me a hint on how to solve this problem? Many thanks!
Apparently, for full functionality you need both libusb-1.0 and libusb-0.1. The configure.ac script defines HAVE_LIBUSB_1_0 only for the former and HAVE_LIBUSB for the latter, while the *.c files containing your error message only check for HAVE_LIBUSB.
While current BLFS doesn't have instructions to build libusb-0.1, you can see them for libusb-0.1.12 in BLFS 6.3.

udev rules for FTDI device are not working in VMware Ubuntu 16.04

I have set up a VMware (14.1.1) environment with Ubuntu 16.04 where I was trying to control some FTDI devices over FTDI's D2xx driver. However, I can not open my FTDI device or communicate with it. Using
FT_CreateDeviceInfoList(&NumDevs);
tells me that there is a device available. However, if I try to open it with
ftStatus = FT_OpenEx(const_cast<char*>(tmp),FT_OPEN_BY_SERIAL_NUMBER, &keyHandle);
it gives me an error (ftStatus = 2). As far as I know, this error means that there is no device available.
If I execute the "EEPROM/read" example from the FTDI driver, everything works fine. Only difference is that I execute it as superuser (sudo ./read). Therefore, I was making an udev rule which I was hoping would solve my problem:
cd /etc/udev/rules.d
cd /etc/udev/rules.d
SUBSYSTEMS==”usb”, ATTRS{idVendor}==”0403”, ATTRS{idProduct}==”faf0”,
GROUP=”student”
sudo udevadm control –reload-rules
However, the problem still exists. If I'm running the exactly same thing on a very similar, physical Ubuntu 16.04 machine, everything works fine with this udev rule.
Is there a difference in how to define these rules when using a virtual system? But I have some other FTDI devices which just work fine with this rule:
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="a8b0", GROUP="users", MODE="0666"
I followed the installation guide from FTDI: http://www.ftdichip.com/Support/Documents/AppNotes/AN_220_FTDI_Drivers_Installation_Guide_for_Linux.pdf
I actually found a solution after quite some time trying. I found that it is important to shut down the system between the changes.
I added my user to both the tty and dialout groups:
sudo usermod -aG tty user
sudo usermod -aG dialout user
This should already be enough. But it seemed not to work, so I deleted my last udev rule and added:
sudo gedit 99-ftdi.rules
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="faf0", GROUP="users", MODE="0666"
sudo udevadm control --reload
Then rebooted the whole system.

Can`t find ttyUSB[id]

I have just started with my Raspberry Pi and I have a project where I want to read data from the USB port. I have installed Java JDK8 and written the program that compiles and run. But I get the message that /dev/ttyUSB1 does not exist.
I just have a cable from the USB port on the Arduino going to the USB port on the RPi and I am using Raspbian Debian Wheezy
When I go to DIR /dev/ and use $ ls, I can only find tty0 up to tty63. I have searched on the internet and some say that you can use ttyAMA0, but this does not work. I have also searched for the same problem, but have not found a answer to my problem.
I have used $ lsusb which gave me 4 devices (001-004) on Bus 001. I can see that, for example, my USB keyboard is listed as Bus 001 Device 004: ID 1532:010b Razer USA, Ltd.
and if I run $ dmesg | grep Manufacturer I get that:
[xxxxxxxxx] usb 1-1.2: Manufacturer: Razer
So my question is why does my usb devices not get listed as ttyUSB[id]? Do I have to manually attach it?
I am a bit noob when it comes to Linux.
Hope someone can help me!
I have some bad news for you. The reason you have no /dev/ttyUSB[n] devices on the RPi (when you connect your Arduino) is because you need the Arduino drivers (FTDI drivers in particular). The unfortunate thing is that these drivers don't yet exist for the Arm platform (which includes the RPi). This is according to the FTDI web page showing support. Note the lack of Linux driver support for Arm.
Apparently on Arm running Linux the only way to program the Arduino is via the serial port interface directly via the GPIO pins. Information on doing this can be found here . You will also have to do something similar on the Arduino side see this information.
Once you have the two devices connected via straight serial then your going to probably run into another SNAFU. By default apparently on the RPi Linux will use the serial port for sending debug/console output. In order to use the serial interface for something that behavior has to be modified. This article discusses that. In particular disabling the kernel from using the serial port for terminal use this would seem to apply:
The following steps (based on a clean 2012-07-15-wheezy-raspbian install
Open a terminal on the Raspberry, or connect to Raspberry Pi through SSH.
Make a backup of the /boot/cmdline.txt file.
sudo cp /boot/cmdline.txt /boot/cmdline_backup.txt
Edit /boot/cmdline.txt file:
sudo vi /boot/cmdline.txt
This file contains:
dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 $
Remove the parameters that reference the UART serial port (ttyAMA0):
dwc_otg.lpm_enable=0 console=tty1 $
Comment next line in /etc/inittab:
T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100
Reboot Raspberry Pi
sudo reboot
If you use a different Linux distro than Debian it would be different but the basics would still apply (modifying the kernel command line)

How can I write a driver for an asus trackpad on linux?

I bought a laptop and installed Linux on it and the trackpad is now not working but it was on Windows. There is no linux driver for it and I thought this could be a good project to write one.
I have read and implemented tutorials on device drivers for simple things (turning on an led on a pandaboard) but I have no idea where to start here. Related questions pointed to commands like modprobe -r psmouse and it seems the trackpad is not seen at all.
Any idea ? the laptop is : Asus R409C.
A temporary fix is to boot with "psmouse.proto=bare" on the kernel cmdline.
$ sudoedit /etc/default/grub
Change GRUB_CMDLINE_LINUX_DEFAULT to add psmouse.proto=bare at the end, and save your modifications.
Then:
$ sudo update-grub
And finally reboot.
i think linux input subsystem can be used to write driver for touchpad. Exact details need to be considered. But most of the input devices can be integrated using input subsystem.

Resources