Post Go back to editing

A question about the ADSP-21479 be a slave device!

Dear All :

               I want the ADSP-21479 be a slave device and the ADSP-21479 can recevice the master command and transfer data to master !

Attached file is my sample code!

My question is I don't know why ? when I send read command I always need send the command twice ans the data value will be correct !

for example :

    To read Data_Temp[2] value(0xcc) ,master send the read command -> 030200

    03 -  INSTR

    02 -  Address                                                         

    00 -  Value - for write command          

                                                            

    // In begin the *pTXSPIB is 0 and  in switch case set *pTXSPIB = Data_Temp[Address] (0xcc)

    // MISO pin measure is 0,but the *pTXSPIB is 0xcc, get fail value(0x00) ?

              

    send the read command aging -> 030200              

    // the *pTXSPIB is 0xcc and in switch case set *pTXSPIB = Data_Temp[Address] (0xcc)

    // MISO pin measure is 0xcc,and the *pTXSPIB is 0xcc, get correct data in this time(0xcc)!

    But, continue to read other Data_Temp value

    To read Data_Temp[0] value(0xaa)     master send the read command -> 030000

              

    // the *pTXSPIB is 0xcc now and  in switch case set *pTXSPIB = Data_Temp[Address] (0xaa)

    // MISO pin measure is 0xcc,but the *pTXSPIB is 0xaa ,get fail value(0xcc) ?

    send the read command aging -> 030000

    // the *pTXSPIB is 0xaa and in switch case set *pTXSPIB = Data_Temp[Address] (0xaa)

    // MISO pin measure is 0xaa,and the *pTXSPIB is 0xaa, get correct data in this time(0xaa)!

    I don't know why I want to get correct data always need to send the master command twice?

    Where is the problem? Who can tell me?

    Thanks !!

  • Hi,

    Sorry but I am not very clear about who is the master here. Are you using two EZ-Kits to perform the communication? Could you please explain your setup little more in detail and also provide a simple code for both master and slave that replicates the problem?

    Thanks,

    Mitesh

  • Hi ,

    my master is Rx-H8,

    Master (Rx-H8)                   Slave(ADSP-21479)

    CLK      ----------------------->    DPI_PIN4(CLK)

    MOSI    ----------------------->    DPI_PIN5(MOSI/RXSPI)

    MISO    <-----------------------    DPI_PIN13(MISO/TXSPI)

    CS        ----------------------->    DPI_PIN6(CS)

    Master MOSI send read command to Slave(ADSP-21479),than switch case and get value and set TXSPI=get data.

    but MISO transfer to master data always is previous data !

  • Hi,

    Thanks for further details. After going through your code and description, I have following question/suggestion:

    After receiving the command, the slave requires some time to fill the required data into the TXSPIB regsiter. Before the TXSPIB register is loaded by the slave, the master should not send another set of 32 SPICLK cycles to read the addressed data. How are you taking care of this delay ? There are two possible ways:

    1) First calculate the time the slave takes after receving the read command to fill the TXSPIB register with the correct data. Use this measured time with enough margin to calculate a worst case time. Then, make sure that after sending the read command, the master sends the next set of 32 SPICLK cycles after this worst case time.

    2) Use a seperate flag signal with which the slave can indicate to the master that the requested data is ready to be read.

    Hope this helps.

    Thanks,

    Mitesh

  • Dear Mitesh :

                       Thanks your help! my question already resolve.The problem is in Master device not in SPI slave(ADSP)!

  • Hi,

    Glad to know that the problem has been solved. Please let me know in case you face further issues.

    Thanks,

    Mitesh

  • This question has been closed by the EZ team and is assumed answered.