Skip to content

Category: Linux

Linux

Nokia 6100 LCD

Got my Nokia 6100 LCD working. Long story of failures. First try was a LCD with a Epson controller from ebay for 10 Euros. But somehow someone failed to solder the smd socket proberly and it went a way 😉 ( thx max ) .

Next try was a Epson based LCD including a header board from
[sparkfun](http://www.sparkfun.com) . But this time i wasn’t able to run some demo code which was made for the LPC2138 on my LPC2148. I think the board was to fast to talk to the display. I wasn’t able set up SPI on the LPC2148 correct. Need more investigation on that topic.

So i gave up at this point and decided to go for a atmega16. I did a devel board for that which is losy based on this [schematics]( http://wiki.koeln.ccc.de/index.php?title=Atmel_Mikrocontroller_Kickstart). The boads uses simple parport icsp and has a serial line for debugging and sending data.

Finally i threw some code together using the init commands found in this [project](http://www.e-dsp.com/controlling-a-color-graphic-lcd-epson-s1d15g10-controller-with-an-atmel-avr-atmega32l). Added support for receiving images via uart and wrote an little python client for sending images.

Future plans are to port the [glcd](http://www.apetech.de/article.php?artId=3&nnId=12) lib to the epson based lcd.

![pic1](http://optixx.org/images/nokia/board.jpg)
![pic2](http://optixx.org/images/nokia/lcd.jpg)

[download source](http://optixx.org/download/nokia_epson_lcd_send.tar.gz)

8 Comments

EFSL for the ARM LPC2148

Found a LPC2138 port of the [Embedded Filesystems Library](http://www.efsl.be/). Took this stuff and made this working on my LPC2148.

Now i can access an SD-Card attached to the LPC2148. Currently the FAT filesystem is supported.
The sample pgramm includes an minimal serial line shell which supports file reading and directoy listings.

MMC/SD Card Filesystem Test (P:LPC2148 L:EFSL)
CARD init...spiInit for SSP/SPI1
Card is initialising.
CSD: 00 26 00 32 5F 59 83 C8 BE FB CF FF 92 40 40 D7
Drive Size is 1015808000 Bytes (1984000 Sectors)
Init done...
Press Command: d r a 
You pressed : d
Directory of 'root':
TEST01      ( 6 bytes )
TEST02      ( 6 bytes )
TEST03      ( 6 bytes )
TEST04      ( 6 bytes )
TEST05      ( 6 bytes )
TEST06      ( 6 bytes )
TEST09      ( 6 bytes )
TEST10      ( 6 bytes )
LOGDAT9 TXT ( 833 bytes )
DUMMY   LOG ( 2754 bytes )

[download source](http://optixx.org/download/efsl.tar.gz)

1 Comment

ARM LPC2148 and Linux

Just got my ARM LPC2148 Dev Board from [Olimex](http://www.olimex.com)

I put together a small overview how to get things working using a linux host system.

Toolchain

  • GNU Compiler Toolchain
  • Serial Programmer
  • Sample Code

  • Crt0
  • Linkerscript
  • Init Routine
  • Simple IO Test
  • SIO Debug Console
  • GNU Compiler Toolchain

    I use a standard arm GNU toolchain. Actuallay found [this binary](http://www.mikrocontroller.net/en/arm-gcc) download from mikrocontroller.net. But also my GBA Toolchain worked and produced good binaries. So a Gentoo ARM Crossdev should to the work.
    Think that the LPC is not too picky about that.

    Serial Programmer

    I tried [lpc21isp](http://guest.engelschall.com/~martin/lpc21xx/isp/) but it didn’t work for me. So i ended up using [lpc2k_pgm](http://www.pjrc.com/arm/lpc2k_pgm/). It has little gui and where you can setup all needed configs. I use iHex format to upload to the dev board, where i had best results using quite slow sio speed like 9600bps. You have to enable BSL on the LPC2148 for ICSP. On my LPC the switch is called ‘ICSP1’ which needs to be set into ON position.

    Crt0

    Nothing special about that. Took it from similar LPC based projects.Just setup stack sizes and default IRQ
    vectors. Worked out of the box.

    Linkerscript

    Tooks this from a other LPC project. The script specifies the memory layout of the target system and defines the sections for the binary output.

    Init Routine

    Code found in startup.c does the PLL init. The LPC2148 has 12 Mhz internal crystal but can run up to 60Mhz when setting the PLL. Also the default IRQ Handlers are defined here.

    Simple IO Test

    I used the on-board leds for a simple IO test.

    
    int main(void)
    {
        unsigned int i;
        Initialize();
        ConsoleInit(60000000 / (16 * BAUD_RATE));
        puts("Init done\n");
        IODIR0 |= 1 << 10;          // P0.10 is an output
        IODIR0 |= 1 << 11;          // P0.10 is an output
        IOSET0 = 1 << 10;           //LED off
        IOSET0 = 1 << 11;           //LED off
    
        while (1) {
            for (i = 0; i < 1000000; i++);
            IOSET0 = 1 << 10;       //LED off
            IOCLR0 = 1 << 11;       //LED on
            puts("led1: off  led2: on\n");
            for (i = 0; i < 1000000; i++);
            IOCLR0 = 1 << 10;       //LED on
            IOSET0 = 1 << 11;       //LED off
            puts("led1: on   led2: off\n");
        }
    }
    

    SIO Debug Console

    Addes a little module that uses one of the two serial line for debugging output. I use the same serial port as for for the ICSP, so after the flashing lpc2k_gpm will display the output directly without any setup changes.

    ![pic1](http://optixx.org/images/arm/small_dsc01985.jpg)
    ![pic2](http://optixx.org/images/arm/small_prog.png)
    ![pic3](http://optixx.org/images/arm/small_console.png)

    [download source](http://optixx.org/download/blink2148.tar.gz)

    5 Comments

    Font2Texture

    For a PSP project i need to convert a font to texture. Found a good working program [here](www.scumways.com/font2texture/).
    But the current version seems to be not maintained anymore. So i did some bugfixes and made it compile against current WX Widget libs. Also i add a new feature that the fontface info is written to c source file, that can be used directly in your project.

    ![pic1](http://optixx.org/images/font2texture/font2texture.png)

    [Source](http://optixx.org/download/font2texture-0.2.tar.gz)

    Leave a Comment

    Undelete with Sleuthkit

    Wrote a little Bash script using [Sleuthkit](http://www.sleuthkit.org/) tools to recover a deleted file from a partion. Tested the script with ext2 and fat32 filesystems.

    Setup a test image:

    dd  if=/dev/zero of=image  bs=1k count=8192
    mkfs.ext2 image
    mount -o loop image /mnt/image
    cp something /mnt/image
    rm /mnt/image/something
    sync
    umount /mnt/image

    Now you can start the script to find a token of the deleted file:

    ./find.sh image “Test”

    The Code for find.sh

    #!/bin/sh
     
    IMAGE=$1
    TOKEN=$2
    BSIZE=1024
    TYPE="linux-ext2"
    TMP="dls_$(date +%Y%d%m_%H%M%S)"
     
    if [ $# -ne 2 ]
    then
        echo "Usage: $0 image token"
        exit -1
    fi
     
    if [ ! -f $IMAGE ]
    then
      echo "Cannot find $IMAGE"
      exit -1
    fi
     
    if [  -z "$TOKEN" ]
    then
      echo "Pleae give search token"
      exit -1
    fi
     
    echo "--------------------------"
    echo "Found deleted"
    fls -f $TYPE -rd $IMAGE
    dls -f $TYPE $IMAGE > $TMP
    strings -t d $TMP > $TMP.str
    echo "--------------------------"
    grep -i "$TOKEN" $TMP.str
    echo "--------------------------"
    echo -en "Select Offset:"
    read n
    ADDR=$(grep -i "$TOKEN" $TMP.str | grep "$n" |  sed 's/^[ \t]*//' | head -n 1 | cut -d " " -f1)
    if [ -z "$ADDR" ]
    then
        echo "Nothing found for '$TOKEN'"
        exit -1
    fi
    echo "Found $ADDR"
    OFFSET=$(echo "$ADDR / $BSIZE" | bc)
    echo "Using Offset $OFFSET"
    BLOCK=$(dcalc -f $TYPE  -u $OFFSET  $IMAGE)
    echo "Using Block $BLOCK"
    echo "----------------------------"
    dcat -f $TYPE  $IMAGE  $BLOCK
    echo
    echo "----------------------------"
    INODE=$(ifind -f $TYPE  $IMAGE -d $BLOCK)
    echo "Found Inode $INODE"
    istat -f $TYPE $IMAGE $INODE
    BLOCKS=$(istat -f $TYPE $IMAGE $INODE | tail -n 1)
    echo "---------------------------"
    echo "Found Blocks $BLOCKS"
    echo "---------------------------"
    (for BLOCK in $BLOCKS
    do
       dcat -f $TYPE  $IMAGE  $BLOCK
    done) | tee $TMP.found
    echo "---------------------------"
    echo "Saved to $TMP.found"
    echo "---------------------------"
    rm -f $TMP $TMP.str
    Leave a Comment