cancel
Showing results for 
Search instead for 
Did you mean: 

How to start with Discovery

gsantha
Associate II
Posted on September 13, 2011 at 00:06

Hi!

I've just purchased my board and I'd like to create my own applications. Is there any example code or similar to get me started? I checked the demo code which is very complex and also found a peripherial library with template project but that is not for Discovery. How can I start with this board?

Any idea would be great,

Regards, Greg73
12 REPLIES 12
Posted on September 14, 2011 at 15:58

Depends on what aspects you want to experiment with. The Keil and IAR evaluations have examples for the STM32 in general, and some of that is fairly portable.

You could take the STM32L-Discovery project (or the STM32L152-EVAL one), and either prune the stuff you don't want out, or strategically add code you want to test or play with into the current code, replace main(), or comment out sections you don't want. Morphing the demo code into something you want will allow you to get comfortable with the process.

http://www.st.com/internet/evalboard/product/250990.jsp

http://www.st.com/internet/com/SOFTWARE_RESOURCES/SW_COMPONENT/SW_DEMO/stm32l-discovery_swdemo.zip
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
gsantha
Associate II
Posted on September 14, 2011 at 22:37

clive1,

thank you for the input. I already have the demo code but found it unnecessarily complex after using other competitors libraries. I prefer my code to be understandable - this demo code is very far from that: layers above layers, structures in structures. I'm not quite new to programming but sincerely I never seen such complexity...just toggling an IO pin requires zillions of code lines...just a whole new level for me.

It also doesn't cover such important fields like UART, SPI or timers. Am I really expected to find out how ST had laid down the peripherial library structure without ANY examples or documents? It is very disappointing  to have a board with no software support at all. Is ST really thinks that releasing an introductory ARM dev board with no examples with no library is okay?

I think I'm just abandon this board till ST releases a proper software support as my time is dearer than wasting it with reverse engineering the one and only demo code.

Thanks anyway,

Greg73

Andrew Neil
Evangelist
Posted on September 15, 2011 at 00:40

The STM32 is a very versatile chip - so that naturally means that there's a lot of things that need to be configured.

The alternative to having structures to hold settings would be to have functions with huge parameter lists, or huge numbers of functions each doing very little.

I agree that the Peripheral Library documentation is poor. There used to be a PDF manual, but ST switched to a CHM helpfile long ago (a bad move, IMO).

There are plenty of examples included in the Peripheral Library, although the coding standards leave a lot to be desired.

''I think I'm just abandon this board till ST releases a proper software support as my time is dearer than wasting it with reverse engineering the one and only demo code''

Well, the purpose of an Evaluation boad is to evaluate the product. At least it was cheap!

gsantha
Associate II
Posted on September 15, 2011 at 01:12

Neil,

I agree that STM32 is versatile and interesting, that's the reason I purchased my board.But hey, all the others are also versatile, and they provided libraries and examples along their boards. They say it is easy to transfer the library code to other boards - if it's easy why they haven't done it yet?

 I am kind of a developer who doesn't like to stuck in one brand or chip or manufacturer. But my time and money is not endless. I simply can't afford to spend weeks on toggling pins.

I also understand the budget airline approach but I don't think it's a good idea with poor software support. A cheap board is a great possibility to attract people who would eventually stick to that processor. ~10 EUR is not much for a board, let's go for it - a lot would say. But it is not gonna work without software support. It just rejects people in the long run. The board is cheap, your time is not 🙂

ST would need short, simple examples of the peripherials. No need for huge, 'every possible board is included', bell and whistles 100+ header monsters, IMHO. Do you like fiddling with zillions of defines, headers etc when all you need is an ADC with an UART?

Warmest regards,

Greg73

Andrew Neil
Evangelist
Posted on September 15, 2011 at 15:22

''all the others ... provided libraries and examples along their boards.''

 

 

ST do provide libraries and examples.

''I simply can't afford to spend weeks on toggling pins''

There will always be a learning curve for doing anything the first time - but it won't continue to take as long every time!

''it is not gonna work without software support. It just rejects people in the long run. The board is cheap, your time is not''

 

Indeed - see rant here:

http://www.8052.com/forumchat/read/174319

''ST would need short, simple examples of the peripherials''

The library does include a set of short, simple examples for each peripheral.

''No need for huge, 'every possible board is included'''

Yes, that does rather tend to obscure things.

gsantha
Associate II
Posted on September 15, 2011 at 23:51

''ST do provide libraries and examples.''

For STM32L-Discovery? Am I overlooking something?

 

''The library does include a set of short, simple examples for each peripheral.''

I've got the STM32L1xxx peripherial library and template project. The template project is for STM32L152-EVAL board. Porting the template to Discovery doesn't look like an easy job. Not impossible though. I hope ST will eventually support its Discovery board.

Andrew Neil
Evangelist
Posted on September 16, 2011 at 01:11

There is only one Library - it is entirely independent of the external target hardware.

You're probably right - the examples aren't targetted specifically at the Discovery board.

But the only difference is really which pins are used - surely?

gsantha
Associate II
Posted on September 16, 2011 at 09:42

Yesterday I tried to compile the template project just to see what happens. I changed the device to ST STM32L152xB. Got 240 compilation errors, mostly:

Error[Pe147]: declaration is incompatible with ''__interwork __softfp void __set_MSP(unsigned long)'' (declared at line 51 of ''C:\Program Files\IAR Systems\ C:\Documents and Settings\notebook\Documents\__WORK__\Software\CODE\Examples\__STM32__\STM32L1xx_StdPeriph_Lib_V1.0.0\Libraries\CMSIS\CM3\CoreSupport\core_cm3.h 1114

Embedded Workbench 6.0 Kickstart_1\arm\inc\c\intrinsics.h'')

Anyway, I get your point. Some people love to tweak with this gadgets it's all right. But I'd write a driver for a new OLED display instead of troubleshooting a product.

Andrew Neil
Evangelist
Posted on September 16, 2011 at 10:15

''Got 240 compilation errors''

That usually means that there's one (or a few) ''main'' errors, and all the rest are a direct result. So fix the one (or few) ''main'' errors, and all the consequent errors will also be fixed...