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

Even a simple on/off led code cannot run on minewtech Minibeacon nRF51822

hi,

    I am using nRF51-DK board as external programmer  to program Minewtech Minibeacon having nRF51822 chipset (QFABC1, 128KB flash and 16KB RAM).

Tools:

SDK: nRF51_SDK_10.0.0_dc26b5e

ARM tools: 7 2017-q4-major

I have used very simple code (modified blinky code from examples): just on and off led periodically

############################# main.c ############

*/

#include <stdbool.h>
#include <stdint.h>
#include "nrf_delay.h"
#include "nrf_gpio.h"
#include "boards.h"

const uint8_t leds_list[LEDS_NUMBER] = LEDS_LIST;

/**
* @brief Function for application main entry.
*/
int main(void)
{
// Configure LED-pins as outputs.
LEDS_CONFIGURE(LEDS_MASK);

// Toggle LEDs.
while (true)
{
for (int i = 0; i < LEDS_NUMBER; i++)
{
LEDS_INVERT(1 << leds_list[i]);
nrf_delay_ms(500);
}
}
}

###################

I have also changed pca10028.h to reflect I/O pin on my Minibeacon

##################################### pca10028.h

#ifndef PCA10028_H
#define PCA10028_H

// LEDs definitions for PCA10028
//#define LEDS_NUMBER 4
#define LEDS_NUMBER 1
//

//#define LED_START 21
//#define LED_1 21
#define LED_START 12
#define LED_1 12
#define LED_2 22
#define LED_3 23
#define LED_4 24
#define LED_STOP 24

//#define LEDS_LIST { LED_1, LED_2, LED_3, LED_4 }
#define LEDS_LIST { LED_1 }

#define BSP_LED_0 LED_1
#define BSP_LED_1 LED_2
#define BSP_LED_2 LED_3
#define BSP_LED_3 LED_4

#define BSP_LED_0_MASK (1<<BSP_LED_0)
#define BSP_LED_1_MASK (1<<BSP_LED_1)
#define BSP_LED_2_MASK (1<<BSP_LED_2)
#define BSP_LED_3_MASK (1<<BSP_LED_3)

//#define LEDS_MASK (BSP_LED_0_MASK | BSP_LED_1_MASK | BSP_LED_2_MASK | BSP_LED_3_MASK)
#define LEDS_MASK (BSP_LED_0_MASK)

########################################

I have also modified blinky_gcc_nrf51.ld to reflect nRF51822 chipset QFABC1 with 128KB flash and 16KB RAM

#########################

/* Linker script to configure memory regions. */

SEARCH_DIR(.)
GROUP(-lgcc -lc -lnosys)

MEMORY
{
FLASH (rx) : ORIGIN = 0x0, LENGTH = 0x20000
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x4000
}

SECTIONS
{
.fs_data_out ALIGN(4):
{
PROVIDE( __start_fs_data = .);
KEEP(*(fs_data))
PROVIDE( __stop_fs_data = .);
} = 0
}

INCLUDE "nrf5x_common.ld"

######################

nRFgo Studio correctly detected my Minibeacon and also successfully programed Minibeacon. 

##########

However the code is not working on Minewtech MiniBeacon. 

The same code work correctly on nrf51-DK with nRF51422 chipset

###################################################### Mbed

I have also tried following code with mbed online compiler: 

This code works only if I have choosen "nRF51822 mbed Kit" as a platform. If I chose nrf51 DK as platform it does not work either

###################

#include "mbed.h"

DigitalOut myled3(P0_12);
DigitalOut myled2(P0_15);
DigitalOut myled1(P0_16);

int main() {
while(1) {
myled3 = 1;
myled2 = 1;
myled1 = 1;

wait(0.5);

myled3 = 0;
myled2 = 0;
myled1 = 0;

wait(1);
}
}

#############

For my BS projects I have to reprogram beacons. 

Any help will be highly appreciated.....

Related