This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

PROCESSOR-SDK-J721S2: Can I use 'SPI_transfer' function in SPI call back funciton? And How can I konw if the channel is busy?

Part Number: PROCESSOR-SDK-J721S2


Deer Sir / Madam,

    We are using J721S2 & RTOS, and i want to control the spi writing SPI driver. The spi configuration is done, now i want to do these following things:

1. send spi message once by TI PDK function 'SPI_transfer', and trigger spi callback function by it, (already setup the spiParams.transferCallbackFxn);

2. in the callback function, i add an another SPI_transfer function;

It seems like NOT OKAY, because the return value of first SPI_transfer is TRUE, but the return value in callback function is FALSE, so i can't do that?

By the way, How can i get the status of spi channel? just like it's uninit or busy or idle.

Appreciate so much,

Lepus

  • And one more question:

    If i use SPI_transfer twice and the first SPI_transfer failed, can the second SPI_transfer continue to work?

    Thanks a lot

  • Hi Lepus Shen,

    Can you please elaborate what you mean by SPI transfer is not ok? You are not seeing transfer on the bus or you are not getting completion callback? also why do you need to call SPI_Transfer from the callback? Can you try calling it from the task context? I am really doubtful that this api supports calling from ISR context.

    Regards,

    Brijesh

  • Hi Brijesh,

    We want to make sure if we can use SPI_transfer() in its own callback function? If it works, we can ensure the high spi transmission frequency which we need.

    Now, our fact is If i add a transfer function in spi callback function, then the return value of SPI_transfer() is FALSE, and the transmission Failed, so that the next callback function wont work.

    So i want to know that is this way banned or few steps wrong.

    Thanks alot,

    Lepus

  • Hi Lepus,

    We have not really validated calling this API from the ISR context, so i would suggest calling this function from the task context. 

    Regards,

    Brijesh