Sunday, December 30, 2007

PICDEM FS USB Demo Board under Linux

PICDEM FS-USB demo board is the demonstration and evaluation board for the PIC18F4550 family of Flash microcontrollers with full speed USB 2.0 interface
http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1406&dDocName=en021940

Back in 2005, people have developed application based on libusb to get it work under Linux. I have since patched them to work under Windows as well using libusb-win32.

Bootloader under Linux:
http://www.internetking.org/fsusb/
My latest patches:
http://forum.microchip.com/tm.aspx?m=106426

Demo mode which includes my patches for libusb-win32:
http://www.varxec.net/picdem_fs_usb/
My latest patches to detach kernel ldusb driver for later Linux kernels.
http://forum.microchip.com/tm.aspx?m=106426

Interesting discussion about the ldusb driver issue.
Thread: [PATCH 70/78] USB: add picdem device to ldusb:
http://marc.info/?t=117770076400003&r=1&w=2

To me I think it is better to do this in user space using libusb. But the original submitter wants to keep it as he did not know the existence of the libusb based application and has already an in-house application based on the kernel driver.

CDC-ACM demo works fine under Linux. The HID mouse demo also works fine under Linux.

Interestingly, again someone wants to add the bootloader to the kernel. Hopefully this time it will not be included. The libusb based application should still work but why adding so many things to the kernel space when the user space libusb based application works fine.
http://www.mail-archive.com/linux-usb@vger.kernel.org/msg00296.html

One FAQ is how to run the libusb based application as a normal user (without root credential). This is a moving target under Linux. Hotplug, udev, udev with PAM and HAL rules are the methods to achieve the goal. You need to choose the right one for the Linux distro you are using.

The following is a good summary.
http://www.gphoto.org/doc/manual/permissions-usb.html

An older document which does not cover HAL:
http://piklab.sf.net/files/libusb_udev_hotplug.txt

Some examples (not really for PICDEM FS-USB but for PICkit 1/2 and ICD2) you can use as the starting point:
http://piklab.sourceforge.net/wiki/index.php/USB_port_problems

Saturday, December 29, 2007

Windows Vista First Impression

Windows Vista has been out for 1 year and many reviews on the Internet is still negative. XP is quite decent now that it has been in the market for quite some time. XP SP2 is pretty stable to use and many companies has not deployed Vista. Still most of the consumers are buying new PCs and most of them come with Vista bundled.

I just started playing with the Vista notebook bought 4 days ago. It is not bad, I will say. As the first step, I removed the two trial version software (Office 2007 and Norton). For antivirus, I installed AVG Free. For spyware detection, Vista comes with Windows Defender installed. With some education done, my wife is now a careful enough Windows user. I've used IE7 in my desktop so I have no problems with IE7 under Vista. Still I installed Firefox as an alternative. IE7 seems to be faster with Windows Live Hotmail.

I think 4GB of RAM helps so that I do not feel Vista is slow. My desktop is a 3 year old AMD64 single core with 1GB RAM running Linux/FreeBSD/Windows XP. So this notebook should not be slower anyway.

I do not like those eye candies so the sidebar feature is not so useful. My wife may like it. As for specially effect of Aero, I do not think it is any useful so that I have not tried it. Anyway, I do not like Compiz under Linux and always switched it off.

UAC is kind of annoying but I decided to leave it on as this will be used by my wife. I am just preparing the notebooks for her and getting familiar with Vista so that I can be he IT support helpdesk. Unfortunately the fine control of UAC options is not available for the Home Premium version of Vista.
http://technet2.microsoft.com/WindowsVista/en/library/0d75f774-8514-4c9e-ac08-4c21f5c6c2d91033.mspx?mfr=true

Hardware compatibility is still a problem. My wife's Nokia 6280 Mobile Phone works (on the other hand, it did not work under my Linux Desktop. It originally did not work under XP with the same Desktop either but with the updated software it now works under XP). Her beloved Samsung SPP-2020 Photo Printer does not work even though Samsung claims Vista support in their website. I am still investigating this issue. Hopefully I can solve this issue with new software from Samsung or Vista SP1 (now under testing).

Edit: 10 minutes after I posted the blog, I found the solution. It work after deleting C:\windows\inf\INFCACHE.1 and reinstall the printer driver, it works now. It seems to be a common problem.

