Post Go back to editing

How to set the interrupt nested program for link port and SPI on ADSP215xx platform?

Category: Software
Product Number: ADSP-21565
Software Version: CCES2.10.1

We are developing a AMP product with 2 ADSP21565. The overall structure of the system is as picture below. Where in the picture, the link port is used to transfer audio data between DSP1 and DSP2. And the SPI_2 is used for DSP1 to boot from Flash and flashing the Flash when doing OTA upgrading; SPI_1 is used to send tuning data and OTA flashing data from MCU to DSP1. 

To make the link port, SPI_1 work and take less workload of DSP1, we configure all of them working in interrupt way. Codes below are the setting of link port of DSP1:

The callback function of the link port is implemented as below:

And the configure of SPI_1 is as below:

Codes below are the callback function implements for SPI_1:

Now, when debugging SPI_1 and link port separately, either link port or SPI_1 can work properly. But when we used link port and SPI_1 together, only link port callback can be called, and the callback function of SPI_1 will never be reached. So, we think that we need to reset the interrupt priority of the interrupts of link port and SPI_1. Then, we set the interrupt priority as the following way, so that interrupt SPI_1 will be higher than that of link port:

         

     But the problem is still unsolved.  So, could you tell us where is the problem? Why the interrupt priority seems invalid? Do you have any demo projects that can make link port and SPI interrupts work together? 

Thank you!

  • Hi,

    We understood that utilizing LinkPort and SPI data transfer at the same time is causing you problems. We verified that LinkPort and SPI callback are operating as intended on our end.

    We saw in your shared configuration snippet that you missed configuring SPU configuration for SPI DMA channels while configuring it for LinkPort DMA channels. Add the configuration listed below to your code if it isn't already configured.

    adi_spu_EnableMasterSlaveSecure(76, true, true)
    adi_spu_EnableMasterSlaveSecure(80, true, true)

    Please check the pin MUX configuration of the SPI1. Also, please let us know the SPI clock configuration and confirm whether the data are properly received.

    Below is our suggestion:

    When writing data to the same memory location via SPI DMA channel, it is recommended to utilize Autobuffer mode rather than Stop mode. To learn more, please refer the image below.

    Use SPI1 read API like this adi_spi_DMARead(hSPISubordinate, Dest_List, DMA_NUM_DESC, ADI_PDMA_AUTOBUFFER_MODE); for autobuffer mode. It will automatically restart again after XCNT reaches zero. There's no need to make another call to this API within the SPI DMA callback.

    Regards,
    Ranjitha. R

  • Thanks Ranjitha! 

        I have added the SPU configuration for SPI. But the problem seemed still unsolved. When checking the sec register in debug mode, we can make sure that only link port interrupts are triggered and processed. And about the STOP mode or Autobuffer mode, I think that will make the SPI processing more efficient, but it is not the key cause of the problem we discussed, right?

        And we also checked the pin MUX and related connections, we can make sure that the SPI data are sent from MCU to DSP1. But after entering the SPI ISR for one time, it will never be reached again. Do you have any more suggestions? could you give me a demo project for it?

    Thank you!

  • Hi,

    Please find the example project attached here. You can take this as reference and modify it as per your requirement.

    In this project we performed LPO-LP1 and SPI0-SP1 loopback operation. For loop back communication, we set up SPI at 12.5MHz and LinkPort at 31.25MHz. In this case, the transmitters are LP0 and SPI0, and the receivers are LP1 and SPI1. We verified that the project functions as intended on the ADSP-21569 EZ-LITE board. Both LinkPort and SPI callback are called continuously. Please refer the attached image, the callback counts are increased as expected. 

    Use #define STOP_DMA_MODE macro for run this project in DMA stop mode

    Use #define Autobuffer_mode macro for run this project in DMA autobuffer mode.

    LP_SPI_Loopback.zip

    Regards,

    Nandini C

  • Thanks for your great supports!

    I will try it. And I will update the test results after I have got any progresses. 

    Thank you!