Nuvoton
/
NuMaker-mbed-ADC0_MQ3
NuMaker ADC read gas sensor (MQ3)
README.md@3:2921ef74950b, 2016-12-12 (annotated)
- Committer:
- shliu1
- Date:
- Mon Dec 12 19:39:11 2016 +0800
- Revision:
- 3:2921ef74950b
- Child:
- 4:50241a871e1d
Add 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 |
---|---|---|---|
shliu1 |
3:2921ef74950b | 1 | |
shliu1 |
3:2921ef74950b | 2 | # Getting started with NuMaker-mbed-ADC0_MQ3 on mbed OS |
shliu1 |
3:2921ef74950b | 3 | |
shliu1 |
3:2921ef74950b | 4 | The code works on an mbed OS platform. It uses ADC0 to read sensor |
shliu1 |
3:2921ef74950b | 5 | |
shliu1 |
3:2921ef74950b | 6 | Please install [mbed CLI](https://github.com/ARMmbed/mbed-cli#installing-mbed-cli). |
shliu1 |
3:2921ef74950b | 7 | |
shliu1 |
3:2921ef74950b | 8 | ## Get the example application! |
shliu1 |
3:2921ef74950b | 9 | |
shliu1 |
3:2921ef74950b | 10 | Ontain the mbed-OS library from Windows command prompt |
shliu1 |
3:2921ef74950b | 11 | |
shliu1 |
3:2921ef74950b | 12 | git clone https://github.com/ARMmbed/mbed-os |
shliu1 |
3:2921ef74950b | 13 | |
shliu1 |
3:2921ef74950b | 14 | |
shliu1 |
3:2921ef74950b | 15 | From the command line of Git Bash, for example: |
shliu1 |
3:2921ef74950b | 16 | |
shliu1 |
3:2921ef74950b | 17 | ``` |
shliu1 |
3:2921ef74950b | 18 | hg clone https://developer.mbed.org/teams/Nuvoton/code/NuMaker-mbed-ADC0_MQ3/ |
shliu1 |
3:2921ef74950b | 19 | cd NuMaker-mbed-ADC0_MQ3 |
shliu1 |
3:2921ef74950b | 20 | |
shliu1 |
3:2921ef74950b | 21 | ``` |
shliu1 |
3:2921ef74950b | 22 | |
shliu1 |
3:2921ef74950b | 23 | Make shortcut for mbed-os library under the folder NuMaker-mbed-ADC0_MQ3 |
shliu1 |
3:2921ef74950b | 24 | |
shliu1 |
3:2921ef74950b | 25 | ### Now compile |
shliu1 |
3:2921ef74950b | 26 | |
shliu1 |
3:2921ef74950b | 27 | 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:2921ef74950b | 28 | |
shliu1 |
3:2921ef74950b | 29 | ``` |
shliu1 |
3:2921ef74950b | 30 | mbed compile -m NUMAKER_PFM_NUC472 -t ARM |
shliu1 |
3:2921ef74950b | 31 | ``` |
shliu1 |
3:2921ef74950b | 32 | |
shliu1 |
3:2921ef74950b | 33 | Your PC may take a few minutes to compile your code. At the end you should get the following result: |
shliu1 |
3:2921ef74950b | 34 | |
shliu1 |
3:2921ef74950b | 35 | ``` |
shliu1 |
3:2921ef74950b | 36 | Link: NuMaker-mbed-ADC0_MQ3 |
shliu1 |
3:2921ef74950b | 37 | Elf2Bin: NuMaker-mbed-ADC0_MQ3 |
shliu1 |
3:2921ef74950b | 38 | +--------------+-------+-------+---------+ |
shliu1 |
3:2921ef74950b | 39 | | Module | .text | .data | .bss | |
shliu1 |
3:2921ef74950b | 40 | +--------------+-------+-------+---------+ |
shliu1 |
3:2921ef74950b | 41 | | Misc | 13333 | 32 | 1061844 | |
shliu1 |
3:2921ef74950b | 42 | | features/net | 162 | 16 | 16 | |
shliu1 |
3:2921ef74950b | 43 | | hal/common | 2531 | 28 | 148 | |
shliu1 |
3:2921ef74950b | 44 | | hal/targets | 6713 | 272 | 104 | |
shliu1 |
3:2921ef74950b | 45 | | rtos/rtos | 110 | 4 | 0 | |
shliu1 |
3:2921ef74950b | 46 | | rtos/rtx | 6484 | 92 | 8316 | |
shliu1 |
3:2921ef74950b | 47 | | Subtotals | 29333 | 444 | 1070428 | |
shliu1 |
3:2921ef74950b | 48 | +--------------+-------+-------+---------+ |
shliu1 |
3:2921ef74950b | 49 | Allocated Heap: unknown |
shliu1 |
3:2921ef74950b | 50 | Allocated Stack: unknown |
shliu1 |
3:2921ef74950b | 51 | Total Static RAM memory (data + bss): 1070872 bytes |
shliu1 |
3:2921ef74950b | 52 | Total RAM memory (data + bss + heap + stack): 1070872 bytes |
shliu1 |
3:2921ef74950b | 53 | Total Flash memory (text + data + misc): 29777 bytes |
shliu1 |
3:2921ef74950b | 54 | Image: .\BUILD\NUMAKER_PFM_NUC472\ARM\NuMaker-mbed-ADC0_MQ3.bin |
shliu1 |
3:2921ef74950b | 55 | |
shliu1 |
3:2921ef74950b | 56 | ``` |
shliu1 |
3:2921ef74950b | 57 | |
shliu1 |
3:2921ef74950b | 58 | ### Program your board |
shliu1 |
3:2921ef74950b | 59 | |
shliu1 |
3:2921ef74950b | 60 | 1. Connect your mbed device to the computer over USB. |
shliu1 |
3:2921ef74950b | 61 | 1. Copy the binary file to the mbed device . |
shliu1 |
3:2921ef74950b | 62 | 1. Press the reset button to start the program. |
shliu1 |
3:2921ef74950b | 63 | |
shliu1 |
3:2921ef74950b | 64 | Please refer to the documents at the path https://github.com/OpenNuvoton/NuMaker_NuWicam_Samples/ |
shliu1 |
3:2921ef74950b | 65 | |
shliu1 |
3:2921ef74950b | 66 | ## Export the project to Keil MDK and debug your application |
shliu1 |
3:2921ef74950b | 67 | |
shliu1 |
3:2921ef74950b | 68 | From the command line, run the following command: |
shliu1 |
3:2921ef74950b | 69 | |
shliu1 |
3:2921ef74950b | 70 | ``` |
shliu1 |
3:2921ef74950b | 71 | mbed export -m NUMAKER_PFM_NUC472 -i uvision |
shliu1 |
3:2921ef74950b | 72 | ``` |
shliu1 |
3:2921ef74950b | 73 | |
shliu1 |
3:2921ef74950b | 74 | To debug the application: |
shliu1 |
3:2921ef74950b | 75 | |
shliu1 |
3:2921ef74950b | 76 | 1. Start uVision. |
shliu1 |
3:2921ef74950b | 77 | 1. Import the uVision project generated earlier. |
shliu1 |
3:2921ef74950b | 78 | 1. Compile your application and generate an `.axf` file. |
shliu1 |
3:2921ef74950b | 79 | 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:2921ef74950b | 80 | 1. Set breakpoints and start a debug session. |
shliu1 |
3:2921ef74950b | 81 | |
shliu1 |
3:2921ef74950b | 82 | ![Image of uVision](img/uvision.png) |
shliu1 |
3:2921ef74950b | 83 | |
shliu1 |
3:2921ef74950b | 84 | ## Troubleshooting |
shliu1 |
3:2921ef74950b | 85 | |
shliu1 |
3:2921ef74950b | 86 | 1. Make sure `mbed-cli` is working correctly and its version is greater than `0.8.9` |
shliu1 |
3:2921ef74950b | 87 | |
shliu1 |
3:2921ef74950b | 88 | ``` |
shliu1 |
3:2921ef74950b | 89 | mbed --version |
shliu1 |
3:2921ef74950b | 90 | ``` |
shliu1 |
3:2921ef74950b | 91 | |
shliu1 |
3:2921ef74950b | 92 | If not, you can update it easily: |
shliu1 |
3:2921ef74950b | 93 | |
shliu1 |
3:2921ef74950b | 94 | ``` |
shliu1 |
3:2921ef74950b | 95 | pip install mbed-cli --upgrade |
shliu1 |
3:2921ef74950b | 96 | ``` |
shliu1 |
3:2921ef74950b | 97 | |
shliu1 |
3:2921ef74950b | 98 | 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:2921ef74950b | 99 | |
shliu1 |
3:2921ef74950b | 100 |