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

SPI 2 Channels

Dear Sir .

I have on my custom board 2 spi , spi1 and spi3.

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

&spi1 {
status = "okay";
compatible = "nordic,nrf-spim";
sck-pin = <3>;
mosi-pin = <8>;
miso-pin = <5>;
cs-gpios = <&gpio0 4 1>;
};

The spi works within an interrupt and spi3 works fine with 2 slaves.

void AFE4900_Interrupt(struct device *gpiob, struct gpio_callback *cb,u32_t pins)
{
     unsigned char a;


switch(_AFE4900_RECIPE.test_type)
{
case none: if(_AFE4900_AQUIRE_MODE.aquire_mode == afe4900_aquire_sample)
{
        SPI_read_continuous(0x2a,2);
        flash_page_counter += afe4900_mem_chunk;



       if(++afe4900_int_counter >= 40)
       {
          ReadAccelerometerXYZ();

          MT25qlxx_WriteEnable();

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

           flash_section_counter++;
           flash_page_counter += afe4900_mem_chunk;


            afe4900_int_counter = 0;
           flash_page_counter = 0;      

   }
}

 Routiunes SPI_read_continuous(0x2a,2); , MT25qlxx_WriteEnable(); , MT25qlxx_WriteFullPage(&flash_buffer[flash_bank][flash_section_counter * 0x100],0);

SPI_read_continuous(0x2a,2);    works with spi3  1st cs, 

 MT25qlxx_WriteEnable();

 MT25qlxx_WriteFullPage(&flash_buffer[flash_bank][flash_section_counter * 0x100],0);   works with spi3  2nd cs, 

ReadAccelerometerXYZ(); works with spi1.

As long as only one spi works 1 or 3 , The spi works fine ,  ( I comment out the unrelated spi call ).

When the 2 spi works 1 and 3 , The system is stuck after the first interrupt .

 

The Interrupt occurs every 2 mSec , there is no time overflow .

What can cause this phenomena ? 

Attached a scree shot , the top is spi3 , the bottom is spi1 , after 1 interrupt the system is stuck

Please Advise.

Related