Hi:
I am using nrf52832 and I met a strange problem:
SDK version: nRF5_SDK_12.2.0_f012efa
First experiment(NO BLE):
using example peripheral/timer:
code change in main.c as the follows:
bool g_timer_Flag = true;
/**
* @brief Handler for timer events.
*/
void timer_led_event_handler(nrf_timer_event_t event_type, void* p_context)
{
static uint32_t i;
uint32_t led_to_invert = ((i++) % LEDS_NUMBER);
switch (event_type)
{
case NRF_TIMER_EVENT_COMPARE0:
bsp_board_led_invert(led_to_invert);
if(true == g_timer_Flag)
{
g_timer_Flag = false;
}
break;
default:
//Do nothing.
break;
}
}
then set a breakpoint at line g_timer_Flag = false;
debug perform normally enter breakline only once
Second experiment(Using BLE):
using example ble_peripheral/ble_app_uart
code change as the follows:
bool g_timer_Flag = true;
/**@brief Function for handling the data from the Nordic UART Service.
*
* @details This function will process the data received from the Nordic UART BLE Service and send
* it to the UART module.
*
* @param[in] p_nus Nordic UART Service structure.
* @param[in] p_data Data to be send to UART module.
* @param[in] length Length of the data.
*/
/**@snippet [Handling the data received over BLE] */
static void nus_data_handler(ble_nus_t * p_nus, uint8_t * p_data, uint16_t length)
{
ble_nus_string_send(&m_nus, p_data, length); //test send data back to nus app
if(true == g_timer_Flag)
{
g_timer_Flag = false;
}
/*for (uint32_t i = 0; i < length; i++)
{
while (app_uart_put(p_data[i]) != NRF_SUCCESS);
}
while (app_uart_put('\r') != NRF_SUCCESS);
while (app_uart_put('\n') != NRF_SUCCESS);
*/
}
then set a breakpoint at line g_timer_Flag = false;
start debug:
the strange phenomenon happens: break happen every times I received a char from nus event
reason I guess:
-
RAM loss when user app finished because of softDevice memory strategy
-
program I write has bug (that's impossible )
-
Help me find it ,thank you very much!