Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

An attempt to mount an SD/MMC connected at parallel port of PC (a linux device driver)

Introduction:

Hi, for the last few days, I was engaged on a mad project, ie I was trying to access as SD card directly via parallel port of my desktop PC with linux. At first, I successfully did the SD/MMC initialization and tested it by reading and writing few sectors. Later I got a simple demo block driver code (kernel module) from net. Then I modified it and used my SD card code along with it and made a driver for the parallel port - SD/MMC card. Then after connecting the card to parallel port and inserting the module, a new device file is generated (/dev/sbd). After that I successfully mounted it and accessed it similar to that of a usb pendrive or any other external memory device. I have tested it with 64MB MMC, 512MB SD and a 1GB MMC and all worked fine.. But the only drawback is the speed of data transfer is around 200kbps only..:-( It takes 1 minute for transferring 1.5MB file to or from the card. Also the entire system may get hanged while the data is transferring...
But any way, it worked, that's enough for me..... :-)

LINUX DEVICE DRIVER FOR A 16x2 LCD MODULE CONNECTED AT PARALLEL PORT

This is a small parallel port char driver for printing text on a 16x2 lcd module connected at parallel port of a PC. I did this as a part of learning linux kernel-module programming. May be this could be considered as a hello world device driver.

INTRODUCTION:

 As we know, everything in Linux is treated as a file, even hardware devices like serial ports, hard disks, and scanners. In order to access these devices, a special file called a device node has to be present. All device nodes are stored in the /dev directory. Here, my 16x2 lcd connected to parallel port is also treated as a file and is accessed via a device node....
    Now, after connecting the 16x2 lcd to parallel port (as in my circuit diagram), and then inserting the driver module, a message "DRIVER INSERTED" is displayed on the 16x2 LCD. Later, if we make a character special file (node) with major number as 61, and if we write any string to it (echo HELLO > file), then it will be displayed on the 16x2 LCD. Now, if we write a long string to it, then it is displayed on the lcd by scrolling it from bottom to top until the string is displayed completely ...