Giter Site home page Giter Site logo

sma-q2-oss's Introduction

SMA-Q2-OSS

banner

Open source firmware for the SMA-Q2 smartwatch.

Project page on hackaday.io

The firmware aims to be a drop-in replacement for the original firmware. No additional hardware is required. It can be uploaded using the original OTA bootloader.

To maintain compatibility with the softdevice and bootloader already on the watch, this firmware is based on nRF5 SDK version 11.0.

Current status

  • Shows time
  • Over 10-day battery life with BLE connected
  • BLE communication secured with passkey comparison pairing
  • Current weather and forecast
  • Music player control
  • Call notifications
  • Message notifications with message history
  • Gadgetbridge support
  • Vibration works
  • Backlight based on accelerometer orientation or tapping
  • Heart rate monitor works, but doesn't use the proprietary algorithm lib, so the results are not very useful

Smartphone app

Gadgetbridge fork

Building

  1. Download nRF5 SDK 11.0 and copy the sdk components folder to the project folder

  2. Edit components/toolchain/gcc/Makefile.posix or Makefile.windows to point to your toolchain

  3. Install nrfutil version 0.5.2

  4. Patch the TWI driver to allow transfers longer than 255 bytes:

     cd components/drivers_nrf/
     patch -s -p0 < ../../patch/twi.patch
    
  5. Go to armgcc and run make

  6. Resulting app_dfu_package.zip can be uploaded using regular Nordic DFU software

Flashing

Via DFU

The watch can be flashed using regular Nordic DFU software, like nRF Connect for Android.

To enter the built-in OTA bootloader:

Original firmware: hold UP and DOWN buttons while powering on the watch.

This firmware: press UP, DOWN and BACK at the same time

Via SWD

Enabling SWD requires some work:

  1. Upload a firmware that dumps the flash and configuration register contents
  2. Disassemble watch
  3. Connect to SWD and unlock device this erases the entire flash!
  4. Restore the bootloader/softdevice/firmware and configuration register values
  5. Disable CRC checking in bootloader

License and Copyright

Copyright (c) 2019 Andrzej Surowiec, released under MIT License

FreeRTOS Copyright (C) Amazon.com, Inc.

nRF GFX lib Copyright (c) Nordic Semiconductor ASA

CMSIS DSP lib Copyright (C) ARM Limited.

utf8proc lib Copyright (c) Steven G. Johnson, Jiahao Chen, Peter Colberg, Tony Kelman, Scott P. Jones, and other contributors.

nanopb Copyright (c) Petteri Aimonen

micro-ecc lib Copyright (c) Kenneth MacKay

See headers for licenses.

sma-q2-oss's People

Contributors

emeryth avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sma-q2-oss's Issues

Pairing issue

hi,

this is a very promising project and id like to contribute if possible, thanks for the great work!

i struggle to pair the sma q2 and various android phones (8.1.0) via the forked gadgetbridge, maybe you have a hint or two on how to get it working?

