dakhnod / FakeTag

firmware for nRF51 chips that is coincidentally compatible with the FindMy (AirTag) ecosystem
375 stars 23 forks source link

Where can I find info on uploading new firmware? #1

Open bdruth opened 2 years ago

bdruth commented 2 years ago

I love the compact NRF51822 "beacon" module that you're using in your picture - where can I find info on setting these up to write new firmware? Hopefully something step-by-step on where to solder connections, etc.? Thanks!

p.s. this is the one I found on ali

dakhnod commented 2 years ago

Are you talking about the round module of the square box?

Anyway, the one you found is pretty much the one I am using.

First of all, you need a JLink debugger. I am using a JLink edu that costs around 20€.

After that, you somehow need to break out the single-wire-connection.

To attach to the debug and voltage pins on the round board I am just using crocodile clips.

Just comment here once you got everything together.

digitaltrousers commented 2 years ago

Hi @dakhnod . Is there a reason Jlink is specified? Would something like the below work instead? In my country these are a lot more readily available and don't have to pay over 40EUR postage.

dakhnod commented 2 years ago

@digitaltrousers I have no experience with any other boards. I've heard that things like OpenOCD might work, but never worked with those.

After all, the nRF51 just speaks SWD, so you should have options.

bdruth commented 2 years ago

@dakhnod - it'll take me a bit to get the JLink - I'll check back here when I've got it. Unless @digitaltrousers has luck with the picoprobe approach first :)

lspeltie commented 2 years ago

@bdruth I successfully flashed it with an STLink V/2 and OpenOCD. I have a board very much like the one you linked but it was missing the low frequency crystal so it wouldn't work with the configuration for boards/beacon_round.h. I had to swap in some of the config from beacon_big.

Firmware working very well so far. Now to see how long the battery will last.

0xsyit commented 2 years ago

does anyone have a picture with the pin outs? i just got my in Round Beacons from aliexpress im still waiting on the the little vibro-motors

EDIT nvm i got it, here is a picture i found just in case anyone else needs it HTB1T3LzoZbI8KJjy1zdq6ze1VXaa

dakhnod commented 2 years ago

There should be two pairs of contact points on the board. One pair is for power, the one close to the battery soldier point is 3v.

The other pair (very close to the nrf51 ic) is swd, you need to trial and error those.

0xsyit commented 2 years ago

There should be two pairs of contact points on the board. One pair is for power, the one close to the battery soldier point is 3v.

The other pair (very close to the nrf51 ic) is swd, you need to trial and error those.

Thank you, i was too afraid to break it. Im trying to understand how did you attach the vibrator motor, because i dont see anything hehe, i might be blind or too stupid :)

dakhnod commented 2 years ago

Not sure what vibration motor you are talking about. I am using a vibration sensor, attached at the same contacts as the button.

0xsyit commented 2 years ago

yes i mean vibration sensor, apologies for confusion. Thank you. I also noticed my Beacons are slightly different, there is few contacts on the left are exposed photo_2022-07-01 06 49 17 t

dakhnod commented 2 years ago

Oh, right, you're missing the 32khz crystal

0xsyit commented 2 years ago

oh man, thats not good is it?

dakhnod commented 2 years ago

It's okay, you just need to adjust the board config to use the internal Oszillator. Search for LFSRC or something similar in the board configs and you should be able to find reference. That will lead to a slightly higher power consumption, but nothing too worrying.

0xsyit commented 2 years ago

Thank you kind sir :)

biemster commented 2 years ago

I have the exact same board as @0xsyit , and just to confirm (this is my first nRF project) the low freq source should be changed in the sdk_config.h, #define CLOCK_CONFIG_LF_SRC 0 instead of 1?

biemster commented 2 years ago

That didn't seem to do the trick :( @lspeltie I see that you had a similar issue, what config from beacon_big did you swap in? (@dakhnod should this discussion go to a new issue?)

dakhnod commented 2 years ago

@biemster congratz to starting your first nRF project! I was struggling a lot with the whole setup back in the day, and it still poses quite a challenge every now and then.

You should set the proper value for NRF_CLOCK_LFCLKSRC. You can compare this and this file to see examples.

Since you don't have a crystal, you need this configuration, which uses the internal RC circuit instead of an external XTAL.

biemster commented 2 years ago

Thanks @dakhnod , that's clear instruction. I've made the edit and used an stlink v2 and openocd to flash the s130 softdevice to the beacon and the nrf51822_xxac.hex to 0x1c000, but it's still not showing up on nrfconnect :( I've put my own key in the keys.h file, so that shouldn't be the issue. I guess I have to experiment some more, I'll write back when it works.

EDIT: also the ble_app_beacon_pca10028_s130.hex and even blinky_pca10028_s130.hex from the SDK does not work when I use this method, so there must be something going wrong with flashing

EDIT2: it works now! softdevice s130 v2 has an APP_CODE_BASE of 0x1b000, as opposed to 0x1c000 for v1, and I had to write the nrf51822_xxac.bin instead of the hex for some reason.. Awesome work @dakhnod , I'll keep experimenting with these!

digitaltrousers commented 2 years ago

@bdruth, if you're still wondering about flashing using the Pi Pico, it worked fine for me, although I had to slow it down from the default 1MHz. I just took a zero off the line: adapter speed 1000 in the openocd/scripts/target/nrf51.cfg file.

dakhnod commented 2 years ago

If you have a suitable debugger I would highly advise you to get RTT to work to read the debug output of my code.

jrusi commented 1 year ago

@dakhnod how is it possible to get the battery status in OpenHaystack app?

dakhnod commented 1 year ago

@jrusi no idea. Also, I don't think my app is really compatible with OoenHaystack, since they use different key derivation mechanisms.

rkreutz commented 5 months ago

A bit late to the party, but @dakhnod could you point to what vibration sensor you were using on your project? I have no idea of what kind of sensor could be used along with the small battery the beacon has. Thanks

dakhnod commented 5 months ago

@rkreutz it was an sw-18020 or something. Incredibly simple, reliable and 0 idle current.

rkreutz commented 5 months ago

That's helpful thanks. And you mentioned you just attached it to the button, did you actually solder it or just put it on contact with the button's terminals?

dakhnod commented 5 months ago

Soldered it. I don't see a reliable way of connecting it otherwise.