ARM Development

I have been wanting to get into ARM development so that I could run Linux or, more likely, Nuttx on a future DIY PCB board.  Given how little I knew about developing on ARM I needed an inexpensive board and tools for some educational experimentation. During the recent holiday season I ordered two ARM boards. First I received a LeafLabs Maple Mini. Although LeafLabs appears to be barely alive (no IDE improvements and minimal staff posts or responses since 2009) they are still selling the boards and the existing IDE is usable. LeafLabs created the Maple-IDE by repurposing the Arduino IDE and library to support the STM32F103RCBT6, a 32-bit ARM Cortex M3 microprocessor, instead of the Atmel chips. Once I established an ARM toolchain suitable to this cpu AND solved a problem of the Maple-IDE not detecting my serial port (see my LeafLabs FORUM-POST contribution, as “celem”), I found writing, installing and running ARM programs as easy as with the Arduino. LeafLabs is very MicroSoft Windows centric and their Linux support and especially 64-bit Linux (which is my case) is rather poor. Nonetheless, Maple-IDE is now running perfectly on my Mint-13 amd64 Linux desktop.

Since I paid the princely sum of $35+shipping for Maple Mini, I really wanted to reserve the Maple Mini for programming experimentation with the Maple-IDE, I purchased a cheaper device that I could sacrifice to my experimentation. I purchased an STM32F103RCBT6 mini development board that is commonly found on eBay. I paid $17 for it, including shipping. At last check it is available for as low as $13.77, including shipping. You can find it by searching on eBay for “ARM Cortex-M3 STM32F103RBT6 Mini Development Board” made by LcSoft of China. LcSoft also calls the board a “Cortex Study Board“. It does come with a schematic and source code for the pre-loaded test program.  It is so cheap because it is an old design that uses a serial port instead of a USB port. Based on my examination of the source code for the pre-loaded test program, the board appears to have been originally designed as a university project, possibly for use in programming classes. While there is a USB type-B port on the board, it is only there for power, at least as far as the pre-installed firmware is concerned. It could be made to work, in my opinion, with the right firmware installed. Since the board is configured to serial load via the serial port that is what I will use until, and if, I obtain a  JTAG programmer. After spending quite a bit of time honing my skills with the Maple-mini and pouring through the LcSoft STM32F103RCBT6 mini development board’s source code for the pre-loaded test program, I next spent a good while cobbling up a good Makefile from various STM32 Makefiles found on the Internet. Finally I was ready. After an embarrassing three days discovering how much that I did not know about ARM, I had a program and Makefile that I felt would work. Wow! It is hard to believe how exciting a blinking LED can be. It worked on the very first load!

STM32F103 Dev Board

STM32F103 Dev Board (NOTE: label on usb should be type-B)

The test program was stm32_blink_led-1.2.1-120107 written and posted by Polish engineer Freddie Chopin at his website http://www.freddiechopin.info. Check it out – he is launching a usb JTAG product called JTAG-Lock-Pick.

Anyway, you can watch this 5-second YouTube video of the blinking LED. Exciting? It was to me. The effort reminds me of an article that I read in the 1980s titled something like “All this to print a question mark”. It examined all of the code required to print a single character of the console. At the time, this inspired me to do the same thing on Unix. While at work, using a Bell Labs only product, CB-Unix, I wrote a ultra-simple assembly language program to print a question mark and followed the code through the system, using gdb, among other tools, I followed the code through the machine all the way until it appeared on the console. I printed xerox copies of the program listings (yes, at that time, I had Unix’s source code) of the entire thing. How I wish that I had not discarded that binder, oh so many years ago.

The schematic for this board is available HERE.

Whenever I make a more significant breakthrough with ARM I will make another post.

P.S.: I have posted below some notes taken while I examined the LcSoft STM32F103RCBT6 mini development board’s source code for the pre-loaded test program – just in case you purchase one – it’ll save you some time.

————————————————

