Using low cost LeafLab Maple Mini boards with mbed.

Dependencies:   mbed-MapleMini mbed

You are viewing an older revision! See the latest version

Homepage

Maple Mini and the mbed

Sparkfun used to sell a board which provides an affordable (still available for less than $4 from some on-line sellers) and flexible way for users to try out new ideas and build prototypes. The board is equipped with an STM32F103CBT6 microcontroller compatible with the NUCLEO-F103RB platform.

Microcontroller features

  • STM32F103CBT6 in LQFP48 package
  • ARM®32-bit Cortex®-M3 CPU
  • 72 MHz max CPU frequency
  • VDD from 2.0 V to 3.6 V
  • 128 KB Flash
  • 20 KB SRAM
  • GPIO (32) with external interrupt capability
  • 12-bit ADC (2) with 10 channels
  • RTC
  • Timers (4)
  • I2C (2)
  • USART (3)
  • SPI (2)
  • USB 2.0 full-speed
  • CAN

Board features

  • Small foot-print
  • Flexible board power supply: USB VBUS or external source (3.0V-12V)
  • User LED: LED1
  • Two push buttons: RESET, USER BUTTON
  • Mini-B USB connector

Maple mini board pinout

Courtesy of Wim Huiskamp /media/uploads/hudakz/maple_f103c8_f103cb_mbed.jpg Zoom in

Warning

Only the labels printed in blue/white or green/white (i.e. PB_8, PC_13, D15, A0 ...) must be used in your code. The other labels are given as information (alternate-functions, power pins, ...). You can also use these additional pin names:

LED1=PB_1   SERIAL_TX=PA_2  I2C_SCL=PB_6  SPI_MOSI=PA_7  PWM_OUT=PB_3
            SERIAL_RX=PA_3  I2C_SDA=PB_7  SPI_MISO=PA_6
                                          SPI_SCK =PA_5
                                          SPI_CS  =PB_6



Using mbed on-line compiler to build programs for the Maple mini

  • Create a program as if it was for a NUCLEO-F103RB board (select NUCLEO-F103RB as target platform in the on-line compiler).
  • Add #include "MapleMini.h" to main.cpp before #include "mbed.h" (position matters!) and call confSysClock function at the begin of main function.

Blinking on-board LED:

#include "MapleMini.h"
#include "mbed.h"
 
Serial      pc(PA_2, PA_3);
DigitalOut  myled(LED1);
 
int main() {
    confSysClock();     // Configure system clock (72MHz HSE clock, 36MHz APB1 peripheral clock)
    while(1) {
        myled = 1;      // turn the LED on
        wait(0.2);      // 200 ms
        myled = 0;      // turn the LED off
        wait(1.0);      // 1 sec
        pc.printf("Blink\r\n");
    }
}



Programming the Maple mini board

You can use the NUCLEO virtual disk to program the Maple Mini (drag and drop programming). To do that, an additional NUCLEO board is needed (any type equipped with ST-LINK/V2-1 will do).

  • Remove the two jumpers from the CN2 connector as illustrated in Figure 8: /media/uploads/hudakz/nucleo_prog.png

  • Connect the NUCLEO board's CN4 debug connector to the Maple Mini board:

    /media/uploads/hudakz/st-link_cn4.png

  • Pins connected:
NUCLEO board
CN4 connector
Maple mini board
GND<=>GND
SWCLK<=>SWCLK (PA_14)
SWDIO<=>SWDIO (PA_13)
NRST<=>RESET
  • Provide power for the Maple Mini board.

  • Connect the NUCLEO board via USB cable to your PC.

  • To program the Maple Mini board, click on the Compile button and save the binary to the NUCLEO virtual disk .

    For more details have a look at the User Manual, chapter 6.2.4 Using ST-LINK/V2-1 to program and debug an external STM32 application.

Using serial port (for debugging)

  • Connect an FTDI or similar USB-Serial converter to your PC and to an on-board serial port (for example PA_2, PA_3). Make sure you connect the on-board TX pin to the converter's RX pin and the on-board RX pin to the converter's TX pin.
  • In your code, create a Serial object (using TX and RX pin names of the connected serial port).
  • Use printf function to send serial messages to the connected PC.

Sending debug messages over the ST-Link virtual com port

In case you would like to spare the external USB-Serial converter for other purposes then there is available an alternative solution proposed by X M (bitman). You can use the ST-Link virtual com port also for debugging of programs running on the Maple Mini board. However, that will require a soldering iron (and probably some soldering skills). According to the User Manual, chapter 6.8 "USART communication", soldering bridges (on the back side of the NUCLEO board) SB62 and SB63 should be ON, SB13 and SB14 should be OFF. In such case it is possible to connect another USART to the NUCLEO (ST-Link) CN3 connector using flying wires. For instance on STM32F103C8T6 board it is possible to use USART2 available on PA_2 (TX) and PA_3 (RX). Two flying wires shall be connected as follows:

Maple Mini board, pin PA_2 (Serial2 TX)<=>NUCLEO board CN3 connector, pin RX
Maple Mini board, pin PA_3 (Serial2 RX)<=>NUCLEO board CN3 connector, pin TX

Information

If you build a USB serial device with the Maple mini board (see Building a USB serial device with STM32F103C8T6 board) then note that for the USB device to work you have to use a 1k5 pull-up resistor on the USBDP pin (PA_12). The host PC wont recognise the USB device without the pullup and the USB device library code will hang. The pull-up resitor is already installed (along with a switching transistor) on the board and can be enabled using a DigitalOut at pin PB_9. Also note that the USB clock must be set to 48MHz.



Off-line compilation and debugging with CooCox CoIDE

  • Export your program from the mbed on-line compiler to CooCox CoIDE.

/media/uploads/hudakz/export.png

  • Save the file into a folder on you PC's hard drive and unzip.

  • Run CoIDE and open the project.

  • To setup the debugger, open the Debugger tab and use the following settings:
    /media/uploads/hudakz/debugger_settings.png

Happy coding and debugging.


All wikipages