This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

nRF52 SPI loops when waiting for NRF_SPI_EVENT_READY after initialisation

So I switched from Bluemod+S (nRF51822) to Bluemod+S42 (nRF52832) on my custom board and am trying to adapt my existing code to work on the newer model. Apart from various obvious and some not so obvious changes I managed to figure out myself, I'm now stuck on the initialization of the SPI:

void hal_spi_init()
{
	nrf_drv_spi_config_t spi_config = NRF_DRV_SPI_DEFAULT_CONFIG; 
	spi_config.ss_pin   = NRF_DRV_SPI_PIN_NOT_USED; //slave select is handled seperatly
	spi_config.miso_pin = SPI_MISO_PIN; //defined in  custom_board.h
	spi_config.mosi_pin = SPI_MOSI_PIN; //defined in  custom_board.h
	spi_config.sck_pin  = SPI_SCK_PIN; //defined in  custom_board.h
	uint32_t err_code = nrf_drv_spi_init(&spi, &spi_config, NULL);
	APP_ERROR_CHECK(err_code); //without setting an event handler, the transfer function just waits until the transmission is finished
}

which works without any error. Subsequently I'm trying to send data to the slave, but the nrf_drv_spi_transfer function loops indefinitely at while (!nrf_spi_event_check(p_spi, NRF_SPI_EVENT_READY)) {} in spi_xfer.

It did (still does) work on my old setup with the nRF51822 and I don't understand whats different now.

I already found similar questions here and here but those didn't help me.

I'm using S132 & SDK 12.3.0 (S130 & SDK 12.3.0 on the old setup)

Parents
  • Are you able to try to disconnect the slave from the SPI pins? I have tried to reproduce the issue and I'm seeing some similar issues too. However, it seems to be caused by the slave I use since the SPI works when I disconnect it.

    Note that P0.00 is one of the two pins used for the Low Frequency crystal, but looking in your module's datasheet it doesn't seem to have one and it shouldn't be a problem. I have tried pin 0 on an nRF52 (without disconnecting the external crystal actually) and it seems to work.

Reply
  • Are you able to try to disconnect the slave from the SPI pins? I have tried to reproduce the issue and I'm seeing some similar issues too. However, it seems to be caused by the slave I use since the SPI works when I disconnect it.

    Note that P0.00 is one of the two pins used for the Low Frequency crystal, but looking in your module's datasheet it doesn't seem to have one and it shouldn't be a problem. I have tried pin 0 on an nRF52 (without disconnecting the external crystal actually) and it seems to work.

Children
No Data
Related