Nuvoton
/
NuMaker-mbed-NuBrick-example
NuMaker Brick I2C slave devices
README.md@3:1b7324dff4b7, 2016-12-13 (annotated)
- Committer:
- shliu1
- Date:
- Tue Dec 13 10:22:12 2016 +0800
- Revision:
- 3:1b7324dff4b7
- Parent:
- 1:2fcc21a82c3b
- Child:
- 4:3a606a90c432
Modify README.md and sync mbed-os library to mbed-os 5.2.3
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ccli8 |
1:2fcc21a82c3b | 1 | # Getting started with NuMaker Brick platform on mbed |
ccli8 |
1:2fcc21a82c3b | 2 | |
ccli8 |
1:2fcc21a82c3b | 3 | This is an example to communicate with NuMaker Brick slave modules with [NuMaker mbed NuBrick](https://github.com/opennuvoton/NuMaker-mbed-NuBrick) library. |
ccli8 |
1:2fcc21a82c3b | 4 | |
ccli8 |
1:2fcc21a82c3b | 5 | ## What it does? |
ccli8 | 0:605bda4be3d8 | 6 | |
ccli8 |
1:2fcc21a82c3b | 7 | This example enumerates supported NuMaker Brick slave modules connected on the I2C bus. |
ccli8 |
1:2fcc21a82c3b | 8 | - Buzzer |
ccli8 |
1:2fcc21a82c3b | 9 | - LED |
ccli8 |
1:2fcc21a82c3b | 10 | - AHRS |
ccli8 |
1:2fcc21a82c3b | 11 | - Sonar |
ccli8 |
1:2fcc21a82c3b | 12 | - Temperature & Humidity |
ccli8 |
1:2fcc21a82c3b | 13 | - Gas |
ccli8 |
1:2fcc21a82c3b | 14 | - IR |
ccli8 |
1:2fcc21a82c3b | 15 | - Keys |
ccli8 |
1:2fcc21a82c3b | 16 | |
ccli8 |
1:2fcc21a82c3b | 17 | ## Required hardware |
ccli8 |
1:2fcc21a82c3b | 18 | |
ccli8 |
1:2fcc21a82c3b | 19 | - mbed enabled boards ([NuMaker-PFM-NUC472](https://developer.mbed.org/platforms/Nuvoton-NUC472/) or [NuMaker-PFM-M453]()) |
ccli8 |
1:2fcc21a82c3b | 20 | - 1 mini-USB cable |
ccli8 |
1:2fcc21a82c3b | 21 | - [NuMaker Brick slave modules](http://www.nuvoton.com/hq/support/tool-and-software/development-tool-hardware/numaker-brick/?__locale=en) |
ccli8 |
1:2fcc21a82c3b | 22 | - 1 I2C cable or I2C adaptor board |
ccli8 |
1:2fcc21a82c3b | 23 | |
ccli8 |
1:2fcc21a82c3b | 24 | ## Known issues |
ccli8 |
1:2fcc21a82c3b | 25 | - A NuMaker Brick slave module uses divider resistance to identify its own ID. If supplied voltage diverges from 5V too far away, detected ID would be incorrect. |
shliu1 |
3:1b7324dff4b7 | 26 | The issue gets worse if multiple modules are stacked together. |
shliu1 |
3:1b7324dff4b7 | 27 | |
shliu1 |
3:1b7324dff4b7 | 28 | ## Get the example application! |
shliu1 |
3:1b7324dff4b7 | 29 | |
shliu1 |
3:1b7324dff4b7 | 30 | Ontain the mbed-OS library from Windows command prompt |
shliu1 |
3:1b7324dff4b7 | 31 | |
shliu1 |
3:1b7324dff4b7 | 32 | git clone https://github.com/ARMmbed/mbed-os |
shliu1 |
3:1b7324dff4b7 | 33 | |
shliu1 |
3:1b7324dff4b7 | 34 | |
shliu1 |
3:1b7324dff4b7 | 35 | From the command line of Git Bash, for example: |
shliu1 |
3:1b7324dff4b7 | 36 | |
shliu1 |
3:1b7324dff4b7 | 37 | ``` |
shliu1 |
3:1b7324dff4b7 | 38 | hg clone https://developer.mbed.org/teams/Nuvoton/code/NuMaker-mbed-NuBrick-example/ |
shliu1 |
3:1b7324dff4b7 | 39 | cd NuMaker-mbed-GPIO-button-buzzer-rgbled |
shliu1 |
3:1b7324dff4b7 | 40 | |
shliu1 |
3:1b7324dff4b7 | 41 | ``` |
shliu1 |
3:1b7324dff4b7 | 42 | |
shliu1 |
3:1b7324dff4b7 | 43 | Make shortcut for mbed-os library within the folder NuMaker-mbed-NuBrick-example |
shliu1 |
3:1b7324dff4b7 | 44 | |
shliu1 |
3:1b7324dff4b7 | 45 | ### Now compile |
shliu1 |
3:1b7324dff4b7 | 46 | |
shliu1 |
3:1b7324dff4b7 | 47 | Invoke `mbed compile` specifying the name of your platform and your favorite toolchain (`GCC_ARM`, `ARM`, `IAR`). For example, for the ARM Compiler 5: |
shliu1 |
3:1b7324dff4b7 | 48 | |
shliu1 |
3:1b7324dff4b7 | 49 | ``` |
shliu1 |
3:1b7324dff4b7 | 50 | mbed compile -m NUMAKER_PFM_NUC472 -t ARM |
shliu1 |
3:1b7324dff4b7 | 51 | ``` |
shliu1 |
3:1b7324dff4b7 | 52 | |
shliu1 |
3:1b7324dff4b7 | 53 | Your PC may take a few minutes to compile your code. At the end you should get the following result: |
shliu1 |
3:1b7324dff4b7 | 54 | |
shliu1 |
3:1b7324dff4b7 | 55 | ``` |
shliu1 |
3:1b7324dff4b7 | 56 | +------------------------+-------+-------+---------+ |
shliu1 |
3:1b7324dff4b7 | 57 | | Module | .text | .data | .bss | |
shliu1 |
3:1b7324dff4b7 | 58 | +------------------------+-------+-------+---------+ |
shliu1 |
3:1b7324dff4b7 | 59 | | Misc | 25085 | 132 | 1053500 | |
shliu1 |
3:1b7324dff4b7 | 60 | | drivers | 1086 | 8 | 56 | |
shliu1 |
3:1b7324dff4b7 | 61 | | features/FEATURE_LWIP | 162 | 16 | 16 | |
shliu1 |
3:1b7324dff4b7 | 62 | | hal | 358 | 8 | 0 | |
shliu1 |
3:1b7324dff4b7 | 63 | | platform | 1631 | 16 | 92 | |
shliu1 |
3:1b7324dff4b7 | 64 | | rtos | 130 | 8 | 0 | |
shliu1 |
3:1b7324dff4b7 | 65 | | rtos/rtx | 6702 | 100 | 8396 | |
shliu1 |
3:1b7324dff4b7 | 66 | | targets/TARGET_NUVOTON | 10164 | 308 | 104 | |
shliu1 |
3:1b7324dff4b7 | 67 | | Subtotals | 45318 | 596 | 1062164 | |
shliu1 |
3:1b7324dff4b7 | 68 | +------------------------+-------+-------+---------+ |
shliu1 |
3:1b7324dff4b7 | 69 | Allocated Heap: unknown |
shliu1 |
3:1b7324dff4b7 | 70 | Allocated Stack: unknown |
shliu1 |
3:1b7324dff4b7 | 71 | Total Static RAM memory (data + bss): 1062760 bytes |
shliu1 |
3:1b7324dff4b7 | 72 | Total RAM memory (data + bss + heap + stack): 1062760 bytes |
shliu1 |
3:1b7324dff4b7 | 73 | Total Flash memory (text + data + misc): 45914 bytes |
shliu1 |
3:1b7324dff4b7 | 74 | ``` |
shliu1 |
3:1b7324dff4b7 | 75 | |
shliu1 |
3:1b7324dff4b7 | 76 | ### Program your board |
shliu1 |
3:1b7324dff4b7 | 77 | |
shliu1 |
3:1b7324dff4b7 | 78 | 1. Connect your mbed device to the computer over USB. |
shliu1 |
3:1b7324dff4b7 | 79 | 1. Copy the binary file to the mbed device . |
shliu1 |
3:1b7324dff4b7 | 80 | 1. Press the reset button to start the program. |
shliu1 |
3:1b7324dff4b7 | 81 | |
shliu1 |
3:1b7324dff4b7 | 82 | Please refer to the documents at the path https://github.com/OpenNuvoton/NuMaker_NuWicam_Samples/ |
shliu1 |
3:1b7324dff4b7 | 83 | |
shliu1 |
3:1b7324dff4b7 | 84 | ## Export the project to Keil MDK and debug your application |
shliu1 |
3:1b7324dff4b7 | 85 | |
shliu1 |
3:1b7324dff4b7 | 86 | From the command line, run the following command: |
shliu1 |
3:1b7324dff4b7 | 87 | |
shliu1 |
3:1b7324dff4b7 | 88 | ``` |
shliu1 |
3:1b7324dff4b7 | 89 | mbed export -m NUMAKER_PFM_NUC472 -i uvision |
shliu1 |
3:1b7324dff4b7 | 90 | ``` |
shliu1 |
3:1b7324dff4b7 | 91 | |
shliu1 |
3:1b7324dff4b7 | 92 | To debug the application: |
shliu1 |
3:1b7324dff4b7 | 93 | |
shliu1 |
3:1b7324dff4b7 | 94 | 1. Start uVision. |
shliu1 |
3:1b7324dff4b7 | 95 | 1. Import the uVision project generated earlier. |
shliu1 |
3:1b7324dff4b7 | 96 | 1. Compile your application and generate an `.axf` file. |
shliu1 |
3:1b7324dff4b7 | 97 | 1. Make sure uVision is configured to debug over CMSIS-DAP (From the Project menu > Options for Target '...' > Debug tab > Use CMSIS-DAP Debugger). |
shliu1 |
3:1b7324dff4b7 | 98 | 1. Set breakpoints and start a debug session. |
shliu1 |
3:1b7324dff4b7 | 99 | |
shliu1 |
3:1b7324dff4b7 | 100 | ![Image of uVision](img/uvision.png) |
shliu1 |
3:1b7324dff4b7 | 101 | |
shliu1 |
3:1b7324dff4b7 | 102 | ## Troubleshooting |
shliu1 |
3:1b7324dff4b7 | 103 | |
shliu1 |
3:1b7324dff4b7 | 104 | 1. Make sure `mbed-cli` is working correctly and its version is greater than `0.8.9` |
shliu1 |
3:1b7324dff4b7 | 105 | |
shliu1 |
3:1b7324dff4b7 | 106 | ``` |
shliu1 |
3:1b7324dff4b7 | 107 | mbed --version |
shliu1 |
3:1b7324dff4b7 | 108 | ``` |
shliu1 |
3:1b7324dff4b7 | 109 | |
shliu1 |
3:1b7324dff4b7 | 110 | If not, you can update it easily: |
shliu1 |
3:1b7324dff4b7 | 111 | |
shliu1 |
3:1b7324dff4b7 | 112 | ``` |
shliu1 |
3:1b7324dff4b7 | 113 | pip install mbed-cli --upgrade |
shliu1 |
3:1b7324dff4b7 | 114 | ``` |
shliu1 |
3:1b7324dff4b7 | 115 | |
shliu1 |
3:1b7324dff4b7 | 116 | 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. |
shliu1 |
3:1b7324dff4b7 | 117 | |
shliu1 |
3:1b7324dff4b7 | 118 |