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

nrf9160 spi error - 5.

Dear Sir.

I am using Master SPI to drive 2 slaves.

Both spi are referenced within Interrupt routine ,

When both spi;s slave are referenced I get an error 

err = spi_transceive(spi_dev3, &spi_cfg_afe4900, &tx, &rx);

if (err) {
printk("SPI error: %d\n", err);
}

Errro = -5 .

The spi is configured as follows.

&spi3 {
status = "okay";
compatible = "nordic,nrf-spim";
sck-pin = <31>;
mosi-pin = <9>;
miso-pin = <30>;
cs-gpios = <&gpio0 26 1>,<&gpio0 15 1>;
};

// Main.

struct spi_cs_control afe4900_spi_cs = {
.gpio_pin = 26 , /*CS_PIN_NUM(CONFIG_ST25R3911B_SPI_PORT), */
.delay = 1, /* 8T_NCS_SCLK */
};

struct spi_config spi_cfg_afe4900 = {
.operation = SPI_OP_MODE_MASTER | SPI_WORD_SET(8) | SPI_TRANSFER_MSB |
SPI_MODE_CPOL | SPI_MODE_CPHA ,
.frequency = 7000000,
.slave = 0,
.cs = &afe4900_spi_cs,
};


struct spi_cs_control flash_spi_cs = {
.gpio_pin = 15 , /*CS_PIN_NUM(CONFIG_ST25R3911B_SPI_PORT), */
.delay = 1, /* 8T_NCS_SCLK */
};

struct spi_config spi_cfg_flash = { // ****** NOTICE ME! ********
.operation = SPI_OP_MODE_MASTER | SPI_WORD_SET(8) | SPI_TRANSFER_MSB |
SPI_MODE_CPOL | SPI_MODE_CPHA ,
.frequency = 7000000,
.slave = 0,
.cs = &flash_spi_cs,
};

// Init.

afe4900_spi_cs.gpio_dev = device_get_binding("GPIO_0");
afe4900_spi_cs.gpio_pin = 26;
afe4900_spi_cs.delay = 0;

flash_spi_cs.gpio_dev = device_get_binding("GPIO_0");
flash_spi_cs.gpio_pin = 15;
flash_spi_cs.delay = 0;

// Interrupt

         SPI_read_continuous(0x2a,2);   ( cs == 26 )
         flash_page_counter += afe4900_mem_chunk;


        if(afe4900_int_counter == 30)
        {
            MT25qlxx_WriteEnable();   ( cs == 15 )
            Wait4EraeWrite();               ( cs == 15 )
        }



       if(++afe4900_int_counter >= 40)
       {

             MT25qlxx_WriteFullPage(&flash_buffer[flash_bank][flash_section_counter * 0x100],0);    ( cs == 15 )

      }

Onle when  one slave is enabled   cs == 26 or cs == 15 , I do not get the error -5.

What  is the meaning of it ?.

Thanks

Parents Reply Children
Related