NuMaker PWM1 drive +5V DC servo motor

Committer:
rkuo2000
Date:
Fri Oct 14 06:53:58 2016 +0000
Revision:
0:68283046ceea
NuMaker-PFM-NUC472 : PWM1 output to drive +5V DC servo motor

Who changed what in which revision?

UserRevisionLine numberNew contents of line
rkuo2000 0:68283046ceea 1 # Getting started with Blinky on mbed OS
rkuo2000 0:68283046ceea 2
rkuo2000 0:68283046ceea 3 This is a very simple guide, reviewing the steps required to get Blinky working on an mbed OS platform.
rkuo2000 0:68283046ceea 4
rkuo2000 0:68283046ceea 5 Please install [mbed CLI](https://github.com/ARMmbed/mbed-cli#installing-mbed-cli).
rkuo2000 0:68283046ceea 6
rkuo2000 0:68283046ceea 7 ## Get the example application!
rkuo2000 0:68283046ceea 8
rkuo2000 0:68283046ceea 9 From the command line, import the example:
rkuo2000 0:68283046ceea 10
rkuo2000 0:68283046ceea 11 ```
rkuo2000 0:68283046ceea 12 mbed import mbed-os-example-blinky
rkuo2000 0:68283046ceea 13 cd mbed-os-example-blinky
rkuo2000 0:68283046ceea 14 ```
rkuo2000 0:68283046ceea 15
rkuo2000 0:68283046ceea 16 ### Now compile
rkuo2000 0:68283046ceea 17
rkuo2000 0:68283046ceea 18 Invoke `mbed compile` specifying the name of your platform and your favorite toolchain (`GCC_ARM`, `ARM`, `IAR`). For example, for the ARM Compiler 5:
rkuo2000 0:68283046ceea 19
rkuo2000 0:68283046ceea 20 ```
rkuo2000 0:68283046ceea 21 mbed compile -m K64F -t ARM
rkuo2000 0:68283046ceea 22 ```
rkuo2000 0:68283046ceea 23
rkuo2000 0:68283046ceea 24 Your PC may take a few minutes to compile your code. At the end you should get the following result:
rkuo2000 0:68283046ceea 25
rkuo2000 0:68283046ceea 26 ```
rkuo2000 0:68283046ceea 27 [snip]
rkuo2000 0:68283046ceea 28 +----------------------------+-------+-------+------+
rkuo2000 0:68283046ceea 29 | Module | .text | .data | .bss |
rkuo2000 0:68283046ceea 30 +----------------------------+-------+-------+------+
rkuo2000 0:68283046ceea 31 | Misc | 13939 | 24 | 1372 |
rkuo2000 0:68283046ceea 32 | core/hal | 16993 | 96 | 296 |
rkuo2000 0:68283046ceea 33 | core/rtos | 7384 | 92 | 4204 |
rkuo2000 0:68283046ceea 34 | features/FEATURE_IPV4 | 80 | 0 | 176 |
rkuo2000 0:68283046ceea 35 | frameworks/greentea-client | 1830 | 60 | 44 |
rkuo2000 0:68283046ceea 36 | frameworks/utest | 2392 | 512 | 292 |
rkuo2000 0:68283046ceea 37 | Subtotals | 42618 | 784 | 6384 |
rkuo2000 0:68283046ceea 38 +----------------------------+-------+-------+------+
rkuo2000 0:68283046ceea 39 Allocated Heap: unknown
rkuo2000 0:68283046ceea 40 Allocated Stack: unknown
rkuo2000 0:68283046ceea 41 Total Static RAM memory (data + bss): 7168 bytes
rkuo2000 0:68283046ceea 42 Total RAM memory (data + bss + heap + stack): 7168 bytes
rkuo2000 0:68283046ceea 43 Total Flash memory (text + data + misc): 43402 bytes
rkuo2000 0:68283046ceea 44 Image: .\.build\K64F\ARM\mbed-os-example-blinky.bin
rkuo2000 0:68283046ceea 45 ```
rkuo2000 0:68283046ceea 46
rkuo2000 0:68283046ceea 47 ### Program your board
rkuo2000 0:68283046ceea 48
rkuo2000 0:68283046ceea 49 1. Connect your mbed device to the computer over USB.
rkuo2000 0:68283046ceea 50 1. Copy the binary file to the mbed device .
rkuo2000 0:68283046ceea 51 1. Press the reset button to start the program.
rkuo2000 0:68283046ceea 52
rkuo2000 0:68283046ceea 53 You should see the LED of your platform turning on and off.
rkuo2000 0:68283046ceea 54
rkuo2000 0:68283046ceea 55 Congratulations if you managed to complete this test!
rkuo2000 0:68283046ceea 56
rkuo2000 0:68283046ceea 57 ## Export the project to Keil MDK and debug your application
rkuo2000 0:68283046ceea 58
rkuo2000 0:68283046ceea 59 From the command line, run the following command:
rkuo2000 0:68283046ceea 60
rkuo2000 0:68283046ceea 61 ```
rkuo2000 0:68283046ceea 62 mbed export -m K64F -i uvision
rkuo2000 0:68283046ceea 63 ```
rkuo2000 0:68283046ceea 64
rkuo2000 0:68283046ceea 65 You should see the following output:
rkuo2000 0:68283046ceea 66
rkuo2000 0:68283046ceea 67 ```
rkuo2000 0:68283046ceea 68 Successful exports:
rkuo2000 0:68283046ceea 69 * K64F::uvision .\projectfiles\uvision_K64F\Unnamed_Project
rkuo2000 0:68283046ceea 70 ```
rkuo2000 0:68283046ceea 71
rkuo2000 0:68283046ceea 72 To debug the application:
rkuo2000 0:68283046ceea 73
rkuo2000 0:68283046ceea 74 1. Start uVision.
rkuo2000 0:68283046ceea 75 1. Import the uVision project generated earlier.
rkuo2000 0:68283046ceea 76 1. Compile your application and generate an `.axf` file.
rkuo2000 0:68283046ceea 77 1. Make sure uVision is configured to debug over CMSIS-DAP (From the Project menu > Options for Target '...' > Debug tab > Use CMSIS-DAP Debugger).
rkuo2000 0:68283046ceea 78 1. Set breakpoints and start a debug session.
rkuo2000 0:68283046ceea 79
rkuo2000 0:68283046ceea 80 ![Image of uVision](img/uvision.png)
rkuo2000 0:68283046ceea 81
rkuo2000 0:68283046ceea 82 ## Troubleshooting
rkuo2000 0:68283046ceea 83
rkuo2000 0:68283046ceea 84 1. Make sure `mbed-cli` is working correctly and its version is greater than `0.8.9`
rkuo2000 0:68283046ceea 85
rkuo2000 0:68283046ceea 86 ```
rkuo2000 0:68283046ceea 87 mbed --version
rkuo2000 0:68283046ceea 88 ```
rkuo2000 0:68283046ceea 89
rkuo2000 0:68283046ceea 90 If not, you can update it easily:
rkuo2000 0:68283046ceea 91
rkuo2000 0:68283046ceea 92 ```
rkuo2000 0:68283046ceea 93 pip install mbed-cli --upgrade
rkuo2000 0:68283046ceea 94 ```
rkuo2000 0:68283046ceea 95
rkuo2000 0:68283046ceea 96 2. If using Keil MDK, make sure you have a license installed. [MDK-Lite](http://www.keil.com/arm/mdk.asp) has a 32KB restriction on code size.