fanoush / ds-d6 Goto Github PK
View Code? Open in Web Editor NEWstuff for Desay/MPOW DS-D6 nRF52832 bracelet
stuff for Desay/MPOW DS-D6 nRF52832 bracelet
I have done the followig:
espruino-xxx-DaFit.bin bin file upload via DaFlasher
it works, with Espruino IDE, but no mem, ...
because DaFlasher cold not do any more, i flashed with espurino with tis script:
P8 espruino bootoader flashing example
But now the P8 is bricked ?
I habe to open it, and connect to serial or is ther any other chance to unbrick.
Please update your Readme with this issue
I'd like to try building for DS-D6 with tinygo, and I'd like to ask you to look at my code before I flash it. It compiles, I created a zip with adafruit-nrfutil, and I don't want to tear it apart :D But I will take the responsibility anyway. All I'd like is to please look at it, and check if you find anything wrong.
So my code looks like the following:
package main
import (
"device/arm"
"device/nrf"
"machine"
"time"
"tinygo.org/x/bluetooth"
)
const vibrMS = time.Duration(5)
var (
adapter = bluetooth.DefaultAdapter
vibr machine.Pin
)
func main() {
// first I initialize bluetooth, so I can connect to it; probably it enables D6Flasher to enter bootloader mode if anything goes wrong
must("enable BLE stack", adapter.Enable())
adv := adapter.DefaultAdvertisement()
must("config adv", adv.Configure(bluetooth.AdvertisementOptions{LocalName: "Vibry1"}))
must("start adv", adv.Start())
// the motor pin that I defined in the machine package to pin = 25
vibr = machine.VIBRATOR_PIN
vibr.Configure(machine.PinConfig{Mode: machine.PinOutput})
vibrFor(20, 1000) // vibrating a little for 20 seconds, I'll try to enter bootloader mode meanwhile
// trying to enter bootloader mode by itself
nrf.POWER.SetGPREGRET(0xA8)
arm.SystemReset()
vibrFor(30, 3000) // vibrating a little for 30 seconds, I'll try to enter bootloader mode to check if we're still here
}
func vibrFor(count, ms int) {
for i := 0; i < count; i++ {
vibr.Low()
time.Sleep(time.Millisecond*time.Duration(ms) - vibrMS)
vibr.High()
time.Sleep(time.Millisecond * vibrMS)
}
}
func must(action string, err error) {
if err != nil {
panic("failed to " + action + ": " + err.Error())
}
}
What do you think?
Trying to flash the latest version of espruino on a P8b with espruino 2.06.129
I receive always following errors :
GATT ERROR using daflasher
DFU file not found using Nrf Toolbox and file type "distribution package (ZIP)"
the watch even was turned off as it ran out of battery.
From espruino web IDE, the espruino is responsive and i can flash files and the watch execute them properly.
Is possible that the package has any error?
Whats the status of P8 display support on the pinetime.
So experuino support st7789.
But i see you have LCD_SPI disabled and the pins commented out are not configured .
I know there's the "issue" with the spi hardware being used for both flash chip and the screen which might alter configuration. The Espruino also setup for 8 bit display which i don't think is a issue, but i'm not entirely sure.
I did try you really cool inlince C display program with this build espruino_2v08.189_p8_SDK12_SD30.hex, but it didn't seem to work. The interpreter throw a lot of errors.
Also i just want to say this is a amazing project. Thanks for making it.
Anyone knows which pins the HR sensor is on, on DS-D6? I want to hook something else to them, don't really need HR. Other than that there are only 2 gpio pins available - tx and rx? I guess if I'd manage to disconnect the HR sensors, I could also steal pin 26 if it's exposed? any other ones are exposed (without the anxiety smd soldering to ic pins) ? ADC?
Hi,
Have been following this github and gitter about alternative firmware for NRF52832, excellent info @fanoush !
Now I would like to flash my Nrf52832 (actually a E73.....) with Micropython using Openocd, but after much reading and many attempts I did not succeed.
Flashing Espruino .hex firmware for NRF52832 using Openocd works fine. No Openocd errors, and I can use the Espruino Web IDE on Google Chrome. The command I use on RPi is:
pi@raspberrypi3:~ $ sudo openocd -f interface/raspberrypi2-native.cfg -c "transport select swd" -f target/nrf52.cfg -d2 -c init -c "reset init" -c halt -c "nrf5 mass_erase" -c "program espruino.hex verify" -c reset -c exit
For Micropython I tried to flash 2 files from this github:
But after flashing and verifying OK, the NRF does not start and Openocd reports:
Polling target nrf52.cpu failed, trying to reexamine
Below the openocd command and it's output.
pi@raspberrypi3:~ $ sudo openocd -f interface/raspberrypi2-native.cfg -c "transport select swd" -f target/nrf52.cfg -d2 -c init -c "reset init" -c halt -c "nrf5 mass_erase" -c "program sd_bl.bin verify" -c "program firmware.bin verify" -c reset -c exit
Open On-Chip Debugger 0.10.0+dev-00985-g2dc88e14 (2019-12-27-19:04)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
debug_level: 2
BCM2835 GPIO nums: swclk = 11, swdio = 25
swd
Info : BCM2835 GPIO JTAG/SWD bitbang driver
Info : JTAG and SWD modes enabled
Info : clock speed 1001 kHz
Info : SWD DPIDR 0x2ba01477
Info : nrf52.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : Listening on port 3333 for gdb connections
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x000008e4 msp: 0x20000400
Info : nRF52832-QFAA(build code: E0) 512kB Flash, 64kB RAM
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0xfffffffe msp: 0xfffffffc
** Programming Started **
Warn : Adding extra erase range, 0x0001fb38 .. 0x0001ffff
** Programming Finished **
** Verify Started **
** Verified OK **
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x0001b090 msp: 0x20001188
** Programming Started **
Warn : Adding extra erase range, 0x00025d3c .. 0x00025fff
** Programming Finished **
** Verify Started **
** Verified OK **
Error: nrf52.cpu -- clearing lockup after double fault
target halted due to debug-request, current mode: Handler HardFault
xPSR: 0x01000003 pc: 0x0002e778 msp: 0x2000ffe0
Polling target nrf52.cpu failed, trying to reexamine
Info : nrf52.cpu: hardware has 6 breakpoints, 4 watchpoints
pi@raspberrypi3:~ $
I assume my error is in flashing the 2 .bin files in the wrong memory position. Or these bins may not be suitable for flashing directly? Googles a LOT bit did nof find a solution.
Could anybody point me in the right direction, would be appreciated!
Thx.
Hi, I am not sure how critical this is, but when using the recommend way of building Espruino (https://github.com/espruino/Espruino/blob/master/README_Building.md) the prvision.sh bash script will throw an error. E.g. for the SMA B5
me@mypc:~/code/Espruino$ source scripts/provision.sh B5-SDK12
bash: export: "PROVISION_B5-SDK12=1": not a valid identifier
Provision BOARDNAME = B5-SDK12
Provision FAMILY = NRF52
===== NRF52
===== ARM
arm-none-eabi-gcc installed
me@mypc:~/code/Espruino$
I can't tell if this error actually breaks something, but it might be worth removing the dashes from the board files. Even if only to avoid confusion. Simply removing the dash from the filename and adapting the compile commands did the trick for me.
Hi,
I got my serial to ttl, and was able to flash my ds-d6 through serial. Now I'm trying to add a watchdog, reading all related stuff, not really working. Maybe you can help.
I don't have a debugger, so I'm trying to get info of vibrations, but it's hard when it breaks :)
I have something like this now:
... main ...
if nrf.POWER.GetRESETREAS_DOG() == 1 { // reset from watchdog
nrf.POWER.SetGPREGRET(nrf.POWER.GetGPREGRET() | 0xB1) // reset to DFU
arm.SystemReset()
return
}
if nrf.CLOCK.GetLFCLKRUN_STATUS() == 0 { // some bug they mentioned
nrf.CLOCK.SetLFCLKRUN_STATUS(1)
}
nrf.WDT.CONFIG.Set((nrf.WDT_CONFIG_HALT_Pause << nrf.WDT_CONFIG_HALT_Pos) | (nrf.WDT_CONFIG_SLEEP_Run << nrf.WDT_CONFIG_SLEEP_Pos))
nrf.WDT.CRV.Set(16 * 32768) // 16 sec. timout
nrf.WDT.RREN.SetBits(nrf.WDT_RREN_RR0_Msk) //Enable reload register 0
nrf.WDT.TASKS_START.Set(1)
for {
time.Sleep(time.Second * 15)
nrf.WDT.RR[0].Set(nrf.WDT_RR_RR_Reload) //Reload watchdog register 0
}
Do you have any idea why or how? Thanks!
Could you please share your way of building the Adafruit bootloader ZIP package?
I'm trying to run the latest Adafruit bluefruit version with the 0.2.12-1 bootloader and s132_6.1.1 softdevice.
Your Adafruit bootloader stuck like in this issue in AdaOTA mode, which I solve by flashing the https://github.com/fanoush/ds-d6/blob/master/micropython/DS-D6-adafruit-back-to-desay-sd132v201.zip with the desay_dfu.py script.
I tried to build a custom bootloader based on Adafruit's with following entries inside board.h file:
`#ifndef _DSD6_NRF52832_H
#define _DSD6_NRF52832_H
/------------------------------------------------------------------/
/* LED
------------------------------------------------------------------/
#define LEDS_NUMBER 2
#define LED_PRIMARY_PIN 33 // Red // NOT EXISTENT ?HARMLESS? PINS
#define LED_SECONDARY_PIN 34 // Blue
#define LED_STATE_ON 1
/------------------------------------------------------------------/
/* BUTTON
------------------------------------------------------------------/
#define BUTTONS_NUMBER 2
#define BUTTON_1 30
#define BUTTON_2 35
#define BUTTON_PULL NRF_GPIO_PIN_PULLDOWN //UP
/------------------------------------------------------------------/
/* UART
------------------------------------------------------------------/
#define RX_PIN_NUMBER 22
#define TX_PIN_NUMBER 23
#define CTS_PIN_NUMBER 7
#define RTS_PIN_NUMBER 5
#define HWFC false
// Used as model string in OTA mode
#define BLEDIS_MANUFACTURER "Desay"
#define BLEDIS_MODEL "DS-D6"
#define UF2_PRODUCT_NAME "DSD6 - Tracker"
#define UF2_INDEX_URL "https://fccid.io/2AEMN-D6"
#endif // _DSD6_NRF52832_H`
This gives me a 472K HEX file which is some bigger then yours (168K). In case this will work, how to generate the ZIP package with adafruit-nrfutil?
This project is fairly amazing with the amount of devices it support. I'm just curious why its not merged into the main Espruino repo.
https://github.com/espruino/Espruino
Is there any technical problems with merging it.
Hi fanoush, first many thanks for making it possible to use the loader on MOY-TON P8b. But I feel I was to fast as my P8b sensor configuration seems to be different, and still today, I could not find a match for the heartrate sensor. And HR is an important feature (for me).
Maybe I need to know more details on this intallation of the bootloader. My understanding is, that DA Flasher makes the stock firmware believe your program is a valid update, and then your program is executed from SPI Flash or Ram. At this point the stock firmware should be still intact in the nRF Flash and a dump over Bluetooth would be possible - or am I wrong?
Later in the process, as it is good to have SWD access, the protection bit is cleared and at that point stock firmware is lost.
With so many variants claiming to be P8, it would be a good feature to have the stock flash dump. Sometimes it is benifical to revert to stock firmware and analyse I2C communication to see how stock firmware initialises the sensors.
I have A Lenovo Hw 01 And the companion app (Lenovo healthy and the new app Lenovo life) does not have an option for notification of Instagram. I found that only you can help as nobody else is interested in this band. the MPOW app when gets connected to a rebranded band sends AT+MOTOR:1
and the band starts vibrating, every time the Bluetooth gets disconnected and reconnected the band starts vibration. I tried the Bluetooth serial terminal app as suggested by you and I found that many commands are different between our bands, after going through the Bluetooth snoop log I found a way to show custom text on the band but I want to develop an app which can help me with the notifications. I do not have any knowledge of programming and I am taking this as my part-time project. so far I have identified the syntax and certain limitations of the band. I would like to help you if possible and learn something new. further, I would like to personally talk to you @techie_aarya is my Instagram id please DM me.
I would also like to change the we chat logo from the band to instagram logo through a OTA update with your help.
Following your instructions to build the Espruino firmware for the DS-D6 (make
with the NRF_SDK11=1
argument), make
stops at "No rule to make target":
krut@laptopkrut2016:~/Espruino$ make -j BOARD=MDBT42Q RELEASE=1 NRF_SDK11=1 DFU_UPDATE_BUILD=1
CC /home/krut/Espruino/targetlibs/nrf5x_11/components/toolchain/gcc/gcc_startup_nrf52.o
Generating platform configs
Generating pin info
Generating JS wrappers
WRAPPERSOURCES = src/jswrap_array.c src/jswrap_arraybuffer.c src/jswrap_dataview.c src/jswrap_date.c src/jswrap_error.c src/jswrap_espruino.c src/jswrap_flash.c src/jswrap_functions.c src/jswrap_interactive.c src/jswrap_io.c src/jswrap_json.c src/jswrap_modules.c src/jswrap_pin.c src/jswrap_number.c src/jswrap_object.c src/jswrap_onewire.c src/jswrap_pipe.c src/jswrap_process.c src/jswrap_promise.c src/jswrap_regexp.c src/jswrap_serial.c src/jswrap_storage.c src/jswrap_spi_i2c.c src/jswrap_stream.c src/jswrap_string.c src/jswrap_waveform.c libs/compression/jswrap_heatshrink.c libs/filesystem/jswrap_fs.c libs/filesystem/jswrap_file.c libs/math/jswrap_math.c libs/graphics/jswrap_graphics.c libs/network/jswrap_net.c libs/network/http/jswrap_http.c libs/network/js/jswrap_jsnetwork.c libs/bluetooth/jswrap_bluetooth.c libs/crypto/jswrap_crypto.c libs/neopixel/jswrap_neopixel.c
Generating pin info
make: *** No rule to make target '/home/krut/Espruino/targetlibs/nrf5x_11/components/nfc/ndef/connection_handover/ble_pair_msg/nfc_ble_pair_msg.o', needed by 'espruino_2v09.129_mdbt42q.elf'. Stop.
make: *** Waiting for unfinished jobs....
DEFINES = -DGIT_COMMIT=30a9f382 -DNO_ASSERT -DRELEASE -DBUILDNUMBER="129" -DMDBT42Q -DHAL_NFC_ENGINEERING_BC_FTPAN_WORKAROUND=1 -DCONFIG_GPIO_AS_PINRESET -DNRF_BLE_GATT_MAX_MTU_SIZE=53 -DNRF_BLE_MAX_MTU_SIZE=53 -DBLUETOOTH_NAME_PREFIX="MDBT42Q" -DNEOPIXEL_SCK_PIN=23 -DUSE_BOOTLOADER -DUSE_DEBUGGER -DUSE_TAB_COMPLETE -DUSE_HEATSHRINK -DUSE_FILESYSTEM -DUSE_MATH -DUSE_GRAPHICS -DUSE_NET -DUSE_NETWORK_JS -DBLUETOOTH -DUSE_CRYPTO -DUSE_SHA256 -DUSE_SHA512 -DUSE_NEOPIXEL -DUSE_NFC -DNFC_HAL_ENABLED=1 -DS132 -DNRF_SD_BLE_API_VERSION=2 -DBLE_STACK_SUPPORT_REQD -DSWI_DISABLE0 -DSOFTDEVICE_PRESENT -DFLOAT_ABI_HARD -DNRF52_SERIES -DNRF52 -DNRF52832_XXAA -DNRF52_PAN_74 -DNRF52832 -DNRF5X -DNRF5X_SDK_11 -DUSE_APP_CONFIG -DARM -DLINK_TIME_OPTIMISATION -DEMBEDDED
I copied nrf5x_11
in targetlibs
. Without the NRF_SDK11=1
argument, the build works fine...
Could you help?
Hello
Thanks for posting about all your work in DS-D6. Very inspiring!
I've been trying to replicate your Micropython build (I hope to come up with a hybrid watchdog system to implement very long press resets in a reasonably robust way).
The bootloader is working and I believe I have the right sources (I used the SHA-1 hash from os.uname() then applied your patch) but my version does not work. I'd like to narrow down a few variables, could you share what toolset you use and how you convert from hex file to DFU zip file?
Did you get the HRS3300 working? I'm using c/c++ and had access to the register but i get too high values on HRS register like around 14k to 15k. At first I taught that the bpm value should be the one stored on that register because it has HRS engine already but not. If you have a code that I can base my code then that would be a great help. TIA.
Hi,
Thanks for all your work, this is very cool.
I'm trying to build and flash to DS-D6 with Go through github.com/tinygo-org/tinygo/ . It supports softdevice v6. There's an Adafruit bootloader in your files to that has SD v6, but generally if I flash it, I get stuck, can do nothing other than coming back with DS-D6-adafruit-back-to-desay-sd132v201.zip
as suggested here: #3 . But that's SD v2, so I can't use it with Tinygo :D
So my question is: how could I create a desay bootloader-softdevice image with SD v6?
Thanks again.
Hello fanoush,
I followed this repo for quite some time and now wanted to try it out myself.
I tried to flash the device (Mpow DS-D6 from gearbest, I have 3 units) with your espurino DFU file but I can't get it to work. I'm on Ubuntu 18.10 with python2 and nrfutils 0.5.3. So far I tried two different USB to serial adapters, I tried to swap the RX and TX pins for flashing. Both serial adapters I tried are recognized by the computer with "ls /dev/ttyUSB*". I tried both DS-D6 devices. I tried 5V and 3V3. I tried with +5V VCC connected to the device at time of flashing and without (the same with 3V3). I measured the wires with a multimeter and built a second adapter (for the other USB to serial). I tried your DFU file and created my own with the provided command from the wiki. As far I can tell I didn't damage the devices in anyway. They still charge fine and run their original firmware and I have an untouched spare one.
I always get the same Error "Serial port could not be opened" (please see the attached image).
Thank you for your time and effort of documenting your progress and thank you in advance for your help.
Tim
Hello, I have a DS-D6 device I'm trying to update. As per the micropython instructions I flashed the patched Desay bootloader, then the Adafruit bootloader via the D6 Flasher Android app.
The DS-D6 is now advertising as AdaDFU and the D6 Flasher app detects a Nordic bootloader. However, trying to flash either of the micropython packages results in a Disconnected and OPERATION FAILED
error. I've also tried flashing a micropython package with the nRF Connect app (since it sees the DFU service) with the same disconnect behavior.
When connecting the DS-D6 USB port to a serial cable I don't see any communication at 115200 bps or 38400 bps. The adafruit-nrfutil
errors out with Timed out waiting for acknowledgement from device
. I've tried swapping around the TX/RX lines in case I had them backwards.
Any tips for flashing the uncommunicative device?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.