This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Getting started with nrf51822 modules and st-link.

Hello.

I'm tying to learn nrf51822. I had ordered some modules from ebay and nrf52-dk from local distributor . A week ago I had receive some modules. But local distributor says that nrf52-dk is late and won't delivered before middle of January. So, I'm trying to work with modules and st-link from st32nucleo board. And I had faced the some problems.

Here is that's modules: www.ebay.com/.../192371985227 (E77-2G4M04S)

[1].Have someone know something about it?

As I haven't original j-link, I'm trying to work through st-link (from stm-nucleo board).

As I understand before working with any examples I must flash softdevice into nrf51822 module, and after that I can flash exampls. Currently I have two modules, one of them already was erased few times by me. Another module has stayed with default firmware, but I don't know what is it and what version is it.

[2]. Is it possible to figure out what is contains by default into ROM of that's module?

When I try to flash blank (erased) module, I had faced some issues:

[3]. Into what ROM address a must flash softdevice (for example s130). As I understand, softdevice must be placed before application, and as I suppose, it must be 0x0. And, in this case, application must be plased starts from 0x1B00. Am I right?

[4]. Is it bootloader (or something else) must be placed before softdevice? And if it is, what is it and where I can get it and how a can flash it into ROM?

[5]. Is it possible to get know that softdevice had written (flashed) ok? (considering thats, nrf51822 module hasn't any leds or buttons. just SWCLK, SWDIO, GND, VCC and IO pins)

[6]. I have tried flash softdevice into module (starts from 0x0 ROM address) through st-link (Keil). But after that, a can't flash any examples (starts from 0x1B00) - I've got message "Programming Failed! Error: Flash Download failed - "Cortex-M0"". So, I think I'm missed something but I don't know what.

  • For your nRF51 series:

    devzone.nordicsemi.com/.../

    Sorry - for nRF52:

    devzone.nordicsemi.com/.../

    should be suitable for your mapping to the Nordic device.

  • (yes, as per mon's answer: every basic question like this one was already asked on this forum so search box is your friend!)

  • Sorry, but you don't answer neither of my questions.

    Of course, I've already seen that's post about using st-link. And I was following it when I've tried flash my modules. But I faced the concrete issues and ask about them in this post.

  • Then let's take it one by one:

    • [1].Have someone know something about it? - yes, as many ST-Link and nRF5x posts as many you find through search function on this forum.
    • [2]. Is it possible to figure out what is contains by default into ROM of that's module? - yes, as lon as flash (NVM) isn't read-back protected you can "dump" it (or "read" if you want) by any SWD programmer which has that feature (ST-Link should be one of them).
    • [3]. Into what ROM address a must flash softdevice (for example s130). - as you can read in all documentation and tutorials flash (NVM) of all nRF5x chips strts at address 0x00000000, there you need to flash the soft device. But because Soft Device comes in HEX format which already contains addressing you typically never care about this. Then depending on Soft Device type and version you need to link your application FW on right address. Again it's the best to generate HEX file which takes care about addresses but if you insist on pure BIN output then you need to look to particular Soft Device release notes to get the right address.
    • [4]. Is it bootloader (or something else) must be placed before softdevice? - no, bootloader isn't necessary as all ARM Cortex-M chips are typically programmable by SWD/JTAG interface. You can develop your own bootloader (e.g. to upgrade stack and application code later in the field over radio or wired interface such as UART/USB/etc. without SWD programmer such as J-Link or ST-Link) or adopt some of Nordic bootloader examples. However that is typically loaded to higher memory address (ten study some of these examples and blog posts).
    • [5]. Is it possible to get know that softdevice had written (flashed) ok? - every SWD programmer (including ST-Link) can verify written code right after flashing so you should use that way. Soft Device contains just radio stack implementation and other auxiliary features but without application code running on top it does absolutely nothing.
    • [6]. I've got message "Programming Failed! Error: Flash Download failed - "Cortex-M0"" - there are several things which might be done by bloody Keil on the background. You will need to try the whole flashing procedure (preferably of some HEX binaries delivered with nRF5 SDK by Nordic which are known to be 100% working) by some utility which allows debug logging (ST provides flashing SW of the same name as ST-Link if I'm correct, but you can face issues with chip identification and memory layout, also OpenOCD should work with ST-Link and nRF5x chips).

    Good luck

    1. In my question I mean concrete module (e77-2g4m04s by cdebyte.com). There was some doubts about modules from China and some chance to receive a fake. But I was took off rf shield from module and looks like all is ok inside. There is NRF51822 QFAAH1 inside.

    2. Yes, a know about dump. But I mean, is there exist something way to get know something about contained firmware. E.g. is there places softdevice or not. And what is version of softdevce there if it is.

    3. Thanks. This explanation is very usfull for my undestanding of this case.

    4. Got it. Thanks.

    5. Yes. It is possible to verify written code right after flashing. But my question was about the way to check workability of written firmware. E.g. through UART/SWD/smth else debug interface thats would provide command line interface with softdevice or something else. It seems that this is not so.

    6. As I was wrote above, my nRF52-DK is late. And my st-link isn't allow fully-featured work with nordic chips. So, seems to simples way is wait for original development kit and continue learning after receiving it.

    Thanks for answers. Although the problem did not dare, I clarified some theoretical aspects.

Related