nRF52810 uart ERROR 4 [NRF_ERROR_NO_MEM]

Hi,

I'm using ble_app_uart to test AT.

When I sending a buffer

reset_buff[10]="AT+RESET\r\n";

RTT log showing an error

<error> app: ERROR 4 [NRF_ERROR_NO_MEM] at ..\..\..\main.c:561
00>
00> PC at: 0x0001EC51
00>
00> <error> app: End of error report

Here is the code

/**@brief   Function for handling app_uart events.
 *
 * @details This function will receive a single character from the app_uart module and append it to
 *          a string. The string will be be sent over BLE when the last character received was a
 *          'new line' '\n' (hex 0x0A) or if the string has reached the maximum data length.
 */
/**@snippet [Handling the data received over UART] */
void uart_event_handle(app_uart_evt_t * p_event)
{
    static uint8_t data_array[256];
    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++;
//						NRF_LOG_INFO("%02x",data_array[index]);
//            if ((data_array[index - 1] == '\n') ||
//                (data_array[index - 1] == '\r') ||
//                (index >= m_ble_nus_max_data_len))
//            {
//                if (index > 1)
//                {
//									
//                    NRF_LOG_DEBUG("Ready to send data over BLE NUS");
//                    NRF_LOG_HEXDUMP_DEBUG(data_array, index);

//                    do
//                    {
//                        uint16_t length = (uint16_t)index;
//                        err_code = ble_nus_data_send(&m_nus, data_array, &length, m_conn_handle);
//                        if ((err_code != NRF_ERROR_INVALID_STATE) &&
//                            (err_code != NRF_ERROR_RESOURCES) &&
//                            (err_code != NRF_ERROR_NOT_FOUND))
//                        {
//                            APP_ERROR_CHECK(err_code);
//                        }
//                    } while (err_code == NRF_ERROR_RESOURCES);
//                }

//                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;
    }
}

static void uart_init(void)
{
    uint32_t                     err_code;
    app_uart_comm_params_t const comm_params =
    {
        .rx_pin_no    = 18,
        .tx_pin_no    = 20,
        .rts_pin_no   = NULL,
        .cts_pin_no   = NULL,
        .flow_control = APP_UART_FLOW_CONTROL_DISABLED,
        .use_parity   = false,
#if defined (UART_PRESENT)
        .baud_rate    = NRF_UART_BAUDRATE_9600
#else
        .baud_rate    = NRF_UARTE_BAUDRATE_115200
#endif
    };

    APP_UART_FIFO_INIT(&comm_params,
                       UART_RX_BUF_SIZE,
                       UART_TX_BUF_SIZE,
                       uart_event_handle,
                       APP_IRQ_PRIORITY_LOWEST,
                       err_code);
    APP_ERROR_CHECK(err_code);
}
/**@brief Application main function.
 */
int main(void)
{
    bool erase_bonds;
	uint8_t reset_buff[10]="AT+RESET\r\n";

    // Initialize.
    uart_init();
    log_init();
    timers_init();
    buttons_leds_init(&erase_bonds);
    power_management_init();
    ble_stack_init();
    gap_params_init();
    gatt_init();
    services_init();
    advertising_init();
    conn_params_init();

    // Start execution.
//    printf("\r\nUART started.\r\n");
    NRF_LOG_INFO("Debug logging for UART over RTT started.");
    advertising_start();
		for(int i=0;i<10;i++)
		{
			  UNUSED_VARIABLE(app_uart_put(reset_buff[i]));
		}

    // Enter main loop.
    for (;;)
    {
        idle_state_handle();
    }
}

Parents
  • The error message you're seeing is pulled from line 567 in your main.c file. What function is called in line 567 here? If you go to where this function is defined, comments generally provide some information on what various errors mean. Try checking out what NRF_ERROR_NO_MEM means for the function that returns this error and see if you understand what you need to do. It looks like you haven't added all of the code, so it's impossible to see which function is returning this error.

    Best regards,

    Simon

Reply
  • The error message you're seeing is pulled from line 567 in your main.c file. What function is called in line 567 here? If you go to where this function is defined, comments generally provide some information on what various errors mean. Try checking out what NRF_ERROR_NO_MEM means for the function that returns this error and see if you understand what you need to do. It looks like you haven't added all of the code, so it's impossible to see which function is returning this error.

    Best regards,

    Simon

Children
No Data
Related