My newly bought cheap S$75 Orient MP4 player 2GB (looks like IPod Nano, MP3 sound quality is okay, but FM is pretty bad, anyway, I have my trusted Sony Radio.) failed to work (it works under XP and Linux by appearing as a USB storage device). Anyway, I think that is mainly a firmware fault. There are so may buggy USB device out there.

Edit: This again works now after getting SPP-2020 to work.

As this notebook is not intended for my use, I will not install development tools like MPLAB on the computer. Anyway, MPLAB and many other Microchip development tools are now supported under Vista 32bit.

Overall the first impression of Vista is that it seems to be okay. There is nothing too exciting but nothing too disappointed. Anyway, it is not that bad as reported.

New Vista Notebook

On Christmas day, we bought a notebook with Vista Home Premium. It is Compaq Presario V3619AU (GX855PA) with RAM upgraded to 4GB from 1GB as the promotion. It costs S$1299 for the base 1 year warantee option. Since I did not trust the quality of any notebook vendors due to my bad experience with Dell Inspiron 600M I bought back in 2003 (1st year HDD and motherboard gone but luckily under warantee. Now keyboard controller is bad so I have to put an external USB keyboard), I opted to upgrade to have 3 year warantee which cost another S$199. So alltogether it is S$1498.

Specification:

Product Name: Compaq Presario V3619AU
Product Number: GX855PA
Microprocessor: 1.90 AMD Turion 64 X2 Dual-Core Mobile Technology TL-58
Microprocessor Cache: 512 KB + 512 KB L2 Cache
Memory: 1024 MB (2 x 512 MB) (now upgraded to 4GB)
Memory Max: Up to 4 GB
Video Graphics: NVIDIA GeForce Go 7150M
Video Memory: Up to 287 MB (not seem to correct now that it has 4GB RAM)
Hard Drive: 160 GB (5400 rpm)
Multimedia Drive: LightScribe SuperMulti 8X DVD±RW with Double Layer Support
Display: 14.1” WXGA High Definition BrightView Widescreen Display (1280 x 800)
Fax/Modem: High speed 56K modem
Network Card: Integrated 10/100BASE-T Ethernet LAN
Wireless Connectivity: 802.11 a/b/g WLANBluetooth wireless networking
Sound: Altec Lansing speakers
Keyboard: 101 key compatible keyboard with 1 Quick Launch Button
Pointing Device: Touch Pad with On/Off button and dedicated vertical and horizontal Scroll Up/Down pad

PC Card Slots: One ExpressCard/54 slot (also supports ExpressCard/34)

External Ports:
5-in-1 integrated Digital Media Reader for Secure Digital cards, MultiMedia cards, Memory Stick, Memory Stick Pro, or xD Picture cards
VGA
3 USB
RJ-11
RJ-45
Headphone out
Microphone in
IEEE 1394 firewire
Consumer IR
S-Video TV out
Expansion port 3

Dimensions : 33.4 cm (L) x 23.7 cm (W) x 2.6 cm (min H) / 3.9 cm (max H)
Weight: 2.45 kg
Power
65 W AC Power Adapter
6-cell Lithium-Ion (Li-Ion) battery

OS: Windows Vista Home Premium, Microsoft Works, etc

Bundled Junk:
Microsoft Office 2007 Home/Student (60 day Trial)
Norton Internet Security (60 days trial)

Tuesday, December 25, 2007

Serial Port Based Intelligent PIC Programmers

I have wrote about USB based PIC programmers and simple PIC programmers. It seems that with PICkit 2 coming out, it makes less sense to use other serial based intelligent PIC programmers. Still some of the users may already have those simple programmers and want to build their own intelligent PIC programmers. In that case, here are some recommendations.

1. Wisp628A: http://www.voti.nl/wisp628/
You can build this relatively easily. Actually back in 2005, I've built two of this on a breadboard.
The alternative firmware and software from Rob Hamerling's xwisp2 (http://www.robh.nl/picsoft.php) is my preferred choice. It is cross-platform and supports OS/2, Windows, Linux, Mac OS X and FreeBSD.

You can either buy the kit and build your own or create your own based on the information on the site.

