-
Notifications
You must be signed in to change notification settings - Fork 154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Are there J-Link alternatives? #43
Comments
This could be what you are looking for: https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/flashing-and-debugging-nrf5152-with-a-cheap-blackm |
I'm working on getting boards brought up using the SINKR unit, which you can find on Amazon for relatively cheap (compared to the commercial units) here: https://www.amazon.com/gp/product/B09KXSJ31D/ I wasn't able to find any of the similarly priced educational models of the suggested device anywhere. The key requirement for an alternative seems to be support for the ARM processor specified in the current design, and not much else. Note that this is my assumption, I haven't had a chance to populate and attempt to program any of the boards yet, so I can't confirm that the unit I suggested will work. As far as other alternatives, I can't imagine it would be a fun time trying to develop that by bitbanging the interface yourself. You might have some luck with the cheap AliExpress units, but I can't say for sure. |
For hobbyists and makers, the best solution in my opinion is a J-Link EDU Mini. It's around $20, when it's available (I see a couple on digikey, Adafruit & Mouser are sold out). It just works. You can't use it for anything commercial. I can't recommend cheap clones from Ali express. In my experience they are only cheaper if you don't value your time. Some open source alternatives I'm interested in but haven't tested yet:
|
Got the first board soldered up just now, so I'm one step away from testing the SINKR (it's really a ULINK-2). Once I get a pogo pin clip set up I'll let everyone know how it goes. |
I'm working on using option 2 from this list. Things have gone well except I'm unclear on how to flash the 2 files (SoftDevice and b-parasite). I think I need to use an offset for the flash address but I'm not sure what that offset should be. I tried specifying an offset of 0x2700 for the SoftDevice as per https://devzone.nordicsemi.com/guides/short-range-guides/b/getting-started/posts/adjustment-of-ram-and-flash-memory but that doesn't seem to be working. I'm also not clear if I should be using the .bin or .hex files? |
Im pursuing the same thing - and i re-read the softdevice detail again - that 0x27000 is where the softdevice expects the program to be! Im still trying to work out where the softdevice needs to go - per another doc it looks like 0x1B000, but i havent gotten a chance to test it. Per rbaron, its just the hex file we need to flash. so flash the soft device to 0x1B000? then flash _xxaa.hex to 0x27000 is my plan once I get my shipment of NRFs and assembled in the next few days |
I haven't messed with any of these alternative flashing methods, but here are some tricks we can use to determine the flash addresses: The SoftDevice is the first thing that runs, and should live at address We can verify this by taking a look at our linker script (
The first line
The first line I hope this helps. |
It's been a while since I've chimed in on this thread but I'll just say that I agree with @rbaron that the J-Link seems to be the best way to do this. I have yet to experiment with using bitbanging or an ESP32 to program the device, but my experiments so far with the Sinkr ARM programmer have been a failure. Even getting the tools working is a challenge. I hope folks have success with alternative methods but I'm going to give up on what I'm doing and just try to get a J-Link. |
Thanks rbaron and chucknorris101. I had actually tried putting the s140_nrf52_7.2.0_softdevice.hex at 0x0 and nrf52840_xxaa.hex at 0x27000 but either (a) it wasn't actually flashing because it was in sleep mode or something similar mentioned in the docs here or (b) it actually did work and I didn't realize it. What's the easiest way to confirm it's working? I modified prst_config.h to:
Hoping to see blinks but...no lights. Maybe I'll try to solder up a fresh one and see if it works. |
@ryanmillerwork I believe if you want to flash the raw firmware data directly, you'd need a |
The SWD esp32 guy just uses a hex2bin exe type program to convert files to bin type if there isnt extraneous information. NRF forum seems to imply thats possible with the softdevice, but it also discusses a separate bootloader in that post, is the bootloader included with the .bin in parasite makefile? |
@chucknorris101 no, the .bin is just the b-parasite firmware, that like we saw, needs to be flashed after the SoftDevice (which itself contains the bootloader). |
my first attempts at soldering the nrf on did not go well (not recognized by the flasher so im missing some connections on the solder end...fat fingers) and havent had a chance to fix to trial these options. But i did find this: https://infocenter.nordicsemi.com/index.jsp?topic=%2Fsds_s140%2FSDS%2Fs1xx%2Fmbr_bootloader%2Fmbr_bootloader.html NRF doesnt see the softdevice as a bootloader per se, but it does provide the MBR with a separate bootloader being optional The esp-32 SWD guy in his examples seems to only flash .bin files, i plan to convert the softdevice from .hex to .bin (though im not sure it is necessary, i feel like its worth a shot), and then use the makefile generated .bin. |
I think the nrfjprog is calling the nrfutil functions. trying to get those installed was a pain, but i think that im close - just running into flags with what it asked me to input. @ryanmillerwork if you want to poke around a bit. It seems to be the function that combines the soft device and firmware and creates the bootloader...or so it seems. the output is a zip that would then be able to be flashed...maybe? edit: still no joy. got nrfutil to compile a zip for me, but flashing the individual bins doesnt seem to do anything. there are .dat files that might be critical that im leaving out so far, and still tbd on whether a specific bootloader is generated by the utils- the documentation seems to imply for SD + Application setups it creates a bootloader for it edit part 2: still no luck, but i did find this today: https://www.youtube.com/watch?v=d6toH-qJbOI which is maybe another path forward for pursuing, short of getting a debugger. I think other than the flash values, NRF seems to imply the RAM values need to be set properly as well, which at least to me doesnt make sense if the RAM is supposed to be wiped/reset every power cycle? but im not a RAM expert... |
@rbaron it seems nrfjprog can read the flash memory of a chip as well and dump to a file, would you be able to read a completed chip file and post here for comparison? maybe can see what addresses to load in the nrfutil outputs from the other pokings around. I have an ESP-Prog on the way from sparkfun, which might just be the only link we need, since nrfjprog/nrfutils do all the work, not the embedded studio, we just need a way for the PC to connect directly |
@chucknorris101, this is the firmware dump from a working b-parasite that was compiled with the default Command I used:
I zipped it so GitHub lets me upload it: firmware-dump.bin.zip Hint: Run |
Thank you! I will review tonight sometime. In the meantime, the ESP-PROG option wasnt working, or at least was beyond my beginner level approach, in theory the FTDI chip should be able to be recognized/passthrough NRF contact with the right drivers/firmware update?, but i wasnt able to get the PC or any of the debugger software to recognize as such. For those struggling to get a j-link - i posted a question on the NRF forum, and they indicated that the DevKit boards can be used as a debugger! So i am going to try that. I think the DK are a bit more pricy in the $50 range but not astronomical and seemingly readily available. |
This bin file can be directly flashed to 0x0 with the esp32 swd flasher and result in a working bparasite!!! I havent been able to pull it apart yet, but when ive been tinkering with the sdk, the jlink/nrfDK seem to know that the softdevice has a MBR associated, that gets generated when the nrfjprog gets called, at least when i point the nrfconnect to the DK, it shows a soft device sector and a MBR sector. the SWD flasher just sends the hex/bin to the location, and doesnt have a conversion or 'implementation' setup. Following that logic, we should be able to flash the 'standard' MBR-SD file and then flash program to x27000. So far i havent been able to get that to work flashing any of the .bin/hex files as output from the makefile. But maybe someone else knows a better way? this was my download from a workingbparasite of the 0x0 - 0x26FFF (which should be everything up to x27000? |
Is there a guide on getting the softdevice firmware compiled? I suspect the way to do this with the ESP32 option is first flash the softdevice firmware using 0x0 address and then flash the b-parasite firmware on 0x27000? |
Thus far the only guide is that the softdevice can be flashed to 0x0 but it needs to be the 0x0-0x26FFF file above. The softdevice bin alone doesn't seem to flash with esp32. Even then getting the softdevice loaded doesn't seem to let you load program straight to 0x27000 but maybe someone more technical might know why. Something the nrfjprog command does seems to modify the output bin to something else on the chip |
Makes sense. You mentioned earlier you had success with the devkit, mind sharing what model that is and possibly a guide on how to work with it? |
Yea, the one I have is the NRF52840-DK But I suspect any dev kit from them with the embedded jlink would work. It's all about getting the jlink. As far as a guide, I can try to lay it out including things that may not be necessary but may have solved some background dependencies without me knowing. I had previously set up nrfutils toolchain, but not sure it's needed. I also installed the nrf connect software and programmer but again not sure if needed, but should give a good idea if your connections are set up correctly per my picture above. If not correct it will not show up to the system as a jlink but will be just an nrf52840 (don't be fooled thinking this is the parasite)... I haven't gotten nrfs tools to see the parasite memory/etc but segger studio works The segger embedded studio set up direct from segger is useful and has the drivers needed, and also will have the viewer and other things for debugging as if it were just a jlink device. You'll also need to set up the nrfjprog toolchain. I'm running windows and set up powershell with choco to simulate the Linux commands. Once you have the tools, and pathed to your file locations, you should be all set with the code provided. Enter: Make to get the code makefile to compile at any point in the process belowThis isn't dependent on connecting the device. Connect the device, and run nrfjprog - f nrf52 - - recover. This should give you a connecting type message or that it could take some time, if not connected properly it will throw an error that it can't find a jlink, try jiggling or repositioning. Same thing if it says can't recover. I've found devices may repeatedly not recover if soldering isn't accurate. I think once I got it to work by using the esp32 to erase the protection and then it would recover, but maybe just poor connections... Then, you can run: make flash soft_device and make flash per rbarons instructions and it should give a few lines and resolve with a run and back to cmd. Otherwise it will throw similar errors to the above. I've found once I've gotten a device to recover the rest is smooth sailing. Others may not have issue with recovery if they're better at soldering. |
I have been following this project for years now and have been successful in flashing the parasite with an inexpensive In my understanding, every DAP compatible debugging probe should work. As I am more familiar with python, I chose the way of flashing the It comes down to one simple command after setting the library up. No drivers or anything are needed for the debugging probes, at least with Windows 11. So there is no need to install any of the other tools or software just for flashing. (For compiling you still need the nRF SDK and a gcc toolchain from ARM) I would be happy to contribute some more detailled instructions to some sort of documentation in this project. |
I was able to use a blackmagic probe on a cheap "Black Pill v2" to flash a Zephyr-based firmare on the b-parasite. The BMP even supports RTT which works as a log backend. There isn't much to it -- just follow the official instructions. I can do a short writeup if there's interest. |
Hi @oleo65, I am in the process of ordering some b-parasites and looking how to flash it. I am not sure which specific module you refer to. I hope it is OK to post AliExpress links here (if not let me know @rbaron and I will just remove them). Do you refer to this one? Also, I looked at the pyocd library and it seems compatible with the CMSIS-DAP emulator so cheaper ones such as this one might work. Do you think it might work with pyocd? Regards, |
@kzyapkov i think there definitely would be interest, though i know when i was looking even black magic probes were harder to come by. 'zephyr based firmware' is over my head, im sure others may feel the same @jrhbcn I think the first link references 'jtag' which should hopefully allow it to use the 'jlink' ecosystem setup which is pretty seamless once setup. I think other options SWD/etc have been attempted but havent shown results...though likely due to lack of determined approach ... i think i posted some of my tries and fails above, but the jlink programming process seems to modify the code somehow from the basic binary when writing to the chip, maybe this is obvious to more well versed programmers, but it isnt easily SWD'd on - a firmware for a working parasite can be dumped via SWD, and flashed to another via SWD to make it work, but the output of the makefile hasnt been able to be successfully put in without a jlink until seemingly @kzyapkov just above. |
I don't own an original BMP either, they seem to be unobtainable. However, ports exist for many cheap boards, see the supported platforms in the code, each comes with instructions. I think Black Pill a good option these days. The first answer to this issue has a link to a good walkthrough, there are many other articles on the topic. But, in short: On linux, if you install the udev rules,
I didn't know about nanoDAP. They'll do the job, (as @oleo65 says) and may be easier than the BMP. I'd go for the originals from Muse Lab though, you never know what you will get with the clones, plus the authors should be supported when possible. |
I agree. However, I am not sure of the right Muse Lab board as they have several very similar to each other. Let's see if @oleo65 can see these messages and clarify it. Regards |
Ok, this might be a little bit confusing with all the names. 😇 I own a probe called I specifically will not recommend any of the probes since I cannot compare them in respect of functionality or firmware capabilities. I am far from an expert with this kind of little hardware and still trying to get comfortable in the whole embedded environment. Nevertheless I managed to flash and erase the nRF52840 chip just fine using either OpenOCD or pyOCD. Additionally I also got somehow the RTT console working and rudimentally a Side note: In my experience, the whole Nordic ecosystem is tailored by Nordic to the SEGGER J-LINK toolchain and will work with those probes basically out of the box. If you are really unsure I would stick with those as also recommended by @rbaron in the docs. But if you are willing to tinker a little bit more and get your hands somewhat dirty, taking a different route might also be fun (and a lot less expensive). |
@kzyapkov I would love a write up for using the BMP. I used WSL Ubuntu to compile the code and Windows to flash my b-parasite boards with the GDB toolchain. But I would like to reflash them to assign different MAC addresses and do it via Ubuntu. Mostly because I can't get GBD to see the b-parasites after the original flash. |
Hello, Just to confirm that I have been able to compile and flash the parasite firmware using a cheap blackmagic probe clone (bluepill STM32F103C8T6) following the steps highlighted by @kzyapkov and @1technophile. I have my first b-parasite running yes!!! (was quite difficult to solder the nordic chip with my soldering skills, result is not pretty but seems to work!). I can create better detailed instructions (@rbaron let me know if you want them to be included in the documentation). For the impatient, these are the steps I followed in MacOS:
|
@jrhbcn I'm working on a tutorial for information. I will share it here once done. Should be in a few days. |
@1technophile great!! Let me know if you want me to help you in any way (maybe adding macos specific instructions if you haven't used that platform). |
Here is the tutorial, on macOS also ;-) I can add it to the wiki also if @rbaron wants. On another note, I think it could be interesting to activate the discussions module of the project as most of the issues here are more discussion oriented. |
Nice tutorial @1technophile, the only thing missing for my case/steps is that I used a bluepill as a cheap clone replacement of a proper black magic probe and had to first install the BMP firmware (my step 1) in it using yet another board (stlinkv2). The rest is exactly the same! Regards, |
Good to know someone else got the NRF52840DK working @chucknorris101, I picked one up myself but it seems in the 3.0.0 revision they swapped some pins around but I think I have them hooked up correctly. I'm stuck on getting the firmware to compile, some error with the nRF sdk not being able to find the gnu toolchain...any chance you have plans for writing up a tutorial? |
@dannyjim-ml I was able to get the firmware to compile by following the same instructions in the main wiki -- make sure you're setting the However, I'm working with the blackmagic-probe team to figure out why there is an error when you get to the stage in @1technophile 's tutorial where you actually load the firmware. On BluePill devices, which is what I'm running, it fails with a
|
I worked with the blackmagic probe team and came up with a workaround, while they develop a patch for the BluePill. I'm going to write up the tutorial for how to do this. The BluePill I'm using cost around $20, so this is going to be a huge cost savings for anyone who wants to do this without having to shell out for the Segger EDU devices (assuming you can even find one). |
Here's how to get this working with a BluePill: These instructions assume you have the ARM-built toolchain and all required dependencies, as mentioned on the BlackMagic probe's documentation. It also assumes you have
|
The bug which was the root cause of the problems flashing the b-parasite firmware using the BluePill have been fixed, you can find out more details in blackmagic-debug/blackmagic#1325. Edit: This patch is now in the main branch. This means that if you follow the instructions @1technophile provided here, with some minor changes for your BluePill, you'll be in working order. Here are the steps:
|
Hey everyone, just a heads up that I finally managed to merge the #76. It migrates the code from the legacy nrf-sdk to the nRF Connect SDK. The build process changed a bit, but I think most flashing methods discussed here will still work, with the added benefit that we don't have to flash the SoftDevice separately (or manually merge it with the application) anymore. I also tried to update all the docs and add new pages to the Wiki. I linked some of the flashing method discussed here on the How to Flash the Samples page. I'm hoping the new docs make sense. Tks! |
Sorry if this sounds a bit pedantic, I'm just not familiar with the terminology here. Is the idea that "samples" means firmware for running the b-parasite? If it weren't for this post mentioning it, I might not have made the connection that this is the wikipage I want to go to if I want to learn how to bring up the device and get the firmware running. Am I understanding this correctly? |
Thanks, fantastic to have access to the binaries from the actions On another topic, I was thinking that the discussion module could be interesting for this project, as a lot of issues are looking more like forum topics than real issues. |
@1technophile Does this mean that the repo can be set up to have binary blob releases that are generated automatically? If so, maybe we should ask @rbaron to set that up to track updates to the main branch? |
Samples is maybe not the ideal name, but I wanted to convey a similar idea of a "dev board" that comes with different samples, mostly because I'm hoping to support other protocols than BLE. Right now we have the main BLE firmware, and a couple of test/calibration firmwares. It's also the term used by nRF Connect for examples. I'm open to suggestions. @1technophile I've enabled the discussions module 👌 |
In this case, maybe the term "firmware samples" is best? (i.e., How to Build Firmware Samples, How to Flash Firmware Samples -- these seem like where I'd go if I wanted to know how to get the firmware compiled, and then put it onto the device) |
Good idea. I had named them "firmware samples" in the main README. I will update the wiki too. Tks. |
Yes the repo could be setup like this with binaries attached to releases |
@drspangle appreciate the writeup! I've obtained a few bluepills since reading this and just wanted to add a note: I've so far bought 3 bluepills and all of them are unable to be flashed with the BMP firmware. I'm highly suspect that they might be clone chips read more here. Trying to confirm if this is actually the case and if I just have 3 bricked bluepills on hand. Pretty close to just buying the BMP from Adafruit at this point! Either way, just wanted to make a note of that for any future tinkerers who come up against a similar issue. |
Some notes on using BMP: Back when I looked, official BMP hardware was unobtainium, but boards are available for purchase now. I just ordered one, and encourage everyone who can afford it to do the same. For alternative BMP hardware, I strongly recommend the "Black Pill" board instead of Blue Pill. It's almost as cheap, but way more capable. I doesn't require another SWD programmer (like STLink), but can be flashed directly using the built-in bootloader via USB. https://github.com/blackmagic-debug/blackmagic/tree/main/src/platforms/blackpillv2 Now that firmware is ported to NRF Connect, use And finally, one cool feature of BMP is the RTT support, see this. If your blackmagic probe is built with
and in a second terminal, |
I am using OpenOCD and it works fine for flashing. However, I am not sure how can I do debugging ? Should I dedicate Serial/UART on the chip(solder some cables to it) and log the messages out there, or there is a way to do remote debugging. over OpenOCD. I am using OpenOCD on Raspberry PI. |
Hey all, Looking for some help. I have a bluepill flashed to BMP firmware compiled using drspangle's Dec 6th instructions. I successfully used it to flash the BLE firmware on the 4 boards. I used VS code to build samples then WSL and arm gdb to flash the boards.
I pass through the bluepill from Windows 10 to WSL v2
Now that they are all flashed I cannot get arm gdb to recognize the boards. I have connected them the same way I did when I flashed them by using the battery then connecting clk, io and gnd from the bluepill to the pogo clip. gdb error
I have also tried letting the bluepill and a stand alone bench power supply power up the boards and I get the same error in gdb. I have tried to use nrfjprog in Windows 10, but it does not recognize the bluepill as a programmer. nrfprog
Is there a connect under reset or something similar for reflashing the nrf52840? I really have no idea what I am doing haha I just follow the guides of smart people on here and google (which has failed me for this issue). |
Looking into this as well i have an STM32F411E-DISCO which i believe should be compatible with BMP so that likely could be used (untested). But further to that the board also includes a built in ST-LINK/V2 with SWD headers. Looks like the ST-LINK can be flashed with J-Link OB. https://www.segger.com/products/debug-probes/j-link/models/other-j-links/st-link-on-board/ Hoping to give it a go when i can get the firmware side of things sorted out. |
I don't know if I'm too late to the party, but I've successfully flashed my parasites using a raspberry pi 4, pretty much exactly following this tutorial. I needed to make some changes to make it work with the pi4, and I'd be up for writing a wikipage if that makes sense for @rbaron as I can imagine that many people have a raspberry pi laying around, possibly also since HomeAssistant is one use case for the parasite. |
To also chime in on the programming debate: |
I just came across the nrfmicro wiki. It's a pretty great summary of using different methods of flashing, including using J-Link, ST-Link, Raspberry Pi or an STM32 board. I added a link to it to our wiki. |
I wanted to add that you can easily flash the hex file using a cheap ST-Link clone and OpenOCD https://github.com/seemoo-lab/openhaystack/wiki/Flashing-nRF-with-OpenOCD---ST-Link |
Hi, just wanted to say I love the idea behind this project, and hope to someday obtain some of these for myself.
I wanted to know if you've ever explored any alternatives to jlink debuggers for programming? Given that these devices aren't really available for sale anywhere (cheaply), if we're expecting everyone to fabricate their own devices, obtaining the debugger is a pretty high hurdle to clear.
The suggested devices seem to be essentially sold out everywhere, what ones available on ebay look to be $50, and they also come with the annoying EDU restriction that sounds like it makes it essentially illegal to turn around and sell any products you make from it.
Given that most end users don't really need "debugging" since we aren't developing the firmware, we just need a way to bit-bang in the boot code. Are there other devices or techniques that could achieve this? I see some cheap ARM debuggers on Ali for ~$8 shipped, any idea if something like those work? Is there any way to just bit-bang the interface with a RPI or ESP32 gpio?
Just wondering if you've ever thought about this, to drive more adoption of this project. For a typical user who might like a handful of these devices (~5?), once you have to acquire your own expensive debugger, it probably becomes cheaper to just buy some MiFlora or something rather than spending the expense to make your own.
Thanks!
The text was updated successfully, but these errors were encountered: