Skip to content

Commit e243aab

Browse files
Merge pull request #139 from OpenEarable/2.2.2
2.2.2
2 parents 56d72ef + 0f2f3d8 commit e243aab

30 files changed

Lines changed: 989 additions & 176 deletions

.github/workflows/build_firmware.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ jobs:
5050
5151
- name: Install Zephyr SDK
5252
run: |
53-
wget -q https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.16.4/zephyr-sdk-0.16.4_linux-x86_64_minimal.tar.xz
54-
tar xf zephyr-sdk-0.16.4_linux-x86_64_minimal.tar.xz -C ~/
55-
~/zephyr-sdk-0.16.4/setup.sh -c -t arm-zephyr-eabi
53+
wget -q https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.17.0/zephyr-sdk-0.17.0_linux-x86_64_minimal.tar.xz
54+
tar xf zephyr-sdk-0.17.0_linux-x86_64_minimal.tar.xz -C ~/
55+
~/zephyr-sdk-0.17.0/setup.sh -c -t arm-zephyr-eabi
5656
5757
- name: Initialize Zephyr Workspace
5858
# Set up the Zephyr workspace and install the Python dependencies

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ zephyr_library_include_directories(
5555
src/SD_Card/SDLogger
5656
src/SD_Card/Benchmark
5757
src/SD_Card/SD_Card_Manager
58+
src/time_sync
5859
)
5960

