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

Problems with Programming nRF51822 customized board

Hi guys, me again.

I was very confused with my current process on developing with nrf chip now... so I would like to post my develop step and some problems I had so maybe you could give me some advises. I think I maybe stuck in my own circle.

I'm sorry to give such a long post here.

I have read through the tutorial about the nrf51 DK and BLE and many post about changing clock source for example. For the DK, I could successfully load the code to the DK, for example the UART transmission example and use my phone to communicate with it.

For the step for developing the DK, I first load the softdevice using command line tool, the softdevice I load to the DK is from SDK 12.2, s130, version is 2.0.1. Then I open the example in Keil, build up and then load to the DK, it was fine.

So, then I would like to try the code with my own board. First, I was using the nrf51822 module from Taiyo Yuden Inc, which the board them made doesn't have an external clock source, so I have changed the clock source to the internal RC clock source with the following code in example code in Keil5.

//set up clock source
 nrf_clock_lf_cfg_t rc_cfg = 
{
    .source = NRF_CLOCK_LF_SRC_RC,
    .rc_ctiv = 16,
    .rc_temp_ctiv = 2,
 };

// Initialize SoftDevice.
SOFTDEVICE_HANDLER_INIT(&rc_cfg, NULL);

For the board I'm using, please refer to the following image: image description

I connect the SWD interface to the Jlink and since the board doesn't have the reset and SWO, I only use the SWDIO and SWCLK to the Jlink. Then with the Jlink connected, I used command line tool to program the softdevice to this board. The command line tool shows the softdevice has been programmed. image description

Then I open the example in Keil5, for this time using the uart example also. I build and then load to the board. image description

After this, I open my phone and use the nordic app to scan the board, there is nothing. For my point, I was trying to see if I could program the board to be scanable and also can be connected with phone, then develop some other functionalities base on that, but I could not see the board.

Did I do anything wrong with the procedure?


That was what I have done with the Taiyo Yuden board. Since the board has all the pins under the chip, I thought maybe there is something wrong with my soldering, so I used another chip which all the pins are on the side of the board so I could see actually I have soldered them correctly. The board I'm using is this one.

For this board, I was trying some similar procedure.

I first used the nRFGo studio to program the softdevice, same version from the previous one. image description

Then I tried to load the example code from Keil, but I got an error that the Flash Downloaded fail. At first, the error says Flash Downloaded fail - could no open XXX\XXX\XXX.axf file. image description ....I was so confuse by now....

Another concern is that, if I change the device to the nrf51822_xxAA which I used with the board, the device became red and there is no update option to use for the files. image description image description

It was a long post, but I you have any idea which step I did wrong, please let me know.

Thanks

  • Wow, that is a lot of detail. There is a lot that can go wrong when you are doing a build.

    1. If it shows red by the arm_startup then you don't have the correct software packs installed. There is a button to "manage the run-environment" in keil. Use that function to check/update the software packs. All version of the packs are on the nordic website.
    2. On nRFGo saying it couldn't load a file, then it did not establish communications with the target board. This could be because, of improper connections, wrong Vdd voltage for target, target stuck in run environment and not responding to the SWD port, or maybe just bad usb driver for segger.
    3. On the problems with the UART app not showing up on smartphone. Make sure you are using the correct version of the UART app. It should be the peripheral version. Also make sure the board is responding on the com port. Just open a terminal connection with it.

    It's a pity your module doesn't have the 32k crystal, it make the learning process easier since you can use the precompiled examples first while you figure out the build environment.

  • Actually that is not the nRFGo, the Keil says it could not load the code.

    I was trying the code with DK but still not loading. For the UART example, I used the one from the SDK 12.2, s130, version is 2.0.1, peripheral version, first with my NR51 DK, it works fine, but if I load with my own board, it never shows up.

    I was trying to debug the code also, the code stuck in the loop actually. But now, everything goes wrong. I could not even load the code to the board, either DK or my own board. For the MDK, I have install the latest version from the website already, nRF5 MDK 8.15.0 version, still not working.

  • I wouldn't recommend starting off with having Keil load the code. Much more can go wrong for the beginner. Just compile and use nRFGo to load. Once you get it working then you can play with the debug interface for Keil.

    Also, when people work in Keil they don't realize that the SoftDevice isn't part of the build. You have to load the precompiled SD separately.

    So, I would recommend you start with a virgin copy of the UART example to fix any changes you might have made. Then fix only the section for RTC selection, compile and load from nRFGo.

    And definitely don't touch the target chip selection interface since that will clear the ROM/RAM settings. The PCA10028 project should already be set up for nRF51822.

  • Thanks for your quick reply. So, to my understanding of the nRFGo and nRF chip, I need to first load the softdevice which I like a bridge connecting the application code with the physical layer of the chip. I was trying to do that with the nRFGo, which I load the softdevice using the program softdevie option in the nRFGo studio, and the nload the hex file with the program application option to program the application code. But when I click the application, the studio says something like 'you cannot program the chip because the application take space of the softdevice, either earase the chip and program or use the program softdevice. Since I have follow the tutorial of using the DK, that's why I also use the keil for my own board programming.

  • That is why you should use nRFGo as a beginner. The error you received was because the ROM/RAM settings in your project are wrong. Only nRFGo would report this error.

    So, yes the Softdevice is the thing that knows how to talk bluetooth and acts as the bridge between application code and all things bluetooth. Both the SD and the app code need to be loaded.

    You probably messed up the ROM/RAM settings when you selected the chip variant. Either start with a clean install of the example or look up the rom/ram settings in the SD notes.

Related