Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

NRF_BREAKPOINT_COND error on nrf52840

I am using nRF52810 with SDK 17.0.2 with UART function but I am getting error NRF_BREAKPOINT_COND. I also tried running the uart example of the SDK but the error still occurs. I am using rak5010 development board. It includes a nrf52840 microcontroller and LTE-BG96 module. Nrf52840 and bg96 are connected to each other via uart communication.

Has anyone had this problem before? please help me to solve this problem!

Thank you everyone for reading!

below is my program, I use segger embedded studio

#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include "app_uart.h"
#include "app_error.h"
#include "nrf_delay.h"
#include "nrf.h"
#include "bsp.h"
#if defined (UART_PRESENT)
#include "nrf_uart.h"
#endif
#if defined (UARTE_PRESENT)
#include "nrf_uarte.h"
#endif

#include "string.h"
#include "nrf_drv_uart.h"

//#define ENABLE_LOOPBACK_TEST  /**< if defined, then this example will be a loopback test, which means that TX should be connected to RX to get data loopback. */

#define MAX_TEST_DATA_BYTES     (15U)                /**< max number of test bytes to be used for tx and rx. */
#define UART_TX_BUF_SIZE 256                         /**< UART TX buffer size. */
#define UART_RX_BUF_SIZE 256                         /**< UART RX buffer size. */

/*--- My code ---*/
#define BLE_NUS_MAX_DATA_LEN 128

#define LED 12

#define bg96_W_DISABLE 29
#define bg96_RESET     28
#define bg96_PWRKEY    2
#define bg96_GPS_EN    39
uint8_t temp_array[MAX_TEST_DATA_BYTES];

uint8_t data_array[BLE_NUS_MAX_DATA_LEN];

void uart_init(void);
void uart_callback(uint8_t * p_data, uint8_t length);
void uart_error_handle(app_uart_evt_t * p_event);

bool at_send(uint8_t * data, uint8_t size);
uint8_t at_recv(uint8_t * target);

void bg96_init(void);
void bg96_ping(void);
/*---------------*/
int main(void)
{
  nrf_gpio_cfg_output(LED);

  uart_init();
  bg96_init();
  while(1)
  {
    nrf_gpio_pin_toggle(LED);
    nrf_delay_ms(100);
  }
}

void uart_init(void)
{
    ret_code_t err_code;

    app_uart_comm_params_t const comm_params =
    {
        .rx_pin_no    = RX_PIN_NUMBER,
        .tx_pin_no    = TX_PIN_NUMBER,
        .rts_pin_no   = RTS_PIN_NUMBER,
        .cts_pin_no   = CTS_PIN_NUMBER,
        .flow_control = APP_UART_FLOW_CONTROL_DISABLED,
        .use_parity   = false,
        .baud_rate    = UART_BAUDRATE_BAUDRATE_Baud115200
    };
    APP_UART_FIFO_INIT(&comm_params,
                       UART_RX_BUF_SIZE,
                       UART_TX_BUF_SIZE,
                       uart_error_handle,
                       APP_IRQ_PRIORITY_LOWEST,
                       err_code);

    APP_ERROR_CHECK(err_code);
}
void uart_callback(uint8_t * p_data, uint8_t length)
{
    // Todo: Process 'data_array' of size 'length'.
}
void uart_error_handle(app_uart_evt_t * p_event)
{
    static uint8_t index = 0;
    uint32_t       err_code;

    switch (p_event->evt_type)
    {
        case APP_UART_DATA_READY:

            UNUSED_VARIABLE(app_uart_get(&data_array[index]));
            index++;

            if ((data_array[index - 1] == '\n') || (index >= BLE_NUS_MAX_DATA_LEN))
            {
                if(index > 1)
                {
                    strcat(temp_array,data_array);
                    memset(data_array,0,BLE_NUS_MAX_DATA_LEN);
                    index = 0;
                }
            }
            break;

        case APP_UART_COMMUNICATION_ERROR:
            APP_ERROR_HANDLER(p_event->data.error_communication);
            break;

        case APP_UART_FIFO_ERROR:
            APP_ERROR_HANDLER(p_event->data.error_code);
            break;

        default:
            break;
    }
}
bool at_send(uint8_t * data, uint8_t size)
{
    ret_code_t ret_val;

    for (uint32_t i = 0; i < size; i++)
    {
        do
        {
            ret_val = app_uart_put(data[i]);
            if ((ret_val != NRF_SUCCESS) && (ret_val != NRF_ERROR_BUSY))
            {
                printf("app_uart_put failed for index 0x%04x.\n", i);
                //NRF_LOG_ERROR("app_uart_put failed for index 0x%04x.", i);
                //APP_ERROR_CHECK(ret_val);
            }
        } while (ret_val == NRF_ERROR_BUSY);
    }

    return true;
}
uint8_t at_recv(uint8_t * target)
{
    uint8_t result;
    nrf_delay_ms(500);
    result = strstr(temp_array, target); // temp_array is the data_array of uart_event_handle (line 425)

    memset(temp_array,0,MAX_TEST_DATA_BYTES);
    return result;
}
void bg96_init(void)
{
  nrf_gpio_cfg_output(bg96_W_DISABLE);
  nrf_gpio_cfg_output(bg96_RESET);
  nrf_gpio_cfg_output(bg96_PWRKEY);
  nrf_gpio_cfg_output(bg96_GPS_EN);

  nrf_gpio_pin_clear(bg96_RESET);
  nrf_gpio_pin_set(bg96_PWRKEY);
  nrf_gpio_pin_set(bg96_W_DISABLE);

  nrf_delay_ms(2000);

  nrf_gpio_pin_clear(bg96_PWRKEY);
  nrf_gpio_pin_set(bg96_GPS_EN);
}
void bg96_ping(void)
{
  uint8_t msg[] = "AT\r";
  at_send(msg, sizeof(msg));
}
/** @} */

Parents
  • Hello,

    NRF_BREAKPOINT_COND

    This likely means that a non-NRF_SUCCESS error code has been passed to an APP_ERROR_CHECK, so one of your functions have failed.

    You mention that they are connected using UART - are you able to use the RTT logger backend on this development kit?
    If you make sure to have DEBUG defined in your preprocessor defines, like shown in the included image, the logger will output a detailed error message whenever a non-NRF_SUCCESS error code is passed to an APP_ERROR_CHECK.

    Could you configure the logger to use the RTT backend, and see if you are able to get this logging?
    This will make debugging the issue a lot easier. 

    Looking forward to resolve this issue together!

    Best regards,
    Karl

Reply
  • Hello,

    NRF_BREAKPOINT_COND

    This likely means that a non-NRF_SUCCESS error code has been passed to an APP_ERROR_CHECK, so one of your functions have failed.

    You mention that they are connected using UART - are you able to use the RTT logger backend on this development kit?
    If you make sure to have DEBUG defined in your preprocessor defines, like shown in the included image, the logger will output a detailed error message whenever a non-NRF_SUCCESS error code is passed to an APP_ERROR_CHECK.

    Could you configure the logger to use the RTT backend, and see if you are able to get this logging?
    This will make debugging the issue a lot easier. 

    Looking forward to resolve this issue together!

    Best regards,
    Karl

Children
No Data
Related