Search This Blog

Friday, 15 June 2012

Surface level measurement using LIS302DL-MEMS Accelerometer

Bingo! I want to write a program for LIS302DL(MEMS Accelerometer) by my self since I've bought STM32F4 Discovery. After few days of working and learning, I've just finish my programming few minutes ago and it is working perfectly well.

So, the program is written to keep the discovery board's surface level at zero, means if the surface is tilted on which the Board is placed, the led(s) will glow such that it indicate the direction at which the surface should be tilted to balance the level.

STM32F4 Discovery also came with the same program, but it is too complex to understand. In their Demo, TIMER4 is used. Instead of using timer I've used only simple led on-off command. It is too simple to understand then using timer.

Here are some photos:

It isn't possible for me to tilt the whole table. So, I just tilted the board!Bad PJ, isn't it?





Here's the video of Acceleromter and STM32F4 in action:




The program used one special type of interrupt Sys_Tick. This interrupt generates at every 1ms in my program. You can change if you want. So, at every 1ms we check the resisters of LIS302DL and compare it with our logic to blink led according to the direction. I don't want to say that we should not use TIMx in programming, but what I mean is why to use complex programming method when the simplest form of programming is available. The main advantage of not using TIM4 is that the time require to handle TIM4 interrupt is saved in case of using simple GPIO On-Off command.


Friday, 8 June 2012

Learn ARM Cortex-M programming by STM32

I am writing this post after a long time. Oh man! right now I am enjoying my vacation. I wish this vacation lasts forever. 

Anyway I was thinking to do something interesting in the summer vacation and I have vacation of almost two months. So, I have plenty of time to learn something interesting. When I was learning about microcontrollers, I've always a keen to know about ARM architecture and want to learn it's programming.

I mean when I heard about the project based on ARM or watch youtube videos about ARM projects, I was like man! I want to learn this stuff! After checking few manufacturer's development board I found them too costly and even their programmer costs a fortune!! Yeah! you can say that because a programmer alone cost you 200$!

Few days ago, I was checking ST microelectronics website and found their new development board. Believe me this board is awesome. It costs you just 22$(1400 INR). 
Isn't is amazing? I mean these all features cost at least 100-150 usd and you've ARM Cortex-M series microprocessor for developing in just 22$!

I bought STM32F4DISCOVERY development board by ST Microelectronics just a few days before through kits and spares. Believe me or not no other development board is good as it is. I've spent couple of hundred just to learn simple microcontroller programming. I've used development boards from Microchip, Atmel , Texas Instruments, but I've never seen anything like STM32F4DISCOVERY. Take a glance at it.


STM32F4DISCOVERY BOARD

 If you're still feeling that the board isn't worth that much than here're some of its features:


● STM32F407VGT6 microcontroller featuring 1 MB of Flash memory, 192 KB of RAM
and LQFP100 package
● On-board ST-LINK/V2 with selection mode switch to use the kit as a standalone
ST-LINK/V2 (with SWD connector for programming and debugging)
● Board power supply: through USB bus or from an external 5V supply voltage
● External application power supply: 3V and 5V
● LIS302DL, ST MEMS motion sensor, 3-axis digital output accelerometer
● MP45DT02, ST MEMS audio sensor, omnidirectional digital microphone
● CS43L22, audio DAC with integrated class D speaker driver
● Eight LEDs:
– LD1 (red/green) for USB communication
– LD2 (red) for 3.3V power on
– Four user LEDs, LD3 (orange), LD4 (green), LD5 (red) and LD6 (blue)
– 2 USB OTG LEDs LD7 (green) VBus and LD8 (red) over-current
● Two pushbuttons (user and reset)
● USB OTG with micro-AB connector
● Extension header for LQFP100 I/Os for quick connection to prototyping board and easy
probing


Now you can say OMG! WOW! All these features in just 22$! Why to spend thousands of rupees on microcontroller or microprocessor that isn't based on ARM and you've full support and ease of learning at affordable price.

In the beginning I thought the programming of at least one architecture must be done to learn ARM programming, but I was completely wrong. If you know some basic thing about 8085 or 8086 or any other microcontroller, you can learn ARM architecture and to program ARM. Even if you doesn't know how to program a microcontroller!- it is okay. Besides STM32F4 has maximum clock upto 168 MHz at 210DMIPS and DSP features. The best performance any another microcontroller like 8085, Microchip and Atmel can give is like 80-120 MIPS.

ARM CORTEX-M4 gives freedom to develop real time embedded application easily, with great support of community and of course at affordable cost. You can expand the limitation faced by any other microcontroller. You can develop application based on speech, image,etc with its DSP core. I will post some tutorials about how to use STM32F4DISCOVERY and program it.

Some useful links:
STM32F4DISCOVERY official website: http://www.st.com/internet/evalboard/product/252419.jsp
Kits and Spare by Element 14                : http://kitsnspares.com/user1/buyproduct.asp