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

nrf52:SPI master with softDevice can not work

Hi, nrf52832, softdevice:S132 My SPI master program can initialize the SD Card succefully. But, when I put it into the examples of ble_app_uart on nRF5_SDK_11.0.0_89a8197, it can not work. It write a data through SPI, but can not receive any ack. Its spi_event_handler not been called. Why? The following is some code of the main function:

int main(void)
{
    uint32_t err_code;
    bool erase_bonds;
	
    APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_OP_QUEUE_SIZE, false);
    uart_init();
    buttons_leds_init(&erase_bonds);
	   
    ble_stack_init();	
    gap_params_init();	 
    services_init();	
    advertising_init(); 
    conn_params_init();	

    printf("\r\nUART Start!\r\n");
    err_code = ble_advertising_start(BLE_ADV_MODE_FAST);
    APP_ERROR_CHECK(err_code);
   SDHost_Test();

for();
}
........

void spi_event_handler(nrf_drv_spi_evt_t const * p_event)
{
    spi_xfer_done = true;
}

u8 SPI1_WriteOneByte(u8 TxData)
{
    uint8_t spi_txbuf = TxData;

	
	spi_xfer_done = false;		
    nrf_drv_spi_transfer(&m_spi_master, &spi_txbuf, 1, NULL, 0);
	while (!spi_xfer_done)
	{
	   __WFE();
	}

	return true;

}

image description

Parents Reply Children
Related