|
1 | 1 | Title: Disco demo
|
2 | 2 |
|
3 |
| -Description: |
| 3 | +Description |
4 | 4 |
|
5 | 5 | A simple 'disco' demo. The demo assumes that 2 LEDs are connected to
|
6 |
| -GPIO outputs of the MCU/board. The sample code is configured to work |
7 |
| -on Nucleo-64 F103RB board, with LEDs connected to PB5 and PB8 |
8 |
| -pins. |
| 6 | +GPIO outputs of the MCU/board. |
9 | 7 |
|
10 |
| -After startup, the program looks up a predefined GPIO device (GPIOB), |
11 |
| -and configures pins 5 and 8 in output mode. During each iteration of |
12 |
| -the main loop, the state of GPIO lines will be changed so that one of |
13 |
| -the lines is in high state, while the other is in low, thus switching |
14 |
| -the LEDs on and off in an alternating pattern. |
| 8 | +After startup, the program looks up a predefined GPIO device defined |
| 9 | +by 'PORT', and configures pins 'LED1' and 'LED2' in output mode. |
| 10 | +During each iteration of the main loop, the state of GPIO lines will |
| 11 | +be changed so that one of the lines is in high state, while the other |
| 12 | +is in low, thus switching the LEDs on and off in an alternating |
| 13 | +pattern. |
| 14 | + |
| 15 | +This project does not output to the serial console, but instead |
| 16 | +causes two LEDs connected to the GPIO device to blink in an |
| 17 | +alternating pattern. |
15 | 18 |
|
16 | 19 | --------------------------------------------------------------------------------
|
17 | 20 |
|
18 |
| -Building and Running Project: |
| 21 | +Wiring |
19 | 22 |
|
20 |
| -This microkernel project does not output to the console, but instead |
21 |
| -causes two LEDs connected to the GPIO device to blink in an |
22 |
| -alternating pattern. It can be built for a nucleo_f103rb board as |
23 |
| -follows: |
| 23 | +Nucleo-64 F103RB/F401RE boards: |
| 24 | + |
| 25 | + Connect two LEDs to PB5 and PB8 pins. PB5 is mapped to the |
| 26 | + Arduino's D4 pin and PB8 to Arduino's D15. For more details about |
| 27 | + these boards see: |
| 28 | + |
| 29 | + https://developer.mbed.org/platforms/ST-Nucleo-F103RB/ |
| 30 | + https://developer.mbed.org/platforms/ST-Nucleo-F401RE/ |
| 31 | + |
| 32 | +Arduino 101 (x86): |
| 33 | + |
| 34 | + Connect two LEDs to D4 (IO4) and D7 (IO7) pins. The schematics |
| 35 | + for the Arduino 101 board is available at: |
| 36 | + |
| 37 | + https://www.arduino.cc/en/uploads/Main/Arduino101-REV4Schematic.pdf |
| 38 | + |
| 39 | + For Arduino 101's pinmux mapping in Zephyr, see: |
| 40 | + |
| 41 | + boards/x86/arduino_101/pinmux.c |
| 42 | + |
| 43 | + Modify the src/main.c file and set: |
| 44 | + |
| 45 | + #define PORT CONFIG_GPIO_QMSI_0_NAME |
| 46 | + /* GPIO_19 is Arduino's D4 */ |
| 47 | + #define LED1 19 |
| 48 | + /* GPIO_20 is Arduino's D7 */ |
| 49 | + #define LED2 20 |
| 50 | + |
| 51 | +-------------------------------------------------------------------------------- |
| 52 | + |
| 53 | +Building |
| 54 | + |
| 55 | +Nucleo F103RB: |
| 56 | + |
| 57 | + make pristine && make BOARD=nucleo_f103rb |
| 58 | + |
| 59 | +Nucleo F401RE: |
| 60 | + |
| 61 | + make pristine && make BOARD=nucleo_f401re |
| 62 | + |
| 63 | +Arduino 101: |
24 | 64 |
|
25 |
| - make |
| 65 | + make pristine && make BOARD=arduino_101 |
26 | 66 |
|
27 |
| -The code may need adaption before running the code on another board. |
| 67 | +The code may need some work before running on another board: set PORT, |
| 68 | +LED1 and LED2 according to the board's GPIO configuration. |
28 | 69 |
|
29 | 70 | --------------------------------------------------------------------------------
|
30 | 71 |
|
31 |
| -Troubleshooting: |
| 72 | +Troubleshooting |
32 | 73 |
|
33 | 74 | Problems caused by out-dated project information can be addressed by
|
34 | 75 | issuing one of the following commands then rebuilding the project:
|
|
0 commit comments