cancel
Showing results for 
Search instead for 
Did you mean: 

using the SPI INTERFACE in olimex stm32-p103 dev board

abhinavbose87
Associate II
Posted on December 03, 2009 at 07:29

using the SPI INTERFACE in olimex stm32-p103 dev board

20 REPLIES 20
abhinavbose87
Associate II
Posted on May 17, 2011 at 13:28

anyone tried to use SPI interface on stm32-p1o3 board from olimex?i am kind of new to the field and interested to know how to use the interface to connect the board to lcd display EA DOGM162. or anyone used the interface to do any other similar connection?

thank you

pranamesh
Associate II
Posted on May 17, 2011 at 13:28

there is an example from olimex itself (for their STM32-103STK board, which uses nokia LCD with SPI interface) that you can use. I did not find EA DOGM162 data sheet in the site

http://www.lcd-module.com/products/dog.html

. However their module EA DOGM132 module's command set for initializing and running the LCD is given and should be simple to use by changing the example of STM32-103STKmboard's LCD driver.

I cannot put the code here directly as I don't own it, but you can ask olimex for the sample application that comes with STM32-103STK dev board.

abhinavbose87
Associate II
Posted on May 17, 2011 at 13:28

the exact product id is EA DOGM162L-A.sorry if i typed it wrong

the data sheet is available at

http://nl.mouser.com/ProductDetail/ELECTRONIC-ASSEMBLY/EA-DOGM162L-A/?qs=s9z6UkyjM7oV4999Q8yEyQ%3d%3d

[ This message was edited by: abhinavbose87 on 03-11-2009 10:48 ]

pranamesh
Associate II
Posted on May 17, 2011 at 13:28

there are several examples for this LCD driver (ST7036 as in the data sheet) floating on the internet. Check out

http://github.com/halfbyte/lcddogmspi

http://embdev.net/topic/126291

just port the code using the spi example from ST for stm32xx.

abhinavbose87
Associate II
Posted on May 17, 2011 at 13:28

k i successfully soldered the display to the board now i have to bring it to life.so can u help me with how to write the data to the display ram?the data to be written is in the data sheet.

my next task would be to print hello world on the display

pranamesh
Associate II
Posted on May 17, 2011 at 13:28

Did you

:( go through the SPI example from ST library samples

:( go through the example code given in the links I gave above

:( did you try to get the sample code of olimex dev board with nokia SPI lcd. (a quick check on google gave me

http://www.micromouseonline.com/blog/2009/05/25/running-a-nokia-3410-lcd-on-the-stm32

which has a similar example)

I am sure you should be able to get the lcd up an running in no time if you follow the above ;)

abhinavbose87
Associate II
Posted on May 17, 2011 at 13:28

k went through them and have some really basic doubts as i am a novice to embedded programming

1)each one of the links gives a different code for the spi interface.can u please explain how the driver software is different for same interface.and why do they want to use a different code when a ready made SPI driver is available at st site in standard peripheral library free to download?

2)after i decide upon which driver to use,which i think is the one i got from st site in standard peripheral library,what do i do next as the driver is a .c file with many more .h files.there is no make file for some unknown reason.

my understanding is that i have to some how compile the driver .c program and put it in the board so that the display can be identified(correct me if i am wrong).

3)once i compile the driver code using the arm toolchain i have built already,where in the board should i load the code?is it the flash memory,or should i mention a specific location in memory where driver is to be installed.

4)once i finished that,how do i start writing data to the display?

i know these are very basic question for you but i frankly dont know the answers.so please take some time and reply...

tomas23
Associate II
Posted on May 17, 2011 at 13:28

Hi, I'd add something not really related to your LCD, but to your newbie status:

embedded programming is about learning, spending hours and days over a technical issues (better say challenges), and having big celebrations after breaking into your first external RAM, LCD, sound, writing your first PC driver etc. It's more like a way of living, not just one-of-many hobbies :D

You need to get experience in few things:

a) analog world around your MCU

b) digital world around your MCU

c) your MCU

d) all peripherals and their caveats

e) assembly language

f) C (or other) language of your MCU

g) communication interfaces and protocols of other pieces of your HW

h) programming skills and tools for your PC to get your MCU talk to your PC

etc. You can start with a USB driver, but I'd suggest starting with a LED blinking, or using prepared examples for what you want to do.

So don't give up!

tomas23
Associate II
Posted on May 17, 2011 at 13:28

Now to your questions:

1. you need to understand the code a bit, cut it in logical pieces and assemble together. This will help you to cut-and-paste the SPI initialization, the communication and connecting your SPI routines with the LCD driver. I'd personally start with the SPI example, test it (highly recommend some two-channel memory scope) and when you are sure the display might get the data, wrap the SPI driver with the LCD stuff.

2. the make file is needed for command-line tools. The IDEs call the cmpiler and linker dynamically and assemble the ''command line'' depending on the content of project tree... The ST library doesn't contain any makefile, because you need to create it for your own program, anyway.

My advice - download Raisonance RIDE, IAR EWB or Keil uVision2 with their demo compilers and learn these tools. Otherwise your life will be much more difficult...

The library contains start-up files, linker files and ready-to-use project templates for all these environments, so the start-up is: open the project template, add your own source files and path to your header files, compile and go!

The library itself is not difficult to compile, supposing you add all needed source files and have well set path to header files.

3. don't see the driver in the Windows scope - it won't publish anything to you automatically. See the peripheral driver ONLY as a set of functions, constants and variables (together called API), that you can use in YOUR OWN program.

In the end, your program is a set of your .c files, compiled together with ST (and other) library .c or .obj files into one binary file (well, you can place it into more pieces of memory, but it's more complicated to explain).

You need to understand, that there is NO operating system behind - your code has a start-up code (usually hidden by a compiler RTL library), its own interrupt vectors and handlers etc. So YOUR program is heart of the system, nothing behind (again, you have the possibility to run some simple OSs, but your case is described above absolutely).

4. once you add all the files together and include their header files, call the HW initialization functions (for clocks, GPIO configuration, SPI configuration etc.), then call the LCD driver initialization function (that would call many SPI send functions) and finally call some LCD function, that can display a text.

If you get lost in the functions, don't be afraid of looking into their source code, and go deeper and deeper until you understand, what actually happens in the SW. At some point you'll meet your LCD datasheet on the other side of your search :D