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

4 comments:

Arun Prabhakar said...

Hii,
where can i find the linux drivers ?
Cant find it on http://www.internetking.org/fsusb/

--
rgb led project

Xiaofan Chen said...

The program is based on libusb and you can consider it as a user mode driver if you want. libusb is included in most Linux distributions.

Sandeep Senan said...

hi Xionfan,

I have been doing some work on PIC18f4550 and have successfully used your code to get my PIC bootloaded in windows using libusb...

I am now trying to use USB communication with PC and PIC.
How do i use the application PICDEM FS USB demo appliation,found at(http://www.varxec.net/picdem_fs_usb/ ),..I want to know if there is any SDCC port of the firmware side available..The ones i found at forums have lost links.

I am using SDCC for compiling the C code.


So i would be great full,If u could suggest me probable links on SDCC port of C Based firmware for the USB application..

Thanks for the help,
with warm regards
San

Xiaofan Chen said...

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

Microchip USB C18 Firmware framework ported to SDCC
http://www.efn.org/~rick/work/MCHPFSUSB/

I have not tried it yet.