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.

AWR2944: How to use MBISPI interface (MIBSPI_transfer) in a task based on freertos?(MIBSPI_transfer causes task to stop running)

Part Number: AWR2944

Tool/software:

I need to feed watch dog of pmic by MBISPI interface (MIBSPI_transfer) in a user task.
According to the user manual of pmic LP8774x-Q1, I need to read pmic register to get question value, and send the answer in a specific timing sequence.
So, I call MIBSPI_transfer to read quesetion value, and write answer valuie in my task.
However, after running for a while, I found that all the user tasks I created had stopped running, only the idle task was running.

And I just discovered that even if MIBSPI_transfer is only periodically called to write the PMIC register in the task (without reading the register), the problem described earlier will occur

This problem occurs frequently and can be reproduced within a few minutes of operation.
May I ask if there are any restrictions on using the MBISPI interface (MIBSPI_transfer) in freertos tasks?
Or does MIBSPI_transfer require a specific interval between multiple calls?
How should I achieve my goal?

Note:I use MIBSPI_transfer in block mode
(because I must call interface in a specific timing sequence)

sdk version: mmwave_mcuplus_sdk_04_04_01_02

Look forward to your reply.
Thanks a lot.

  • I have added pictures to illustrate the operation code for reading and writing pmic registers through MIBSPI, which is based on the sample program in the SDK.

    Please also help confirm if there are any issues.

    Thanks a lot.

  • Hello Chris,

    There is nothing wrong with the code you have written, you can call the MIBSPI in a freertos task.
    This looks like an issue of the task handling.
    Instead of PMIC write, can you first start with a counter which increments and see if the task is running well?
    Ensure that it runs properly and then change the code to PMIC instead.

    Regards,
    Saswat Kumar

  • Hello Saswat,

    Thank you for your reply.

    I have tried not to perform pmic register read and write operations in my task (cycle of task is 10ms), and it runs normally in this situation. (It can run normally all night long)
    When I perform periodic pmic register read and write operations in my task, after a period of time, the task will freeze.
    In addition, I have created multiple user tasks, and in the event of a problem, all other user tasks are also not running, only the idle task is running.
    So I suspect that regularly calling the MBISPI interface (MIBSPI_transfer) to perform pmic register read and write operations in the task may result in abnormal running status of the entire task.

    According to the source code of the SDK, MIBSPI_transfer encapsulates a considerable amount of content.
    Is it possible that the MIBSPI_transfer or PMIC register read-write interface is not support being called periodically?

  • Hello Chris,

    Can you try adding a delay after reading and writing and monitor the changes?

    Regards,
    Saswat Kumar

  • Hello Saswat,

    Thank you for your reply.

    After trying your previous suggestion, I have three questions to ask.
    1.
    I have tried adding a delay after reading and writing, but problem still occurred.
    (I tried adding a delay 20ms and 100ms)

    I found that the default configuration of MiBSPI in the SDK uses DMA, and the transfer timeout is "forever".

    According to debugging in the SDK, this semaphore was not successfully obtained when the problem occurred.

    EDMA_transferCompletionMasterIsrFxn seems to have been called one less time, and MIBSPI-d maDoneCb has not been called as a result.

    What could be the possible reason for this problem? How should we solve it?

    2.
    I am trying to configure mibspi to not use DMA and feed the dog periodically in the task using this method.
    May I ask if there are any issues or risks based on the design of the SDK?

    3.
    Have you ever used AWR2944+PMIC LP8774X-Q1 for dog feeding operations? Is there a corresponding sample program that can be provided to us?

    Look forward to your reply.
    Thanks a lot.

  • Hello Chris,

    1) This might occur:
    a) The DMA channel is being used another task
    b) Add an increment counter and see if it fails at the same count, then you should debug that particular loop what is happening
    c) Transfer timeout will not pose anything, it just means that it will not go to a failure case, so your code is going into idle instead

    2) There is no risk if you remove DMA in your implementation

    3) No we do not have an example for that.

    Regards,
    Saswat kumar