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

spi_master_init never fails on nrf51822 ?

Hi,

I'm trying to connect the nrf51822 chip to an ethernet (W5500 module). For the moment, it fails without error (nothing works). So I start from a simpliest program that just initialize spi:


int main(void)
{
   nrf_gpio_range_cfg_output(12,14);//red
   nrf_gpio_pin_set(14);
   nrf_gpio_pin_set(12);

   spi0_address = spi_master_init(SPI0, SPI_MODE0, false);

   if(spi0_address == 0) {
     nrf_gpio_pin_clear(14);
   } else {
     nrf_gpio_pin_clear(12);
   }
}

spi0_address is never null, even if the pin are not connected !

In spi_master_config.h, the pin are configured:


/*  SPI0 */
#define SPI_PSELSCK0              23  
#define SPI_PSELMOSI0             21 
#define SPI_PSELMISO0             22 
#define SPI_PSELSS0               20 

Is this a normal behaviour or do I have done something wrong ?

Parents
  • The source code for this is available in Source/spi_master, so I'd recommend you to take a look on it. As you can see, there isn't actually any transfer going on, the init method just sets up the peripheral registers correctly. There is hence no way this can fail, and it should always return something that is non-zero.

Reply
  • The source code for this is available in Source/spi_master, so I'd recommend you to take a look on it. As you can see, there isn't actually any transfer going on, the init method just sets up the peripheral registers correctly. There is hence no way this can fail, and it should always return something that is non-zero.

Children
No Data