|
| 1 | +ZJS Board Support for Arduino 101 |
| 2 | +================================= |
| 3 | + |
| 4 | +* [Introduction](#introduction) |
| 5 | +* [Available Pins](#available-pins) |
| 6 | +* [Sample Apps](#sample-apps) |
| 7 | + |
| 8 | +Introduction |
| 9 | +------------ |
| 10 | +The Arduino 101 is pretty much fully supported by ZJS. Two exceptions are that |
| 11 | +certain GPIOs that are accessible only from the ARC core are not available, and |
| 12 | +there are analog comparator pins that are not supported. |
| 13 | + |
| 14 | +For multi-board support, you can use the [board module](../board.md) to detect |
| 15 | +whether you're running on the Arduino 101 with `board.name === 'arduino_101'`. |
| 16 | + |
| 17 | +Available Pins |
| 18 | +-------------- |
| 19 | +### GPIO |
| 20 | +The Arduino 101 has 14 general purpose I/O pins exposed, IO0 - IO13. |
| 21 | + |
| 22 | +IO0 and IO1 are used for serial communication and we haven't yet looked into |
| 23 | +disabling that to provide them as extra GPIO pins, so these are not available. |
| 24 | + |
| 25 | +IO6 and IO9 are defined but not actually usable as GPIOs currently. They can |
| 26 | +only be accessed from the ARC side which we do not support. |
| 27 | + |
| 28 | +IO3 and IO5 can be used as GPIO inputs but not outputs currently. |
| 29 | + |
| 30 | +The rest (IO2, IO4, IO7, IO8, and IO10 - IO13) can all be used as either GPIO |
| 31 | +inputs or outputs. *FIXME: However, at the time of this writing IO8, IO10, and |
| 32 | +IO11 do not seem to be working; they used to.* |
| 33 | + |
| 34 | +There are different ways to refer to a pin like IO3. The easiest way is the |
| 35 | +string 'IO3', but you can also use the string '3' or number 3, and finally you |
| 36 | +can use the full pin specification 'GPIO_0.17', but this requires you to look |
| 37 | +up the mapping between logical pins and GPIO numbers. The only way we know to do |
| 38 | +this is consulting Zephyr's `boards/x86/arduino_101/pinmux.c` file. The Arduino |
| 39 | +101 only has one GPIO controller so the device is always 'GPIO_0' for full pin |
| 40 | +specifications like this. But if you use the friendly forms, you don't need to |
| 41 | +worry about that. |
| 42 | + |
| 43 | +Note, SPI bus support uses IO10 - IO13 so when that is enabled, those pins are |
| 44 | +not available. The flash filesystem uses SPI, so these GPIOs are not available |
| 45 | +when you use ashell or filesystem APIs. |
| 46 | + |
| 47 | +### LEDs |
| 48 | +The Arduino 101 has three onboard LEDs that you can access as additional GPIO |
| 49 | +outputs. |
| 50 | + |
| 51 | +LED0 controls an onboard red fault LED. It is active *low*. |
| 52 | + |
| 53 | +LED1 controls an onboard green LED. It is active *low*. |
| 54 | + |
| 55 | +LED2 controls another onboard green LED. It is active high, and it is an alias |
| 56 | +for IO13, so in other words, LED0 displays the current state of IO13. So don't |
| 57 | +try to use both names. |
| 58 | + |
| 59 | +Note, if SPI is enabled this reconfigures the GPIO that controls LED2 and it |
| 60 | +will not be available. The flash filesystem uses SPI, so LED2 is not available |
| 61 | +when you use ashell or filesystem APIs. |
| 62 | + |
| 63 | +You can refer to the pins for these LEDs with the strings 'LED0', 'LED1', and |
| 64 | +'LED2'. |
| 65 | + |
| 66 | +### AIO |
| 67 | +The Arduino 101 has six analog input pins, A0 - A5. |
| 68 | + |
| 69 | +You can refer to these pins with strings 'A0' to 'A5', 'AD0' to 'AD5', numbers |
| 70 | +0 to 5, strings '0' to '5', or full pin specification like 'ADC_0.10' but you |
| 71 | +will have to look up the mapping in the Zephyr `pinmux.c` file. There is only |
| 72 | +one analog input controller, ADC_0. |
| 73 | + |
| 74 | +### PWM |
| 75 | +The Arduino 101 has four pins that can be used as PWM outputs. As usual on |
| 76 | +Arduino, these pins are marked on the board by a ~ (tilde) symbol next to the |
| 77 | +pins, namely IO3, IO5, IO6, and IO9. |
| 78 | + |
| 79 | +You can refer to these pins with strings 'PWM0' to 'PWM3', numbers 0 to 3, |
| 80 | +strings '0' to '3', with the IO pin names 'IO3', 'IO5', 'IO6', and 'IO9', or |
| 81 | +full pin specification 'PWM_0.0' to 'PWM_0.3'. There is only one PWM |
| 82 | +controller, PWM_0. |
| 83 | + |
| 84 | +Sample Apps |
| 85 | +----------- |
| 86 | +* [GPIO Inputs test](../../samples/tests/GPIO-Inputs.js) |
| 87 | +* [GPIO Outputs test](../../samples/tests/GPIO-Outputs.js) |
| 88 | +* [AIO sample](../../samples/AIO.js) |
| 89 | +* [PWM sample](../../samples/PWM.js) |
0 commit comments