what i did:

  • compile firmware (see PR #5)
  • put watch into DFU mode and flash resulting firmware via D6Flasher
  • compile forked gadgetbridge
  • install generated debug apk via adb to phone (since the release version has no certificates)
  • reboot phone
  • try to add watch in gadgetbridge
  • result: gadgetbridge never sees the sma q2

the bluetooth menu did see the watch and out of desperation i paired it with the phone directly. got asked to very the pins and paired it. unfortunately, gadgetbridge still didnt see the watch (i unchecked the option to hide paired devices).

now unfortunately, i deleted the pairing on the phone but then noticed, the watch will reject further pairing attempts right away.

as a last resort, i went back into DFU mode and reflashed the firmware. unfortunately, that did not restore the initial pairing capabilities.

do you have any tips from here on?

id like to leave the watch closed if possible, but i could also open it to reach some jtag pins or whatever is needed.

thanks!

Alarms

New Feature Idea:

Establish some form of alarms, either configurable through gadgetbridge (like on some buttonless smart trackers) or full featured setting on watch directly

Linker error on first build

Hello,

I'm setting up the environment for local development, and I stumbled on an error on the first build.

After downloading and setting up the nRF SDK, patching the necessary files and configuring Makefile.posix, the linker yells at me when trying to run make.

The error shown is as follows:

Linking target: application.out
'/usr//bin/arm-none-eabi-gcc' -Xlinker -Map=_build/application.map -mthumb -mabi=aapcs -L ../components/toolchain/gcc -Tble_app_uart_gcc_nrf52.ld -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -Wl,--gc-sections --specs=nano.specs -lc -lnosys  -u _printf_float _build/app_button.o _build/app_error.o _build/app_fifo.o _build/app_util_platform.o _build/app_timer_freertos.o _build/crc16.o _build/ecc.o _build/fds.o _build/fstorage.o _build/nrf_assert.o _build/sdk_mapped_flags.o _build/retarget.o _build/app_uart_fifo.o _build/app_pwm.o _build/nrf_drv_saadc.o _build/nrf_saadc.o _build/nrf_delay.o _build/nrf_drv_common.o _build/nrf_drv_gpiote.o _build/nrf_drv_ppi.o _build/nrf_drv_rng.o _build/nrf_drv_spi.o _build/nrf_drv_timer.o _build/nrf_drv_twi.o _build/nrf_drv_uart.o _build/nrf_drv_wdt.o _build/pstorage.o _build/nrf_drv_clock.o _build/main.o _build/ble_advdata.o _build/ble_advertising.o _build/ble_conn_params.o _build/ble_conn_state.o _build/ble_nus.o _build/ble_srv_common.o _build/gatt_cache_manager.o _build/gattc_cache_manager.o _build/gatts_cache_manager.o _build/id_manager.o _build/peer_data.o _build/peer_data_storage.o _build/peer_database.o _build/peer_id.o _build/peer_manager.o _build/pm_buffer.o _build/pm_mutex.o _build/security_dispatcher.o _build/security_manager.o _build/system_nrf52.o _build/softdevice_handler.o _build/croutine.o _build/event_groups.o _build/heap_4.o _build/list.o _build/port.o _build/port_cmsis.o _build/port_cmsis_systick.o _build/queue.o _build/tasks.o _build/timers.o _build/accel.o _build/buttons.o _build/lcd.o _build/battery.o _build/backlight.o _build/vibration.o _build/pah8002.o _build/hrm.o _build/nrf_gfx.o _build/orkney24pts.o _build/orkney8pts.o _build/7seg32.o _build/m1c_10b.o _build/m1c_10.o _build/m1c_10t.o _build/m1c_12b.o _build/m1c_12.o _build/m1c_12t.o _build/m1c_14b.o _build/m1c_14.o _build/m1c_14t.o _build/m1c_16b.o _build/m1c_16.o _build/m1c_18b.o _build/m1c_18.o _build/m1c_24b.o _build/m1mn_28.o _build/m1mn_32.o _build/m1mn_36.o _build/m1mn_48.o _build/icons.o _build/icon_data.o _build/weather_data.o _build/applets.o _build/app_menu.o _build/app_time.o _build/app_hrm.o _build/app_music.o _build/app_battery.o _build/app_call.o _build/app_weather.o _build/app_notification.o _build/app_notif_popup.o _build/app_pairing.o _build/watchface.o _build/status.o _build/screen_mgr.o _build/tetris.o _build/weather.o _build/notification.o _build/ble.o _build/ble_protocol.o _build/ble_watch_service.o _build/utf8proc.o _build/pb_common.o _build/pb_decode.o _build/pb_encode.o _build/smaq2oss.pb.o _build/gcc_startup_nrf52.o /home/rbazile/Documents/codes/autopilot-remote/sma-q2-oss/lib/libarm_cortexM4lf_math.a /home/rbazile/Documents/codes/autopilot-remote/sma-q2-oss/lib/micro_ecc_lib_nrf52.a -lm -o _build/application.out
/usr/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: _build/retarget.o: in function `_write':
/home/rbazile/Documents/codes/autopilot-remote/sma-q2-oss/components/libraries/uart/retarget.c:57: multiple definition of `_write'; /usr/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/lib/thumb/v7e-m+fp/hard/libnosys.a(write.o):write.c:(.text._write+0x0): first defined here
/usr/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: _build/retarget.o: in function `_read':
/home/rbazile/Documents/codes/autopilot-remote/sma-q2-oss/components/libraries/uart/retarget.c:72: multiple definition of `_read'; /usr/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/lib/thumb/v7e-m+fp/hard/libnosys.a(read.o):read.c:(.text._read+0x0): first defined here
collect2: error: ld returned 1 exit status
make: *** [Makefile:335 : application] Erreur 1

I'm using the latest gcc-arm-none-eabi version:

rbazile@rbazile-xps : $ arm-none-eabi-gcc -v
Using built-in specs.
COLLECT_GCC=arm-none-eabi-gcc
COLLECT_LTO_WRAPPER=/usr/bin/../lib/gcc/arm-none-eabi/9.3.1/lto-wrapper
Target: arm-none-eabi
Configured with: /mnt/workspace/workspace/GCC-9-pipeline/jenkins-GCC-9-pipeline-200_20200521_1590053374/src/gcc/configure --target=arm-none-eabi --prefix=/mnt/workspace/workspace/GCC-9-pipeline/jenkins-GCC-9-pipeline-200_20200521_1590053374/install-native --libexecdir=/mnt/workspace/workspace/GCC-9-pipeline/jenkins-GCC-9-pipeline-200_20200521_1590053374/install-native/lib --infodir=/mnt/workspace/workspace/GCC-9-pipeline/jenkins-GCC-9-pipeline-200_20200521_1590053374/install-native/share/doc/gcc-arm-none-eabi/info --mandir=/mnt/workspace/workspace/GCC-9-pipeline/jenkins-GCC-9-pipeline-200_20200521_1590053374/install-native/share/doc/gcc-arm-none-eabi/man --htmldir=/mnt/workspace/workspace/GCC-9-pipeline/jenkins-GCC-9-pipeline-200_20200521_1590053374/install-native/share/doc/gcc-arm-none-eabi/html --pdfdir=/mnt/workspace/workspace/GCC-9-pipeline/jenkins-GCC-9-pipeline-200_20200521_1590053374/install-native/share/doc/gcc-arm-none-eabi/pdf --enable-languages=c,c++ --enable-plugins --disable-decimal-float --disable-libffi --disable-libgomp --disable-libmudflap --disable-libquadmath --disable-libssp --disable-libstdcxx-pch --disable-nls --disable-shared --disable-threads --disable-tls --with-gnu-as --with-gnu-ld --with-newlib --with-headers=yes --with-python-dir=share/gcc-arm-none-eabi --with-sysroot=/mnt/workspace/workspace/GCC-9-pipeline/jenkins-GCC-9-pipeline-200_20200521_1590053374/install-native/arm-none-eabi --build=x86_64-linux-gnu --host=x86_64-linux-gnu --with-gmp=/mnt/workspace/workspace/GCC-9-pipeline/jenkins-GCC-9-pipeline-200_20200521_1590053374/build-native/host-libs/usr --with-mpfr=/mnt/workspace/workspace/GCC-9-pipeline/jenkins-GCC-9-pipeline-200_20200521_1590053374/build-native/host-libs/usr --with-mpc=/mnt/workspace/workspace/GCC-9-pipeline/jenkins-GCC-9-pipeline-200_20200521_1590053374/build-native/host-libs/usr --with-isl=/mnt/workspace/workspace/GCC-9-pipeline/jenkins-GCC-9-pipeline-200_20200521_1590053374/build-native/host-libs/usr --with-libelf=/mnt/workspace/workspace/GCC-9-pipeline/jenkins-GCC-9-pipeline-200_20200521_1590053374/build-native/host-libs/usr --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --with-pkgversion='GNU Arm Embedded Toolchain 9-2020-q2-update' --with-multilib-list=rmprofile,aprofile
Thread model: single
gcc version 9.3.1 20200408 (release) (GNU Arm Embedded Toolchain 9-2020-q2-update) 

It looks like an error directly in the SDK which is trying to redefine two functions (_write and _read) in libraries/uart/retarget.c.
Any hints on what might be happening?

firmware builds with no errors but resulting zip makes the watch go into an error mode.

Error displayed on red screen:

F:4001,0,200049DC
E:0x3

Every now and then I get a brief flash of a blue screen with the word "Blue" about a third of the way down the screen then back to the error.
I can get back to the OTA mode using the Volume up + volume down + left button.

I have no background with nrf and middle of the road programming skills.

Settings App

New Feature Idea:

Provide an app to change some configuration directly on the watch, e.g. vibration length, background light intensity, BLE pairing information

Notification responses

New Feature Idea:

Define a basic set of responses to be sent directly from watch in the notification menu.

Notification wordbreak

New Feature Idea:

Make the text in notifications break on word borders and not just anywhere

Notification scroll

New Feature Idea:

Make scrolling through a long notification text possible

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.