Hello,
I'm using a BMD200 module (with a nRF51 chip inside) and the custom_board.h provided by Rigado along with their EVK. I'm also using a BMD200 on a board I developed myself but I need to change the pins declared on custom_board.h.
Now, if I use the original custom_board.h from Rigado on my board, the code works just fine. Despite LED, button and TX/RX pins being wrong, the board is advertising and I can connect, disconnect and read/write characteristics. But when I change it to work with the pins I defined on my PCB, I get a APP:ERROR:Fatal log message after "bsp_init()" is called.
I triple checked if I have any conflicts between pins (trying to use the same pin with different purposes) and I don't see any. Using the debugger (Eclipse+JLink) I can't also understand where the code is failing. I guees is somewhere in SoftDevice's code?
This is how I'm connecting the BMD200 module:
This is the original custom_board.h (from Rigado):
#ifndef __BMD200_H__
#define __BMD200_H__
#define LEDS_NUMBER 3
#define LED_RED 1
#define LED_GREEN 24
#define LED_BLUE 25
#define LEDS_LIST { LED_RED, LED_GREEN, LED_BLUE }
#define BSP_LED_0 LED_RED
#define BSP_LED_1 LED_GREEN
#define BSP_LED_2 LED_BLUE
#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 LEDS_MASK (BSP_LED_0_MASK | BSP_LED_1_MASK | BSP_LED_2_MASK)
/* all LEDs are lit when GPIO is high */
#define LEDS_INV_MASK 0
#define BUTTONS_NUMBER 2
#define BUTTON_1 0
#define BUTTON_2 11
#define BUTTON_PULL NRF_GPIO_PIN_PULLUP
#define BUTTONS_LIST { BUTTON_1, BUTTON_2, }
#define BSP_BUTTON_0 BUTTON_1
#define BSP_BUTTON_1 BUTTON_2
#define BSP_BUTTON_0_MASK (1<<BSP_BUTTON_0)
#define BSP_BUTTON_1_MASK (1<<BSP_BUTTON_1)
#define BUTTONS_MASK 0x00000801
#define RX_PIN_NUMBER 9
#define TX_PIN_NUMBER 10
#define CTS_PIN_NUMBER 2
#define RTS_PIN_NUMBER 3
#define HWFC true
#define SPIM0_SCK_PIN 0 /**< SPI clock GPIO pin number. */
#define SPIM0_MOSI_PIN 1 /**< SPI Master Out Slave In GPIO pin number. */
#define SPIM0_MISO_PIN 2 /**< SPI Master In Slave Out GPIO pin number. */
#define SPIM0_SS_PIN 0 /**< SPI Slave Select GPIO pin number. */
// Low frequency clock source to be used by the SoftDevice
#ifdef S210
#define NRF_CLOCK_LFCLKSRC NRF_CLOCK_LFCLKSRC_XTAL_20_PPM
#else
#define NRF_CLOCK_LFCLKSRC {.source = NRF_CLOCK_LF_SRC_XTAL, \
.rc_ctiv = 0, \
.rc_temp_ctiv = 0, \
.xtal_accuracy = NRF_CLOCK_LF_XTAL_ACCURACY_20_PPM}
#endif
#endif // __BMD200_H__
And this is my custom_board.h file (even though I have a single LED, bsp.c needs BSP_LED_1_MASK to be defined, so it's the same as BSP_LED_0_MASK):
#ifndef __BMD200_H__
#define __BMD200_H__
#define LEDS_NUMBER 1
#define LED_RED 10
#define LEDS_LIST { LED_RED }
#define BSP_LED_0 LED_RED
#define BSP_LED_0_MASK (1<<BSP_LED_0)
#define BSP_LED_1_MASK (1<<BSP_LED_0)
#define LEDS_MASK (BSP_LED_0_MASK | BSP_LED_1_MASK )
/* all LEDs are lit when GPIO is high */
#define LEDS_INV_MASK 0
#define BUTTONS_NUMBER 1
#define BUTTON_1 11
#define BUTTON_PULL NRF_GPIO_PIN_PULLUP
#define BUTTONS_LIST { BUTTON_1 }
#define BSP_BUTTON_0 BUTTON_1
#define BSP_BUTTON_0_MASK (1<<BSP_BUTTON_0)
#define BUTTONS_MASK BSP_BUTTON_0_MASK
#define RX_PIN_NUMBER 4
#define TX_PIN_NUMBER 3
#define CTS_PIN_NUMBER 5
#define RTS_PIN_NUMBER 6
#define HWFC false
#define SPIM0_SCK_PIN 0 /**< SPI clock GPIO pin number. */
#define SPIM0_MOSI_PIN 8 /**< SPI Master Out Slave In GPIO pin number. */
#define SPIM0_MISO_PIN 9 /**< SPI Master In Slave Out GPIO pin number. */
#define SPIM0_SS_PIN 0 /**< SPI Slave Select GPIO pin number. */
// Low frequency clock source to be used by the SoftDevice
#ifdef S210
#define NRF_CLOCK_LFCLKSRC NRF_CLOCK_LFCLKSRC_XTAL_20_PPM
#else
#define NRF_CLOCK_LFCLKSRC {.source = NRF_CLOCK_LF_SRC_SYNTH, \
.rc_ctiv = 0, \
.rc_temp_ctiv = 0, \
.xtal_accuracy = NRF_CLOCK_LF_XTAL_ACCURACY_20_PPM}
#endif
#endif // __BMD200_H__
More information:
- I can use my custom_board.h on the EVK, so I guess that's an hardware problem on my board but I can't figure what's going wrong.
- I'm programming my board using the GCC makefile provided by the SDK and a JLink Edu
Help is very much appreciated! Thanks