2. Easyprog: http://www.embedinc.com/easyprog/
The author (Olin Lathrop) provides the hardware design, firmware and software sources.
You can buy the kit and assemble by yourself. I do not think you would like to buy the ready-made kit since PICkit 2 may be cheaper and better. Embed Inc also has the ProProg
(http://www.embedinc.com/proprog/index.htm) which is aimed at production and USBProg (http://www.embedinc.com/products/eusb2/index.htm) which is aimed at profoessional lab and benchtop use. ProProg and USBprog seem to be both well designed.

3. Kitrus also has some kits. http://www.kitsrus.com/pic.html
The price may not be justified now that PICkit 2 is out and at only US$35 (not including tax and shipment).

4. Microchip PICstart+:
Some of the sites have the clones but I think this is not easy to be built by hobbyists and its feature is not as good as PICkit 2 even though it is more expensive than PICkit 2.

A survey of simple PIC programmers under Windows and Linux

Merry Christmas and Happy New Year!

I myself do not use any simple PIC programmers without a PIC as the brain of the programmer. Still some people think PICkit 2 is too expensive at US$35. So there is still a market for the simple programmers. Coupled with bootloader, it can still be useful for some hobbyists. Of course I will still recommend PICkit 2 to those who can afford the US$35, it is well worth the money and save you a lot of troubles with the simple programmers.

Windows simple PIC programmer software sites often links to the supported hardware. Some of them are based on Parallel port (eg: Tait), some of them are based on Serial port (eg: JDM), very few of them are based on USB. Parallel port and serial port start to disappear from many laptop computers. And many of the serial port based programmers will not work properly with common USB-to-Serial converters. Almost all Parallel port based programmers will not work with common USB-to-Parallel converter (often made for old printer). Some of the very simple programs only support LVP (low voltage programming) which only applies to very few PICs (but some of the PICs are popular). So far I can see that most simple programmers do not support 3V only PICs like PIC18J/18K and PIC24/dsPIC33 which PICkit 2 support well.

WinPIC:
http://freenet-homepage.de/dl4yhf/winpicpr.html
http://www.qsl.net/dl4yhf/winpic/index.htm
WinPIC supports many 5V PICs and its manual seems to be quite good. Another advantage is that the author also provides the source packages.

WinPIC800: http://www.winpic800.com/index.php?lang=en
It claims the support of most Flash PICs and can rival some of the features of PICkit 2. But take note that its main supported programmer GTP-USB+ is actually an intelligent PIC programmer and at 60 Euro it is much more expensive than PICkit 2 which costs US$35 . If you are using the simple programmer, I am not so sure if it still supports the same number of device.

PICPGM: http://www.members.aon.at/electronics/pic/picpgm/
PICPGM also supports quite some PICs. One interesting thing is that it has an FT245BL based USB programmer which unfortunately only supports LVP.

IC-Prog: http://www.ic-prog.com/index1.htm
IC-Prog is perhaps one of the most popular programing software in the web. However, its support of PICs is actually one of the weakest from the website.

Linux:
pikdev: http://pikdev.free.fr/
pikdev supports many simple programmers and PICs under Linux.

piklab: http://piklab.sourceforge.net/
piklab supports many simple programmers and PICs under Linux. Of course, it also supports many other programmers, including Microchip MPLAB ICD2.

picprog: http://hyvatti.iki.fi/~jaakko/pic/picprog.html
This is different from the maybe-better-known picprg (http://www.brianlane.com/software/picprg) but it is actually much better than that one.

Odyssey: http://vasco.gforge.enseeiht.fr/index.php?article=Odyssey.html
It only supports Parallel port based programmer. But anyway, parallel-port based simple programmers is said to be more reliable than serial port based simple programmers.

Saturday, December 22, 2007

NetBSD 4.0 upgrade -- smooth process

I installed NetBSD 3.1 sometime ago. I also used the pkgsrc binary CD to install GNOME so that I had a basic working installation.

One of the annoying 'feature' of NetBSD 3.1 is that it is not compliant to multi-boot so that grub will not be able to pass the kernel parameters to it. Therefore I need to answer several questions before I can boot into NetBSD. Somehow pkg_add did not work well with ftp.netbsd.org.

So now NetBSD 4.0 is just out. So I update the existing installation to it today. It is a very smooth process. More importantly, it is compatible with multiboot and grub has no problem to boot NetBSD 4.0 now. The existing 3.1 binary packages are still working. pkg_add is now working as well with ftp.netbsd.org even though it still prints out some error messages.

Since I have got PICkit 2 to work under FreeBSD (with HPS USB stack), I will try to get it to work under NetBSD. But I have never used NetBSD before, this might take some time.

Friday, December 21, 2007

fpusb -- Another libusb-0.1 replacement under Linux

http://reactivated.net/fprint/wiki/Fpusb

The author is trying to solve the problems of libusb-0.1 but not going to use OpenUSB which is more ambitious.
  • Isochronous endpoint I/O
  • Asynchronous I/O with per-URB style callbacks
  • Zero threads (lightweight, uses main thread of calling application)
  • Exposure of poll fds to applications for good main loop integration
Right now it only works under Linux but it looks promising. Anyway, there is not much development of libusb-0.1 and libusb-1.0 now. OpenUSB is only partially working under Linux and Solaris right now.

What I am really hoping to have is a real cross platform HID API. libhid is supposed to be the one, unfortunately it is not really cross-platform.

libhid: http://libhid.alioth.debian.org/
libusb: http://libusb.sourceforge.net/
libusb-win32: http://libusb-win32.wiki.sourceforge.net/
OpenUSB: http://openusb.sourceforge.net/wiki/

GPLed dsPIC33 MP3 Decoder Based on MAD

Finally this is done by Alex B in Microchip Forum. I am not into dsPIC much yet but I think this is really outstanding.

http://forum.microchip.com/tm.aspx?m=166133&mpage=4

Download (GPL licensed):
http://www.pic24.ru/upload/dspic_mp3.zip

It is based on MAD.
http://www.underbit.com/products/mad/

Installing Ubuntu from a Unix/Linux System

https://help.ubuntu.com/6.10/ubuntu/installation-guide/i386/linux-upgrade.html

This is nice guide and today I tried to install a Ubuntu 6.10 to a existing partition (which was used to test Vmware Player but I found Vmware Player is not my cup of tea since I prefer multi-boot) from a chroot environment under Ubuntu 6.06 LTS.

A fast mirror is nice to have in this case. For me I use either the default Singapore mirror (http://sg.archive.ubuntu.com) or the Australia mirror (ftp://mirror.pacific.net.au).

I manually installed the following file, there may be new versions when you read this.
http://sg.archive.ubuntu.com/ubuntu/pool/main/d/debootstrap/debootstrap_1.0.7_all.deb

After that, I followed the guide and I have a working base installation in less than 20 minutes.

I found /etc/resolve.conf and etc/hostname was already set up properly for me.

After editing the grub.conf inside Ubuntu 6.06 LTS (I mainly use it along with 7.10) and rebooting, I ran the following two commands and then I had a almost fully working system. Strangely sound did not work under Gnome until power-down and then cold-boot the computer.
sudo apt-get install ubuntu-standard
sudo apt-get install ubuntu-desktop


Sunday, December 9, 2007

Nice Article: Forget the Linux Desktop, it's the Linux Laptop that matters!

http://sourcesmouth.co.uk/blog/Forget-the-Linux-Desktop-it-s-the-Linux-Laptop-that-matters.html

OLPC, EEE and similar efforts are really bring Linux closer to the mainstream. Anyway, most of the people do not need the functionality of Office 2007 and do not need the Aero interface of Vista.

XP+Office XP (or Windows 2k+Office 2k) will be good for most home and business users. And now main stream Linux+OpenOffice is actually good enough for most home users. For business user, depending on the field, it may or may not be possible to ditch Windows XP which is really a very good OS with SP2 installed. But I believe OpenOffice is actually good enough for majority of the business users.

What is a Vista Home Basic Machine with 512MB RAM Good for?

http://www.microsoft.com/windows/products/windowsvista/editions/systemrequirements.mspx
Microsoft typically published their system requirement a bit too low for real world. But I've seen some Vista Home Basic machine with only 512M of RAM. What is that machine good for?

The best answer so far comes from Dell Singapore website.
http://www.dell.com.sg/vista

It is great for " Booting the Operating System, without running applications or games".

Nice demo machine to show off Vista, huh? ;-) ;-)

Saturday, December 8, 2007

Impressions of Some Linux/BSD Distributions

Before Fall 2002, I was mainly playing with Linux (Slackware, Redhat, Mandrake, Corel, Caldera, etc) but still use Windows mostly at home. I was not using Linux between Fall 2002 and Spring 2005.

I started to try out Linux again with Ubuntu 5.04 and I liked it quite a lot. Then I was trying to 5.10 and it was not as good so I started to look at Fedora as well (Core 4). Soon I fixed the problem with 5.10 and then I found 6.06 LTS a great distribution that I am still running it as the main distribution now. I also tried Ubuntu 6.10/7.04 and they were good as well. Now I have Ubuntu 7.10 installed. Initially it is not good (problem with USplash screen) but I solved it. Firefox 1.5 under Ubuntu 6.06 is not that good but switching to swiftfox seems to solve the problem. Firefox 2.0 under Ubuntu 7.10 initially is very bad but once I remove xgl/compiz stuff it becomes better now.

On the other hand, FC5/FC6 and Fedora 7 were also not bad so I was using Fedora as the 2nd option to Ubuntu. Fedora 8 is a disaster (despite the flawless installation process) that it did not boot after installation due to the bug associated with FreeBSD partitions. So now I do not have a Fedora installation.

I tried to use OpenSuse as well, it is rather sophiscated but I feel it is relative slow. OpenSuse 10.2 installation is not good that it writes the Grub bootloader without asking and messed up my Grub. I have to boot to Ubuntu 6.06 and recover the bootloader. BTW, for Grub recover, it seems that Knoppix is good. OpenSuse 10.3 installation is flawless but trying compiz caused the system not to boot so I gave up.

I tried to use Arch Linux and it is quite good in terms of upgrading (versionless) but I do not find it offer anything more than Ubuntu.

I tried to use Gentoo for two days and it was a pain due to dead mirrors and long compiling process. And since I have FreeBSD installed, I do not need another source based distribution. FreeBSD does offer something Linux does not offer -- a BSD licensed kernel and userland. FreeBSD is not as easy to use as Linux but it is quite usable as well. I am also trying out NetBSD but I feel it is not good for desktop usage.

PClinuxOS looks nice and in the end it does not offer anything better than Ubuntu (maybe KDE is better under PClinuxOS).

So now I have Ubuntu 6.06/7.10 and FreeBSD 7.0 Beta. I will try out other things from time to time.

I still use Windows XP SP2 at home occassionaly but mostly I am using Ubuntu.

USB Programmers for PICs

http://forum.microchip.com/tm.aspx?m=283491

As someone who has used PICKit 1, PICkit 2, ICD2, Promate II and Promate III and a follower of PICkit 2, I find it interesting that people still want to create yet another simple USB programmer.

Anyway, here are my classification of USB PIC programmers. I might miss many programmers in the lists but it pretty much show you the pictures. After class 3, then there are many high end programmers from Data I/O, BP or similar for mass production.

Class 1: Simple USB programmers (not as good as PICkit 2 and USBprog):
1. picsquirt http://www.p10link.net/plugwash/picsquirt/
2. GTP USB lite (somewhat like a USB version of Wouter's WISP628A) http://www.hobbypic.com/index.php?option=com_content&task=view&id=12&Itemid=35

Class 2: Good for personal and lab use
1. PICKit 2, good and cheap, supports many PICs and double as a debugger.
http://www.microchip.com/pickit2

2. Another good USB programmer is the Amadeus.
The author is aparently very knowledgeable about PIC programming specifications. Not many people understand it as thoughly as him. Olin may be one of them. http://home.arcor.de/bernhard.michelis/

3. The author of WinPIC800 software has the GTP USB+ Programmer which seems to be a decent programmer as well.
http://www.winpic800.com/index.php?lang=en

4. USBprog is a kind of higher-end PICkit 2 in terms of hardware functionality. USBprog hits a good spot between PICkit 2 and Promate III but I find its chip support a bit limitted compared to PICKit 2.
http://www.embedinc.com/products/eusb2/index.htm

Class 3: low quantity production quality programmer After class 2 then you have higher-end USB programmers like Promate III and SoftLog ICP2. SoftLog ICP2 seems to be a serious contender to PM3 at much lower cost.

Between USBProg and Promate III, there are still quite some good gaps. SoftLog ICP2 is a good attempt.
https://www.microchipdirect.com/ProductDetails.aspx?Catalog=BuyMicrochip&Category=Programmers&mid=13

Some PICkit 2 Links

PICKit 2 website:
http://www.microchip.com/pickit2

PICkit 2 Faq:
http://forum.microchip.com/tm.aspx?m=270347

PICKit 2 Wishlist:
http://forum.microchip.com/tm.aspx?m=260540

PICkit 2 under Linux, pk2 and pk2cmd Linux port:
http://home.pacbell.net/theposts/picmicro/

PICkit 2 versus ICD2:
http://forum.microchip.com/tm.aspx?m=287314
http://forum.microchip.com/tm.aspx?m=282776