Post Go back to editing

Questions on ADSP21569 SPI Host boot example

Category: Datasheet/Specs
Product Number: ADSP-21569

Hi there,

I have to implement booting the DSP from an MCU as a SPI host and am referring to the SPI host boot example found here:

 ADSP-21569 SPI Host example 

There's a zip attached to that page with a.o. a file Spi.c which handles the transfer of the boot image to the DSP.

  • I don't find any consideration of the 1024 rule (only transfer data in multiples of 1024) but, never mind. If it's working without it, fine.
  • Check this code which sends the LDR file

    unsigned int i;
    void Send_LDR(void)
    {
        while(((*pREG_SPI2_STAT & ENUM_SPI_STAT_NOSTALL)>>BITP_SPI_STAT_FCS)==1); // check ready or stalled
        Select_Slave();
        Send_single_byte(0x03);   /* standard speed */

        Deselect_Slave();

        for(i=0; i<sizeof(tx_buf); i++)
        {
            while(((*pREG_SPI2_STAT & ENUM_SPI_STAT_NOSTALL)>>BITP_SPI_STAT_FCS)==1); // check ready or stalled
            Select_Slave();
            while(((*pREG_SPI2_STAT & ENUM_SPI_STAT_NOSTALL)>>BITP_SPI_STAT_FCS)==1); // check ready or stalled
            Send_single_byte(tx_buf[i]);
            Deselect_Slave();
        }

    }

  • Is it really necessary to check for the RDY pin before and after asserting the select signal. Is there a possible condition where the RDY pin might be deasserted after selecting the target DSP? Since the target is  a 21569 as well: do I have to do this in my MCU code when booting the DSP in this mode?
  • Next: each byte is sent with a select cycle but as I understood, it should be possible to leave the select signal asserted during the whole transfer as shown here (hardware reference manual figure 40-7 page 40-23)

  • Similar question, in the following code which sends one byte:

    unsigned int delay;
    void Send_single_byte(unsigned char Databyte)
    {
        *pREG_SPI2_TWC    =     1;                            //    single byte instruction, no addr/data
        *pREG_SPI2_TFIFO = Databyte;                    //    command ID
        while(!((*pREG_SPI2_STAT & BITM_SPI_STAT_TF)>>BITP_SPI_STAT_TF));    //    wait till completion
        *pREG_SPI2_STAT = BITM_SPI_STAT_TF;                //    clear latch

        delay = 0xFF;
        while(delay--);
    }

  • Is the delay of 0xff cycles necessary here after clearing the transfer finished bit in the status register?

Best regards,

Rainer

  • Hi Rainer,

    Regarding "Q1 and Q2"
    >>> Yes,SPI_RDY is necessary for slave booting.The SPI module does not provide very large receive FIFOs, so the host must test the SPI_RDY signal for every byte.
    In Master mode, the SPI_RDY pin acts as an input signal and should be driven by the slave device. SPI_RDY can be de-asserted by the slave to stop the master from initiating any new transfer. If SPI_RDY is de-asserted in the middle of a transfer, the current transfer will continue, and the next transfer will not start unless the slave asserts the SPI_RDY signal. Whenever the slave de-asserts SPI_RDY and stalls the master, the SPI controller goes into a waiting state, and the SPI_STAT.FCS bit is set. When the slave asserts SPI_RDY, the SPI controller resumes operation, and the SPI_STAT.FCS bit is cleared.


    Regarding "Is the delay of 0xff cycles necessary here after clearing the transfer finished bit in the status register?"
    >>>We are checking on this and will get back you as soon as possible.

    Regards,
    Ranjitha.R

  • Hi Ranjitha,

    thanks for your response.

    I am aware of the function of DSP_RDY. My question (Q1) was: is it necessary to check DSP_RDY twice: before and after asserting the SPI select signal.

    Best regards,

    Rainer

  • Hi Ranjitha,

    I think, I get it.

    Correct me if I'm wrong but when connecting two boards with longer cables, the DSP_RDY does not rise quick enough to prevent further transfers, even if you use a 10k pull up.

    I see this on my scope

    blue: SPI_SS

    yellow: DSP_RDY

    When DSP_RDY is released, there are still some transfers remaining.

    This may be different in a custom made board with careful layout but when using two evalboards ...

    That may be the reason to add a little wait and also for checking DSP_RDY twice.

    Best regards,

    Rainer

  • Hi Rainer,
    Your understanding is correct.

    Regarding "Is the delay of 0xff cycles necessary here after clearing the transfer finished bit in the status register?"
    >>>It is necessary to  add a short delay to verify that the data was sent by the host.
    Regards,
    Ranjitha.R