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

mobile phone pair nRF52811 and send data to use spi

Hello,

SDK:15.3

If not pair with moblic phone, spi is normal

And obile phone pair 52811 to send data, that also normal

But I want to integrate,  then 52811 is NRF_BREAKPOINT_COND

Although my debug method is not very good, but still can see the process

static void nus_data_handler(ble_nus_evt_t * p_evt)	
	if (p_evt->type == BLE_NUS_EVT_RX_DATA)
    {
		uint8_t my_ble_reciver_data[20];

        NRF_LOG_DEBUG("Received data from BLE NUS. Writing data on UART.");
        NRF_LOG_HEXDUMP_DEBUG(p_evt->params.rx_data.p_data, p_evt->params.rx_data.length);

        for (uint32_t i = 0; i < p_evt->params.rx_data.length; i++)
        {
			my_ble_reciver_data[i] = p_evt->params.rx_data.p_data[i]; 
        }
			
		if (my_ble_reciver_data[0] == 0x01)	
    		myTest();
				
		...
    }
}
void myTest(void)
{	

	spi_tx_buf[0] = 0x03; 
	
	spi_xfer_done = false; 

	app_uart_put(0x01); // test chip no crash
					
	nrf_gpio_pin_clear(SPI_SS_PIN); // error:NRF_BREAKPOINT_COND

	app_uart_put(0x02); // test chip no crash
	
	nrf_drv_spi_transfer(&spi, spi_tx_buf, valueLenght, spi_rx_buf, valueLenght);

	app_uart_put(0x03); // test chip no crash
	
	while (!spi_xfer_done)
	{
			__WFE();
	}
	
	app_uart_put(0x04); // test chip no crash
								
	nrf_gpio_pin_set(SPI_SS_PIN); 
	
	app_uart_put(0x05); // test chip no crash
}

Why does nrf_gpio_pin_clear crash?

I only see USART print 0x01, did not see print 0x02

Another question, does keyword "while" in myTest function affect ble?

thanks

Related