|
| 1 | +--- |
| 2 | +parent: Other |
| 3 | +layout: minimal |
| 4 | +--- |
| 5 | +# PineTime |
| 6 | + |
| 7 | +## Onboarding Week Goals |
| 8 | + |
| 9 | +By the end of onboarding week, you should be able to: |
| 10 | + |
| 11 | +- Download and compile the InfiniTime operating system (you can do this even before your Dev Kit arrives) |
| 12 | +- Load the compiled application onto your watch |
| 13 | +- Modify the default watchface somehow (for example, add your name somewhere on the screen) |
| 14 | + |
| 15 | +When you've reached this point, submit a photo of your watch running your modified operating system. |
| 16 | + |
| 17 | +{: .note-title} |
| 18 | +> ✅ **Where do I submit?** |
| 19 | +> |
| 20 | +> After completing this assignment, submit a link to a photo of your watch using the form on your participant dashboard by logging in at [https://labs.codeday.org/dash](https://labs.codeday.org/dash) |
| 21 | +
|
| 22 | + |
| 23 | +{: .note-title} |
| 24 | +> ❓ **What if I need help?** |
| 25 | +> |
| 26 | +> |
| 27 | +> You can ask for help in #ask-for-help or schedule a CSE session. |
| 28 | +
|
| 29 | + |
| 30 | +# Getting started with InfiniTime |
| 31 | + |
| 32 | +The primary operating system that runs on the PineTime is called [InfiniTime](https://github.com/InfiniTimeOrg/InfiniTime). In this section, we’ll clone the InfiniTime source code, download the tools needed to compile InfiniTime, and end up with a “image” file that can be flashed onto your hardware. This guide assumes you have a UNIX-y operating system, such as MacOS or Linux. If you’re using Windows, you may need to work inside a Linux VM. If you’re not sure how to do this, ask. |
| 33 | + |
| 34 | +Follow [this guide](https://github.com/InfiniTimeOrg/InfiniTime/blob/develop/doc/buildAndProgram.md) to: |
| 35 | + |
| 36 | +- Download the compiler, SDK, and other tools you’ll need to build the firmware. |
| 37 | +- Clone the InfiniTime git repository. |
| 38 | +- Build the project. |
| 39 | + |
| 40 | +At the end of this guide, you should have a `pinetime-app.bin` file. |
| 41 | + |
| 42 | +For further reading: |
| 43 | + |
| 44 | +[https://github.com/InfiniTimeOrg/InfiniTime/blob/develop/doc/code/Intro.md](https://github.com/InfiniTimeOrg/InfiniTime/blob/develop/doc/code/Intro.md) |
| 45 | + |
| 46 | +[https://github.com/InfiniTimeOrg/InfiniTime/blob/develop/doc/branches.md](https://github.com/InfiniTimeOrg/InfiniTime/blob/develop/doc/branches.md) |
| 47 | + |
| 48 | +# Getting started with the PineTime hardware |
| 49 | + |
| 50 | +### What you’ll need |
| 51 | + |
| 52 | +From CodeDay, you should receive |
| 53 | + |
| 54 | +- PineTime dev kit (in the clear plastic box) |
| 55 | + - PineTime smartwatch with unsealed back cover |
| 56 | + - USB charging dock |
| 57 | + - SWD adapter cable (flat cable with headers on one end) |
| 58 | +- nRF52-DK development board (in the blue cardboard box) |
| 59 | + - Dev board |
| 60 | + - NFC antenna (you won’t need this for this project) |
| 61 | + |
| 62 | +In addition to what was shipped to you, you’ll need |
| 63 | + |
| 64 | +- MicroUSB cable that can connect to your computer. |
| 65 | +- Clear tape (clear packing tape or Kapton tape) |
| 66 | + |
| 67 | +You might find the following tools useful, but they are not required: |
| 68 | + |
| 69 | +- Multimeter |
| 70 | +- Oscilloscope |
| 71 | +- Logic Analyzer |
| 72 | +- Basic Soldering Equipment |
| 73 | + |
| 74 | +### Hookup Guide |
| 75 | + |
| 76 | +{: .warning} |
| 77 | +> The inside components on your development watch are very fragile. In particular, the battery wires and heart rate sensor are easy to break. Use extra care when touching these components. |
| 78 | +> |
| 79 | +> Be careful to connect the wires correctly. Incorrectly connecting the wires can damage your device. |
| 80 | +
|
| 81 | + |
| 82 | +In order to download code to your PineTime dev kit, you’ll need to use an SWO adapter to connect it to your computer. The nRF52-DK board has a “J-Link OB” (that’s the model name) SWO adapter built into it. |
| 83 | + |
| 84 | +There are four wires that must be connected: |
| 85 | + |
| 86 | +| Label on nRF52-DK | Wire Color in Photos | Description | |
| 87 | +| --- | --- | --- | |
| 88 | +| GND DETECT | Black | Signal Ground | |
| 89 | +| SWD CLK | Grey | “Serial Wire Debug” Clock | |
| 90 | +| SWD IO | Purple | “Serial Wire Debug” Data | |
| 91 | +| VTG | White | External Voltage. This is required for the J-Link to detect that an external device is connected. It connects to 3.3v VCC from the watch. | |
| 92 | + |
| 93 | +{: .note} |
| 94 | +> ☝ The wire colors of your SWD adapter cable may be different from what’s in the photos here. This is OK. What matters is the physical order of the wires. If you need help, ask. |
| 95 | +
|
| 96 | + |
| 97 | +1. Connect your adapter cable as described in the table above. |
| 98 | +2. Connect the dev board to your computer using a MicroUSB cable. |
| 99 | +3. Turn on the power switch. |
| 100 | + |
| 101 | + |
| 102 | + |
| 103 | +Connect the adapter cable to the pin header shown. Once connected to your computer, turn on the power switch shown. |
| 104 | + |
| 105 | +Once the adapter cable is connected to the nRF52-DK board, you can connect the other end to your PineTime. |
| 106 | + |
| 107 | + |
| 108 | + |
| 109 | +To the right of the battery, the SWD test points are visible. You may need to scooch the battery over (or carefully peel it up) to reveal these. |
| 110 | + |
| 111 | + |
| 112 | + |
| 113 | +The pin end of the adapter cable is inserted into the test points. Friction is usually enough to hold it in place. |
| 114 | + |
| 115 | +For further reading: |
| 116 | + |
| 117 | +[https://wiki.pine64.org/wiki/PineTime_Devkit_Wiring](https://wiki.pine64.org/wiki/PineTime_Devkit_Wiring) |
| 118 | + |
| 119 | +[https://wiki.pine64.org/wiki/Reprogramming_the_PineTime#nrfjprog_(for_Segger_JLink)](https://wiki.pine64.org/wiki/Reprogramming_the_PineTime#nrfjprog_(for_Segger_JLink)) |
| 120 | + |
| 121 | +### J-Link Crash Course |
| 122 | + |
| 123 | +J-Link is a series of debug probes manufactured by Segger. A debug probe is an adapter that allows your computer to interface with a microcontroller at a very low level. In addition to downloading your program onto a microcontroller, a debug probe can set breakpoints, pause/resume execution, and read the memory of the microcontroller. |
| 124 | + |
| 125 | +Here are some utilities that come with the J-Link software package that you should be aware of: |
| 126 | + |
| 127 | +- **JLinkRTTViewer** will allow you to view the debugging logs from the device. |
| 128 | +- **JFlashLite** will allow you to download code onto your watch. |
| 129 | + |
| 130 | +When configuring the J-Link software, the device name is “nRF52832_xxAA”. Select “SWD” interface (JTAG will not work). 4000 kHz is a good starting interface speed. If you run into problems, try reducing the speed (needing to do this is rare). |
| 131 | + |
| 132 | + |
| 133 | + |
| 134 | +Settings to use when configuring J-Link software |
| 135 | + |
| 136 | +To flash your PineTime |
| 137 | + |
| 138 | +1. Compile the operating system, as described above. |
| 139 | +2. Connect your PineTime to your computer as described in “Hookup Guide”. |
| 140 | +3. Open J-Flash Lite. Select the `pinetime-app-x.x.x.bin` file that you compiled earlier. Click “Program Device”. |
| 141 | + |
| 142 | + |
| 143 | + |
| 144 | +For further reading: |
| 145 | + |
| 146 | +[https://www.segger.com/downloads/jlink/UM08001](https://www.segger.com/downloads/jlink/UM08001) |
| 147 | + |
| 148 | +# Making your first change to InfiniTime |
| 149 | + |
| 150 | +For your first change to InfiniTime, make a change to the default watch face (the screen that displays the time when the watch wakes up from sleep). Add some text, move the icons around, etc. Feel free to do something goofy. The goal of this is to get familiar with the layout of the codebase and figure out what parts of the code do. If you feel like you’re getting stuck, ask for help. |
| 151 | + |
| 152 | +Once you’ve made this change, compile your application and download it onto your watch. Take a photo and submit it. |
| 153 | + |
| 154 | + |
| 155 | + |
| 156 | +Example of a Modified Watchface |
0 commit comments