This is a description of the demo program pre-installed on the ARM board made by LCSOFT ( http://www.lctech-inc.com ) which is  readily available on eBay. Lctech-inc.com calls the board a “Cortex Study Board” or  “ARM Cortex-M3 STM32F103RBT6 MINI STM32 Development Board”. On eBay, search for “ARM Cortex-M3 STM32F103RBT6 Development Board”

The LCSOFT/LC STUDIO STM32F103RBT6 board contains a STM32F103RBT6 SoC, one power LED, two programmable LEDs (PB8&9),  one reset pushbutton switch, two programmable pushbutton switches (PC0&1), a USB port that only functions to provide 5VDC  power and a serial port on a female DE-9 serial connector. There is a JTAG connector, jumpers to select serial port 1 or 2,  BOOT0&1 jumpers and breakout pins for all leads on the STM32F103RBT6 SoC.

The demo program template contained in the “user” folder functions as described below. This program utilizes ucosII, a priority-based pre-emptive real-time multitasking operating system kernel for microprocessors.

http://en.wikipedia.org/wiki/MicroC/OS-II

1.If you want to change the ucosII template, be advised that the template files herein do not not include nuclear ucosII operating  system source code files. You can download the necessary files, free for non-commercial use,  from the manufacturer of the RTOS,   Micrium, inc. Read:   http://micrium.com/rtos/ucosii/overview/

2.The implemented version for the demo is ucosII 2.83. You will need to add any missing Micrium files in the OS folder,  including the following documents:
os_flag.c os_flag.c
os_mbox.c os_mbox.c
os_mem.c os_mem.c
os_mutex.c os_mutex.c
os_q.c os_q.c
os_sem.c os_sem.c
os_task.c os_task.c
os_time.c os_time.c
os_tmr.c os_tmr.c
os_core.c os_core.c

Included Demo Program description:
This test program performs four functions:
1. Enter an ‘a’ or ‘b’ character in a serial terminal connected to the board’s serial port at 115200, 8 data bits, 8 stop bits,   no parity, and the software will output to the serial port that either a ‘a’ or ‘b’ was entered. On a Linux system this is usually  appears on /dev/ttyS0
2. Enter a ‘v’ character in a serial terminal connected to the board’s serial port and version information will be output. Any  character other than ‘a’, ‘b’ or ‘v’ is ignored.
3. Press either the ‘S1′ or S2’ switch on the board and the pressed key will be identified and echoed on the serial port.
4. The LEDs display, for 400ms each, an inverted binary representation of the first 4 digits of a count from 0 to 8. There is a pause   when the count is 5 to 8 because they are counted but not displayed. 0=both leds on; 1&3=led1 off; 2=led2 off; 4==both leds off

UPDATE: I have successfully compiled and run a test program with nuttx. I probably won’t use nuttx with this board but I wanted to see if I could do it. Initially, I discovered that, of the many supported boards and processors supported by nuttx, neither the  STM32F103RBT6 chip or the lcsoft.com/LC STUDIO board are supported. On the nuttx forum, I asked if one of the supported board would work. Although some suggestions were made, the answer was really, no. Not to be dissuaded, I ended up successfully building a nuttx load for the STM32F103RB chip/LC STUDIO board using the nuttx  “buttons” example program. Only by loading, compiling and then examining the PX4
project’s nuttx configuration could I get it to fully compile. I had to define the STM32F103RB chip in “arch/arm/include/stm32/chip.h” file and make configuration changes in the buttons config file to reflect the LC_Studio hardware.

The STM32F103RB is inadequate for probably complex, multithreaded nuttx tasks, such as those of the PX4 project, but I wanted to see if I could get it to work.

By the way – the PX4 project is amazing. Check it out at:
https://pixhawk.ethz.ch/px4/start

Advertisements
This entry was posted in ARM, computer, hardware, Linux, Programming, software, STM32 and tagged , , , . Bookmark the permalink.

4 Responses to ARM Development

  1. DJLinux says:

    The USB connector on your STM32F103RCBT6 mini development board isn’t only for power.
    It’s connected to port A pin A11/12 you with free USB libs from ST you can use USB for commication also.

    Like

  2. Matus says:

    Hi, I bought this board from eBay, but i didn´t receive any schematic. Could you please scan it for me and send it to me?

    Thanks

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s