Friday 22 April 2011

USBasp & Noise Troubles

USBasp is a small circuit to flash atmel processors which uses the USB port, but since the USB communication isn't a feature available in the processor by default, it must use the V-USB firmware/drivers to deal with it.
Never ever do this for the USB data lines !
After assembling the circuit i had a few problems trying to understand why it did work on a older machine and didn't work on my recent laptops, using dmesg on the newer laptops I got these messages:

[ 7486.876197] usb 3-2: device descriptor read/64, error -71
[ 7487.105059] usb 3-2: device descriptor read/64, error -71
[ 7487.320153] usb 3-2: new low speed USB device using uhci_hcd and address 4
[ 7487.441052] usb 3-2: device descriptor read/64, error -71
[ 7487.664184] usb 3-2: device descriptor read/64, error -71

And with the older machine using the lsusb command:
Bus 003 Device 016: ID 16c0:05dc VOTI shared ID for use with libus

It seems the usb controler was unable to read the device description, but after an week and some google searches i found that the electromagnetic interference affects a lot with the circuit. To reduce this problem i rewired the circuit and replace the usb port with a short usb male cable instead of the female port and the problem was fixed. (And the circuit also works fine with an usb extension cable)

Rewired version

Back wiring
It appears that the Intel USB controller is more exigent with the quality of the signal than the SiS controller !

Ubuntu/Linux Commands

A list of useful commands which i keep forgetting :

Misc
sudo su // Change user to root

Installers
sudo apt-get install build-essential // C++ support
sudo apt-get install freeglut3-dev // FreeGLUT and OpenGL support
sudo apt-get install avrdude // AVR firmware upload tool
sudo apt-get install gcc-avr // AVR atmel processors compiler
sudo apt-get install avr-libc // C lib for AVR atmel processors
sudo apt-get install xorg-dev // X11 headers and libraries
sudo apt-get install libpng-dev // PNG headers and libraries
sudo apt-get install libjpeg-dev // JPEG headers and libraries
sudo apt-get install libasound-dev // Alsa headers and libraries

Tools
top // Real-time list of processes
ps // Show running processes
chmod a+rwx fileorfolder -R // Change permissions of all files to read/write recursively
dmesg // Get drivers messages
dmesg | grep tty // Get serial ports drivers messages
lsusb // Get usb devices
tail -f /var/log/messages // Similar to dmesg | tail
otool -hv library.a // Get compiled objects architecture
du -k filename // Get file size
ldd filename // Get shared libraries dependencies
find . -iname '*c' | xargs grep 'foo' -sl // search C files for the string foo

Network

nslookup address // Get the IP address of a domain name
dig address // DNS servers interrogator
traceroute / tracert address // Show the path of a packet to a certain address
ping address // Check if address is reachable
lsof -i :port // Get process using this port
 

Last update 1:47 23/12/2011