2017-04-15 13:58:39 +02:00
This firmware template is designed for development boards based around [STM32 F1 series micro-controller ](http://www.st.com/web/en/catalog/mmc/FM141/SC1169/SS1031 ).
2016-08-14 18:36:27 +02:00
project
=======
summary
-------
2016-08-14 20:25:55 +02:00
*describe project purpose*
2016-08-14 18:36:27 +02:00
technology
----------
2016-08-14 20:25:55 +02:00
*described electronic details*
2016-01-29 12:12:04 +01:00
board
=====
2017-04-03 13:12:18 +02:00
The current implementation uses a [core board ](https://wiki.cuvoodoo.info/doku.php?id=stm32f1xx#core_board ).
2016-01-29 12:12:04 +01:00
2016-08-14 18:36:27 +02:00
The underlying template also supports following board:
2016-01-29 12:12:04 +01:00
2016-08-14 18:36:27 +02:00
- [Maple Mini ](http://leaflabs.com/docs/hardware/maple-mini.html ), based on a STM32F103CBT6
- [System Board ](https://wiki.cuvoodoo.info/doku.php?id=stm32f1xx#system_board ), based on a STM32F103C8T6
- [blue pill ](ihttps://wiki.cuvoodoo.info/doku.php?id=stm32f1xx#blue_pill ), based on a STM32F103C8T6
2017-04-03 13:12:18 +02:00
- [core board ](https://wiki.cuvoodoo.info/doku.php?id=stm32f1xx#core_board ), based on a STM32F103C8T6
2016-01-29 12:12:04 +01:00
2016-08-14 18:36:27 +02:00
**Which board is used is defined in the Makefile**.
2017-04-15 13:58:39 +02:00
This is required to map the user LED and button provided on the board
2016-01-29 12:12:04 +01:00
2016-08-14 18:36:27 +02:00
connections
===========
2016-01-29 12:12:04 +01:00
2016-08-14 18:36:27 +02:00
Connect the peripherals the following way (STM32F10X signal; STM32F10X pin; peripheral pin; peripheral signal; comment):
2016-01-29 12:12:04 +01:00
2016-08-14 20:25:55 +02:00
- *list board to preipheral pin connections*
2016-02-18 10:39:08 +01:00
2016-08-14 18:36:27 +02:00
All pins are configured using `define` s in the corresponding source code.
2016-01-29 12:12:04 +01:00
2016-08-14 18:36:27 +02:00
code
====
2016-01-29 12:12:04 +01:00
2016-08-14 18:36:27 +02:00
dependencies
------------
2016-01-29 12:12:04 +01:00
2016-08-14 18:36:27 +02:00
The source code uses the [libopencm3 ](http://libopencm3.org/ ) library.
The projects is already a git submodules.
2017-08-07 23:13:30 +02:00
It will be initialized when compiling the firmware.
Alternatively you can run once: `git submodule init` and `git submodule update` .
2016-01-29 12:12:04 +01:00
firmware
2016-08-14 18:36:27 +02:00
--------
2016-01-29 12:12:04 +01:00
2017-08-07 23:13:30 +02:00
To compile the firmware run `rake` .
2016-01-29 12:12:04 +01:00
2016-08-14 18:36:27 +02:00
documentation
-------------
2016-02-18 10:39:08 +01:00
2017-08-07 23:13:30 +02:00
To generate doxygen documentation run `rake doc` .
2016-01-29 12:12:04 +01:00
2016-08-14 18:36:27 +02:00
flash
-----
2017-04-15 13:58:39 +02:00
There are two firmware images: `bootloader` and `application` .
The `bootloader` image allows to flash the `application` over USB using the DFU protocol.
The `bootloader` is started first and immediately jumps to the `application` if it is valid and the DFU mode is not forced (i.e. by pressing the user button on the board or requesting a DFU detach in the `application` ).
2017-08-07 23:13:30 +02:00
The `application` image is the main application and is implemented in `application.c` .
2017-04-15 13:58:39 +02:00
It is up to the application to advertise USB DFU support (i.e. as does the provided USB CDC ACM example).
2017-08-07 23:13:30 +02:00
The `bootlaoder` image will be flashed using SWD (Serial Wire Debug).
2016-08-14 18:36:27 +02:00
For that you need an SWD adapter.
2017-04-03 13:12:18 +02:00
The `Makefile` uses a Black Magic Probe (per default), or a ST-Link V2 along OpenOCD software.
2017-08-07 23:13:30 +02:00
To flash the `booltoader` using SWD run `rake flash_booloader` .
2017-04-15 13:58:39 +02:00
2017-08-07 23:13:30 +02:00
Once the `bootloader` is flashed it is possible to flash the `application` over USB using the DFU protocol by running `rake flash` .
2017-04-15 13:58:39 +02:00
To force the bootloader to start the DFU mode press the user button or short a pin, depending on the board.
2017-08-07 23:13:30 +02:00
It is also possible to flash the `application` image using SWD by running `rake flash_application` .
2016-01-29 12:12:04 +01:00
2016-08-14 18:36:27 +02:00
debug
2016-01-29 12:12:04 +01:00
-----
2016-08-14 18:36:27 +02:00
SWD also allows to debug the code running on the micro-controller using GDB.
2017-08-07 23:13:30 +02:00
To start the debugging session run `rake debug` .
2016-01-29 12:12:04 +01:00
USB
---
2016-08-14 18:36:27 +02:00
The firmware offers serial communication over USART1 and USB (using the CDC ACM device class).
2016-01-29 12:12:04 +01:00
2016-08-14 18:36:27 +02:00
You can also reset the board by setting the serial width to 5 bits over USB.
2017-08-07 23:13:30 +02:00
To reset the board run `rake reset` .
2017-04-15 13:58:39 +02:00
This only works if provided USB CDC ACM is running correctly and the micro-controller isn't stuck.