Open sthorley opened 3 years ago
Hi, The current firmware may run on the nrf5182 beacons, but it would use too much energy for the small batteries attached. I'd recommend that you have a look at the firmware code and reduce the sending interval at least. Currently the chips are sending as fast as possible, which will use up energy quite quickly.
Nevertheless, I like the idea of copying the final firmware with the key to a location from which you can manually flash any chip.
Is there any (good) reason why the current firmware is sending out the data as such fast rate?
No good reason. It's just an artifact from early testing.
Will update this soon.
Got mine updated and working today. I'll do a quick write-up for anyone who was a bit intimidated by the flashing process (I was at the start)... This was tested on Mac mini M1 running Big Sur 11.3
brew install open-ocd
If you don't have telnet installed install it too. brew install telnet
openocd -f /opt/homebrew/opt/open-ocd/share/openocd/scripts/interface/stlink-v2.cfg -f /opt/homebrew/opt/open-ocd/share/openocd/scripts/target/nrf51.cfg
telnet localhost 4444
halt
dump_image /Your/File/Path/flash.bin 0 0x40000
nrf51 mass_erase
program /Your/Firmware/File/Path/openhaystack_firmware.bin verify
program /Your/Firmware/File/Path/openhaystack_firmware.bin
resume
Congrats your tag should appear in OpenHaystacks momentarily.
@sthorley Thank you!
I just got it working on NRF51822 as well - it's amazing!!! Thanks!!!
just in case if someone will not find open-ocd configs, I found them here:
/usr/local/share/openocd/scripts/interface/stlink-v2.cfg
/usr/local/share/openocd/scripts/target/nrf51.cfg
hi, @sthorley thanks you I meet this problem, can you help me?
@yoution , Can you try to put the full path to the openhaystack_firmware.bin
?
@mowtschan thanks ,it's done, it's the file path error
I use the firmware directly, it seems the refresh rate is too low,I took it with my iphone in my car, and the points in the map
are too sparse
That's not really a firmware issue. It's more part of the design of Apple's Find My network. The device needs to be found by nearby iPhones and nearby iPhones won't report more than 4 locations of the same device in 30min to 1 hour. So if your device is moving you need A) a nearby iPhone and B) frequently changing nearby iPhones, because your own iPhone would not send a location update to Apple every minute or so.
Tracking actually moving device with their exact paths does only work in very populated dense environments, like a shopping area of a town. Also it helps if you have a high density of iPhone users nearby. So 15-20% is probably a good enough rate.
@sthorley Thank you!
Reworked your instruction for Windows host, maybe will be useful for someone:
This is for Ali NRF51822 round beacon, flashing with Chinese ST-Link v2 And you have to download openocd binaries
set firmware=/your/path/to/the/firmware.bin
d:/path/to/openocd -f interface/stlink.cfg -f target/nrf51.cfg -c init -c "reset halt" -c "nrf51 mass_erase" -c "program %firmware% verify" -c "program %firmware%"
And no need in telnet-mode
Has anyone changed the beacon interval to make the battery use more efficient on these devices?
Yes, please check @acalatrava repository for that: https://github.com/acalatrava/openhaystack-firmware
Hello I have program with programming (I have a jlink)
Thanks for all
What’s the battery life with standard firmware on this specific device?
With standard firmware it's a couple of weeks, with acalatravas version its way longer - I have been running a couple of nRF51822s for half a year now without depleting the battery on any of them.
@jrusi I got about 5 days out of the default firmware. @vbetker could you perhaps help with flashing the firmware? https://github.com/acalatrava/openhaystack-firmware/issues/15
@jrusi I got about 5 days out of the default firmware. @vbetker could you perhaps help with flashing the firmware? acalatrava/openhaystack-firmware#15
I can help you out just let me know.
@Itheras perfect! Do you know what I am doing wrong?
@bruvv what operating system and what issues are you having?
@Itheras https://github.com/acalatrava/openhaystack-firmware/issues/15 see that ticket please
@Itheras acalatrava/openhaystack-firmware#15 see that ticket please
aaah yeah sorry let me see.
just a note you can put all the commands in the openocd command
if you put -c init -c "reset halt" -c "nrf51 mass_erase 0" -c reset -c "program fullpathtoyourbinfile verify" -c reset -c exit at the end of your command then it does it all without having to open a second termnial issuing the commands via telnet.
Useful if you are doing a bunch at once
Hello I have program with programming (I have a jlink)
Thanks for all
I am also only using a jlink I had to run openocd -f /opt/homebrew/opt/open-ocd/share/openocd/scripts/interface/jlink.cfg -c "transport select swd" -f /opt/homebrew/opt/open-ocd/share/openocd/scripts/target/nrf51_mod.cfg
. Where I added set WORKAREASIZE 0
to nrf51_mod.cfg
.
But I cannot see my device online. How did you flash it with jlink?
Is there a programming adapter like there is for blitzwolf and tasmota? https://www.thingiverse.com/thing:3476167
I flashed in the following way
export PUBKEY=4jSeYlz7GAhKYQBjXS1Ku06A5+UjV2CfvEATNw==
firmware=opnehaystack-nrf51822-firmware.bin
./key-injector.py < /Applications/OpenHaystack.app/Contents/Resources/firmware.bin > $firmware
openocd -f interface/stlink-v2.cfg -f target/nrf51.cfg -c "init; halt; nrf51 mass_erase; program $firmware verify; program $firmware; resume;"
#!/usr/bin/env python3
import sys
import re
import base64
import os
PUBKEY = os.environ.get("PUBKEY")
# Decode the base64 string back to bytes.
decoded_bytes = base64.b64decode(PUBKEY)
# Take input from stdin.
data = sys.stdin.buffer.read()
# Replace "OFFLINEFINDINGPUBLICKEYHERE!" with the decoded bytes in the input string.
output_string = re.sub(b"OFFLINEFINDINGPUBLICKEYHERE!", decoded_bytes, data)
# Print the output string to stdout.
sys.stdout.buffer.write(output_string)
It works.
Full article https://dzianisv.github.io/notes/Embedded/Nordic-NRF51822-Airtag.html
@dzianisv What battery life do you get with this beacon? https://aliexpress.com/item/1005003671695188.html?sku_id=12000028906157906
@dzianisv What battery life do you get with this beacon? https://aliexpress.com/item/1005003671695188.html?sku_id=12000028906157906
with CR2025 it works about 14 days, looks like the firmware has to be optimized, for instance a deep sleep has to be used? But I am not very familiar with NRF chips internals.
Edit: Never mind that, it was an issue with the connectors I had onto the nRF board, GND wasn't properly connected, eventually got it working.
Hey everyone, I've tried flashing the firmware onto the nRF51822 ali express beacon as suggested from above, but I had no success, running the following code returns an error
openocd -f /usr/local/share/openocd/scripts/interface/stlink.cfg -f /usr/local/share/openocd/scripts/target/nrf51.cfg -c "init; reset halt; nrf51 mass_erase; program firmware.bin verify; program firmware.bin; resume;"
I made sure to run this command on the same directory as firmware.bin
is located, which is a manually compiled firmware with the appropriate pub key, I get the following error message:
Open On-Chip Debugger 0.12.0
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "hla_swd". To override use 'transport select <transport>'.
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
Info : clock speed 1000 kHz
Info : STLINK V2J29S7 (API v2) VID:PID 0483:3748
Info : Target voltage: 3.300599
Info : [nrf51.cpu] Cortex-M0 r0p0 processor detected
Info : [nrf51.cpu] target has 4 breakpoints, 2 watchpoints
Info : starting gdb server for nrf51.cpu on 3333
Info : Listening on port 3333 for gdb connections
[nrf51.cpu] halted due to debug-request, current mode: Thread
xPSR: 0xc1000000 pc: 0x00000c70 msp: 0x20004000
Info : nRF51822-QFAA(build code: H0) 256kB Flash, 16kB RAM
Info : Mass erase completed.
Info : A reset or power cycle is required if the flash was protected before.
[nrf51.cpu] halted due to debug-request, current mode: Thread
xPSR: 0xc1000000 pc: 0xfffffffe msp: 0xfffffffc
** Programming Started **
Info : Padding image section 0 at 0x00003d5f with 1 bytes (bank write end alignment)
Warn : Adding extra erase range, 0x00003d60 .. 0x00003fff
Error: jtag status contains invalid mode value - communication failure
Error: error waiting for target flash write algorithm
Error: Failed to enable read-only operation
Error: Failed to write to nrf5 flash
Error: error writing to flash at address 0x00000000 at offset 0x00000000
embedded:startup.tcl:1516: Error: ** Programming Failed **
in procedure 'program'
in procedure 'program_error' called at file "embedded:startup.tcl", line 1581
at file "embedded:startup.tcl", line 1516
Any help would be much appreciated, many thanks.
Hey, sorry if this is too off topic. I’m thinking about putting this thing into some hardware and am wondering about the measurements, but can’t find any officially. It seems to be designed to fit on top of a CR2477, which would be around 24.5mm in diameter. Can anyone confirm this? Thank you!
From reading #20 it seems I could use this on the Aliexpress nRF51822 beacon chips by simply taking the existing firmware.bin and replacing the string with the advertisement key.
Could this process be added to the app which could then just dump the patched firmware somewhere to manually flash? I'm still awaiting my ST-link v2 to arrive for the actual flashing process so haven't tested things yet but the form factor of the nRF51822 chips is perfect for this application.