Translate

Sunday, October 16, 2011

Olimex MSP430F169 LCD board


Olimex has different development platforms available for the MSP430.
One of these is the MSP430-169LCD. This article contains some notes about the board, tests operations and tips/tricks.

This development kit is very interesting.

FEATURES:

  • MCU: MSP430F169 with 60K Bytes Program Flash, 256 Bytes data Flash,2K Bytes RAM
  • NOKIA 3310 LCD 84x48 pixels black & white
  • Joystick with 4 directions and push button function
  • SD/MMC card connector
  • two LEDs: status and power
  • RESET switch
  • JTAG connector
  • 32 768 Hz oscillator crystal
  • 8Mhz crystall oscillator
  • power supply voltage regulators and filtering capacitor
  • extension headers for all uC pins
  • PCB: FR-4, 1.5 mm (0,062"), soldermask, white silkscreen component print
  • Dimensions: 67x66 mm (2.65x2.6")
On the Olimex website or the Sparkfun Electronics website , is possible to download the schematic of this board, a test program and the processor specific datasheet .

Linux development environment

First of all, I installed the mspgcc development system.
Since I use Ubuntu I installed it (another article will describe that ), then I installed the program msp430-gdbproxy and the libraries from the Soft-switch.org website.

This is very critical.
The msp430-gdbproxy must be copied in the directory where is installed the mspgcc environment (usually /usr/msp430/bin, but in my case /opt/msp430-gcc-4.4.3/bin) and the two libraries libHIL.so and libMSP430.so, must be copied in the directory /usr/lib.
It is vital to copy the program and libraries from the same site, i.e. compiled for the same version.
The mspgcc installation process already copy the libHIL.so and libMSP430.so but very likely these libraries are NOT in sync with the msp430-gdbproxy program.

JTAG test

Then I started to see if the Olimex board was working.
I connected a 9V battery to the board (Vin and GND) and the board become alive.
Then, removing the external power, I connected the board to the JTAG connector, already hooked to the parallel port of the PC.
The board come alive, since the JTAG connector, thru the jumper P-IN (inserted by default), bring the power.

At this point, following the instructions found on the Develissimo website and from this article on the MSP430 development environment , I started the msp430-gdbproxy in a terminal.
The first time I had strange error, so I reset the board and something started finally to work.
However using the suggested command :

#msp430-gdbproxy --port=2000 msp430

I obtained this error :

debug: MSP430_Configure()
error: msp430-gdbproxy: unable to open debugger connection. Will restart

I spent quite some time tracking this error but the only thing I realized, was that the error was somehow related to the TCP port used or about some conflict with other services or the Linux configuration.
Then I started to read the mspgcc documentation and I found some notes about the msp430-gdbproxy .
In the notes it was suggested to try the command:

#msp430-gdbproxy --debug msp430

and it worked !
Only I noted that the default port was not 2000 but 2001 !
So I modified the original command using the new port :

#msp430-gdbproxy --port=2001 msp430

and ... voila' !!!
I was able to connect the Olimex board with the JTAG.


So to recap, in order to open a debug session with the card :

  • connect the Olimex board to the Jtag (parallel version)
  • open a terminal and start the gdb proxy :
    msp430-gdbproxy --port=2001 msp430
    Note ! If is not working is possible to use sudo, but in this case the absolute path of the msp430-gdbproxy must be issued.
    For example in my case : sudo /opt/msp430-gcc-4.4.3/bin/msp430-gdbproxy msp430
  • open another terminal, or a tab in the already opened, and start the gdb :
    msp430-gdb name_program_to_load.elf
Inside the gdb digit help for generic help.
Here some common operations :
  1. connect to the board (first thing to do)
    target remote localhost:2001
  2. erase the flash memory (needed to do every time before to load the new code)
    monitor erase
  3. load a program in the flash
    load name_program_to_load.elf (or .a43)
Converting the demo code

The first test is to convert the IAR demo code available for this board, for the mspgcc.
Following the conversion rules , it is possible to compile with mspgcc the code.
To simplify the process I created a makefile. Looking at what files the IAR used to create the code, I created a simple makefile :

CC=msp430-gcc
CFLAGS=-O0 -Wall -g -mmcu=msp430x169

OBJS=main.o mmc.o system.o lcd_new.o

all: $(OBJS)
$(CC) $(CFLAGS) -o test.elf $(OBJS)

%.o: %.c
$(CC) $(CFLAGS) -c lt;

clean:
rm -fr main.elf $(OBJS)

To compile the code, simply open a terminal, go in the directory where there is the makefile and the source code and then :

  • $make clean
    to clean up the objects
  • $make
    to compile

The result is a file called test.elf that can be load directly using the procedure described above.
The code is running smoothly.




Joystick
Here some notes about the joystick on the board.
The joystick is seen as 5 different switches.
The higher 4 bit of the Port1 (set in I/O - input direction - MSB) are used to carry the state of the 4 direction switches and 1 bit of the Port 2 (set in I/o - input direction) is used to carry the state of the pushbutton.
Here a table :


Signal  Name  Description 
 P1.4 B1  Right
 P1.5 B2  Down
 P1.6 B3  Up
 P1.7 B4  Left
 P2.0 B5  Pushbutton 


The signals are pulled up, so when the switch is NOT pushed the reading will be high (1).
Here a Schematic to indicate the combinations of signals (remember, a 0 means the switch is pushed).







The continue line indicates the real signals, the dotted one the combinations of signals.
The inner circles indicates the name of the connection on the schematic.
Pushing the joystick on the left for example, will generate the combination of 0x7x (0111xxxx), i.e. masking the MSB will have 0x70 (01110000).
Pushing the joystick Up and Right will generate the masked combination of 0xA0 (10100000).







Here some other link to related resources and examples.


No comments:

Post a Comment