6061
zephyr_library_include_directories(app PRIVATE
@@ -74,6 +75,7 @@ add_subdirectory(src/SensorManager)
7475
add_subdirectory(src/SD_Card/SDLogger)
7576
add_subdirectory(src/SD_Card/Benchmark)
7677
add_subdirectory(src/SD_Card/SD_Card_Manager)
78+
add_subdirectory(src/time_sync)
7779

7880
## Cirrus Logic
7981
if (CONFIG_HW_CODEC_CIRRUS_LOGIC)

README.md

Lines changed: 52 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
[OpenEarable](openearable.com) is the world's first fully open-source AI platform for ear-based sensing applications with true wireless audio. Packed with an unprecedented array of high-precision sensors, OpenEarable redefines what's possible in wearable tech. Designed for both development and research applications, OpenEarable is modular, reconfigurable, and built for the future.
44
<br/><br/><br/>
5-
![image](https://github.com/user-attachments/assets/8cb55571-c6bc-4f51-b2ae-628f7be3661c)
5+
<img width="1323" height="568" alt="image" src="https://github.com/user-attachments/assets/ab4e2b0e-9645-4428-975f-466c7ef2f13b" />
6+
67

78
## Table of Contents
89

@@ -63,56 +64,65 @@
6364
- Do not set any of the FOTA flags described above.
6465

6566
9. **J-Link Setup**
66-
- Wire your J-Link to the debugging breakout PCB as shown below.
67-
![image](https://github.com/user-attachments/assets/2eeec41e-6be1-4a4f-b986-7d9a07b0f8e5)
68-
- If you do not own a J-Link yet, here are a few options (do **NOT** use J-Link clones, they will not work and are illegal!):
69-
- [J-Link EDU Mini](https://mou.sr/3LrwiVe) (available to educational institutions, private persons, and students) with [JTAG adapter](https://www.adafruit.com/product/2094) and [cable](https://www.adafruit.com/product/1675).
70-
- Full-scale J-Link for commercial use (e.g., [J-Link BASE Compact](https://mou.sr/4oQkAls)).
71-
- ⚠️ The wiring show in the figure above is for the full-scale J-Link pinout. If you use the [JTAG adapter](https://www.adafruit.com/product/2094) the wiring may be different so make sure it is correct in your case! _(to be confirmed, picture coming soon)_.
72-
73-
74-
10. **Build and Flash**
67+
- Wire your J-Link to the debugging breakout PCB as shown below.
68+
![image](https://github.com/user-attachments/assets/2eeec41e-6be1-4a4f-b986-7d9a07b0f8e5)
69+
- If you do not own a J-Link yet, here are a few options (do **NOT** use J-Link clones, they will not work and are illegal!):
70+
- [J-Link EDU Mini](https://mou.sr/3LrwiVe) (available to educational institutions, private persons, and students) with [JTAG adapter](https://www.adafruit.com/product/2094) and [cable](https://www.adafruit.com/product/1675).
71+
- Full-scale J-Link for commercial use (e.g., [J-Link BASE Compact](https://mou.sr/4oQkAls)).
72+
- ⚠️ The wiring show in the figure above is for the full-scale J-Link pinout. If you use the [JTAG adapter](https://www.adafruit.com/product/2094) the wiring may be different so make sure it is correct in your case!.
73+
74+
11. **Build and Flash**
7575
- Click on `Generate and Build` and wait for the application to build (this will take some time)
7676
- Make sure your device is charged or powered via USB. If the battery is fully discharged, the charging management IC will no longer supply power to the MCU from the battery, so you won’t be able to flash the MCU unless the battery is charged or the device is directly powered via USB.
7777
- Open a new terminal in VS Code and run the following command from the root of the `open-earable-v2` directory to flash the FOTA build. Make sure to set the serial number of your J-Link (right click your J-Link in the `CONNECTED DEVICES` tab of the nRF connect extension and copy the serial number).
78-
```bash
79-
# --right for the right ear device, or no flag to retain left/right bonding
80-
# --hw version is optional and can only be used with --left or --right
81-
./tools/flash/flash_fota.sh --snr 123456789 --left --hw 2.0.1
82-
83-
```
78+
```bash
79+
# --right for the right ear device, or no flag to retain left/right bonding, --standalone for no pair
80+
# --hw version is optional and can only be used with --left or --right
81+
./tools/flash/flash_fota.sh --snr 123456789 --left --hw 2.0.1
82+
```
83+
8484
- or without FOTA
85-
```bash
86-
# --right for the right ear device, or no flag to retain left/right bonding
87-
# --hw version is optional and can only be used with --left or --right
88-
./tools/flash/flash.sh --snr 123456789 --left --hw 2.0.1
89-
```
85+
```bash
86+
# --right for the right ear device, or no flag to retain left/right bonding, --standalone for no pair
87+
# --hw version is optional and can only be used with --left or --right
88+
89+
./tools/flash/flash.sh --snr 123456789 --left
90+
```
91+
9092
- The FOTA update script is also available for Windows as `./tools/flash/flash_fota.ps1`. To execute it, open PowerShell with administrative privileges.
9193

9294
11. **Recover Board**
93-
- If the application or network core becomes unresponsive, or you encounter flashing issues, you can recover the board using the recovery script. The `--snr` parameter specifies the serial number of your J-Link debugger.
94-
- Ensure the device is powered via USB or that the battery is sufficiently charged before running the recovery process. Otherwise, the MCU may not power up correctly and the recovery will fail.
95-
```bash
96-
./tools/flash/recover.sh --snr 123456789
97-
```
98-
- After successful recovery, you can attempt to flash the firmware again (you will have to restore left/right bonding and hardware version).
95+
- If the application or network core becomes unresponsive, or you encounter flashing issues, you can recover the board using the recovery script. The `--snr` parameter specifies the serial number of your J-Link debugger.
96+
- Ensure the device is powered via USB or that the battery is sufficiently charged before running the recovery process. Otherwise, the MCU may not power up correctly and the recovery will fail.
97+
```bash
98+
./tools/flash/recover.sh --snr 123456789
99+
```
100+
- After successful recovery, you can attempt to flash the firmware again.
99101

100102
12. **Enable Debug Output**
101-
- Open the **J-Link Configuration** program on your computer.
102-
- On macOS: Press `CMD` + `Space` and search for `J-Link Config`.
103-
- On Windows: Search for the program from the taskbar.
104-
- Ensure your J-Link is connected to your computer.
105-
- In the **Connected via USB** table, locate your J-Link device. Double-click it or right-click and select **Configure**.
106-
- Find the **Virtual COM-Port** option and select **Enable**. Click **OK** to apply the setting.
107-
- Open **Visual Studio Code**.
108-
- In the left sidebar, open the **Extensions** menu.
109-
- Search for and install the [**Serial Monitor**](https://marketplace.visualstudio.com/items?itemName=ms-vscode.vscode-serial-monitor) extension.
110-
- In the top menu bar, click **Terminal → New Terminal**.
111-
- A terminal window will appear at the bottom of VS Code. Open the **Serial Monitor** tab.
112-
- In the **Port** dropdown menu, select your J-Link’s COM port.
113-
- Set the **Baud rate** to **115200**.
114-
- Click **Start Monitoring**.
115-
- Ensure your earable is connected to the debugger probe. You should now see debug output appearing when you interact with the device (e.g., press button).
103+
- Open the **J-Link Configuration** program on your computer.
104+
- On macOS: Press `CMD` + `Space` and search for `J-Link Config`.
105+
- On Windows: Search for the program from the taskbar.
106+
- Ensure your J-Link is connected to your computer.
107+
- In the **Connected via USB** table, locate your J-Link device. Double-click it or right-click and select **Configure**.
108+
- Find the **Virtual COM-Port** option and select **Enable**. Click **OK** to apply the setting.
109+
- Open **Visual Studio Code**.
110+
- In the left sidebar, open the **Extensions** menu.
111+
- Search for and install the [**Serial Monitor**](https://marketplace.visualstudio.com/items?itemName=ms-vscode.vscode-serial-monitor) extension.
112+
- In the top menu bar, click **Terminal → New Terminal**.
113+
- A terminal window will appear at the bottom of VS Code. Open the **Serial Monitor** tab.
114+
- In the **Port** dropdown menu, select your J-Link’s COM port.
115+
- Set the **Baud rate** to **115200**.
116+
- Click **Start Monitoring**.
117+
- Ensure your earable is connected to the debugger probe. You should now see debug output appearing when you interact with the device (e.g., press button).
118+
119+
13. **Recover Board**
120+
- If the application or network core becomes unresponsive, or you encounter flashing issues, you can recover the board using the recovery script. The `--snr` parameter specifies the serial number of your J-Link debugger.
121+
- Ensure the device is powered via USB or that the battery is sufficiently charged before running the recovery process. Otherwise, the MCU may not power up correctly and the recovery will fail.
122+
```bash
123+
./tools/flash/recover.sh --snr 123456789
124+
```
125+
- After successful recovery, you can attempt to flash the firmware again (you will have to restore left/right bonding and hardware version).
116126

117127

118128

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
VERSION_MAJOR = 2
22
VERSION_MINOR = 2
3-
PATCHLEVEL = 1
3+
PATCHLEVEL = 2
44
VERSION_TWEAK = 0
55
EXTRAVERSION =

include/openearable_common.h

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,19 @@
1212

1313
#define SENSOR_DATA_FIXED_LENGTH 38
1414

15+
1516
#define millis() k_cyc_to_ms_floor64(k_uptime_ticks())
16-
#define micros() k_cyc_to_us_floor64(k_uptime_ticks())
17+
18+
#ifdef __cplusplus
19+
extern "C" {
20+
#endif
21+
uint64_t oe_micros();
22+
#ifdef __cplusplus
23+
}
24+
#endif
25+
#ifndef micros
26+
#define micros() oe_micros()
27+
#endif
1728

1829
#define load_switch_sd_id DT_NODELABEL(load_switch_sd)
1930
#define load_switch_1_8_id DT_NODELABEL(load_switch)

prj_fota.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,4 +260,4 @@ CONFIG_MCUMGR_GRP_OS_RESET_HOOK=y
260260

261261
#CONFIG_MCUMGR_GRP_SETTINGS_ACCESS_HOOK=y
262262

263-
CONFIG_SETUP_FUEL_GAUGE=y
263+
CONFIG_SETUP_FUEL_GAUGE=y

src/ParseInfo/SensorScheme.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,6 @@
1313

1414
LOG_MODULE_REGISTER(parse_info_service, CONFIG_LOG_DEFAULT_LEVEL);
1515

16-
static void enable_notifies_handler(struct k_work *work)
17-
{
18-
temp_disable_notifies(false);
19-
}
20-
21-
K_WORK_DELAYABLE_DEFINE(enable_notifies_work, enable_notifies_handler);
22-
2316
static char* parseInfoScheme;
2417
static size_t parseInfoSchemeSize;
2518

@@ -40,11 +33,7 @@ static ssize_t read_parse_info(struct bt_conn *conn,
4033
void *buf,
4134
uint16_t len,
4235
uint16_t offset) {
43-
temp_disable_notifies(true);
4436
ssize_t ret = bt_gatt_attr_read(conn, attr, buf, len, offset, parseInfoScheme, parseInfoSchemeSize);
45-
46-
// re-enable notifications after a delay
47-
k_work_schedule(&enable_notifies_work, K_MSEC(500));
4837

4938
return ret;
5039
}

0 commit comments

Comments
 (0)