ImxRT 1176 LPSPI blocking function issue

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

ImxRT 1176 LPSPI blocking function issue

ソリューションへジャンプ
1,126件の閲覧回数
chandan_uv
Contributor III

Hello, I’m working with LPSPI and using LPSPI_MasterTransferBlocking. Since this is a blocking function, I expect the LPSPI peripheral to be free once the transfer is complete. However, I observed something different.

After the blocking transfer, I read the SR (Status Register) using LPSPI_GetStatusFlags, and the returned value was 0x1001101.

Do you have any suggestions? Ideally, after the blocking transfer, the LPSPI should be idle. I’m sharing a code snapshot below for reference. 

 

    if((staus_flag & kLPSPI_ModuleBusyFlag) == kLPSPI_ModuleBusyFlag)
    {
        ret = STATUS_BUSY;
        PRINTF("SPI Busy, %x, %d\r\n", staus_flag, count);
    }
    else
    {
        masterXfer.txData   = SpiTxData;
        masterXfer.rxData   = SpiRxData;
        masterXfer.dataSize = spiTransferSize;
        masterXfer.configFlags =
        kLPSPI_MasterPcs0 | kLPSPI_MasterPcsContinuous;
        status = LPSPI_MasterTransferBlocking(LPSPI1, &masterXfer);
        ret = STATUS_SUCCESS;
        staus_flag = LPSPI_GetStatusFlags(IMU_SPI_IF);
        PRINTF("staus_flag: %x\r\n", staus_flag);
        count++;
        //sw_asm_delay_us(2U);
    }

 

 

0 件の賞賛
返信
1 解決策
1,084件の閲覧回数
mayliu1
NXP Employee
NXP Employee

Hi @chandan_uv ,

Thank you so much for your interest in our products and for using our community.

Question: 

After the blocking transfer, I read the SR (Status Register) using LPSPI_GetStatusFlags, and the returned value was 0x1001101.

Answer: I check your LPSPI SR register value is 0x1001101,

that is 0b0001 0000 0000 0001 0001 0000 0001, the TCF (Transfer Complete Flag) is 0,which means Transfer  Not complete.

From IMXRT1170RM,  we can see the detail SR status TCF  description. In Master mode, indicates that all transfers have completed and that LPSPI has returned to Idle state and the transmit FIFO is empty.

mayliu1_0-1745547395328.png

Question:

Do you have any suggestions? Ideally, after the blocking transfer, the LPSPI should be idle. I’m sharing a code snapshot below for reference. 

Answer:

I suggest you can develop your project based on SDK demo.

Please Verify the frame format configuration: 
Make sure that the LPSPI settings (For example: Data Length, CPOL, CPHA) of the master device are exactly same to the slave device.

 

Wish it helps you.
If you still have question about it, please kindly let me know.

Wish you a nice day!

Best Regards
MayLiu

元の投稿で解決策を見る

0 件の賞賛
返信
2 返答(返信)
1,085件の閲覧回数
mayliu1
NXP Employee
NXP Employee

Hi @chandan_uv ,

Thank you so much for your interest in our products and for using our community.

Question: 

After the blocking transfer, I read the SR (Status Register) using LPSPI_GetStatusFlags, and the returned value was 0x1001101.

Answer: I check your LPSPI SR register value is 0x1001101,

that is 0b0001 0000 0000 0001 0001 0000 0001, the TCF (Transfer Complete Flag) is 0,which means Transfer  Not complete.

From IMXRT1170RM,  we can see the detail SR status TCF  description. In Master mode, indicates that all transfers have completed and that LPSPI has returned to Idle state and the transmit FIFO is empty.

mayliu1_0-1745547395328.png

Question:

Do you have any suggestions? Ideally, after the blocking transfer, the LPSPI should be idle. I’m sharing a code snapshot below for reference. 

Answer:

I suggest you can develop your project based on SDK demo.

Please Verify the frame format configuration: 
Make sure that the LPSPI settings (For example: Data Length, CPOL, CPHA) of the master device are exactly same to the slave device.

 

Wish it helps you.
If you still have question about it, please kindly let me know.

Wish you a nice day!

Best Regards
MayLiu

0 件の賞賛
返信
1,123件の閲覧回数
chandan_uv
Contributor III

BTW LPSPI1 and IMU_SPI_IF is same.

0 件の賞賛
返信
%3CLINGO-SUB%20id%3D%22lingo-sub-2086405%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EImxRT%201176%20LPSPI%20%E3%83%96%E3%83%AD%E3%83%83%E3%82%AD%E3%83%B3%E3%82%B0%E6%A9%9F%E8%83%BD%E3%81%AE%E5%95%8F%E9%A1%8C%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2086405%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%E3%81%93%E3%82%93%E3%81%AB%E3%81%A1%E3%81%AF%E3%80%81%E7%A7%81%E3%81%AFLPSPI%E3%82%92%E4%BD%BF%E7%94%A8%E3%81%97%E3%81%A6%E4%BD%9C%E6%A5%AD%E3%81%97%E3%81%A6%E3%81%8A%E3%82%8A%E3%80%81LPSPI_MasterTransferBlocking%E3%82%92%E4%BD%BF%E7%94%A8%E3%81%97%E3%81%A6%E3%81%84%E3%81%BE%E3%81%99%E3%80%82%E3%81%93%E3%82%8C%E3%81%AF%E3%83%96%E3%83%AD%E3%83%83%E3%82%AD%E3%83%B3%E3%82%B0%E6%A9%9F%E8%83%BD%E3%81%AA%E3%81%AE%E3%81%A7%E3%80%81%E8%BB%A2%E9%80%81%E3%81%8C%E5%AE%8C%E4%BA%86%E3%81%99%E3%82%8B%E3%81%A8LPSPI%E3%83%9A%E3%83%AA%E3%83%95%E3%82%A7%E3%83%A9%E3%83%AB%E3%81%AF%E7%A9%BA%E3%81%84%E3%81%A6%E3%81%84%E3%82%8B%E3%81%A8%E4%BA%88%E6%83%B3%E3%81%97%E3%81%A6%E3%81%84%E3%81%BE%E3%81%99%E3%80%82%E3%81%97%E3%81%8B%E3%81%97%E3%80%81%E7%A7%81%E3%81%AF%E4%BD%95%E3%81%8B%E9%81%95%E3%81%86%E3%81%93%E3%81%A8%E3%82%92%E8%A6%B3%E5%AF%9F%E3%81%97%E3%81%BE%E3%81%97%E3%81%9F%E3%80%82%3C%2FP%3E%3CP%3E%E3%83%96%E3%83%AD%E3%83%83%E3%82%AD%E3%83%B3%E3%82%B0%E8%BB%A2%E9%80%81%E5%BE%8C%E3%80%81LPSPI_GetStatusFlags%E3%82%92%E4%BD%BF%E3%81%A3%E3%81%A6SR(Status%20Register)%E3%82%92%E8%AA%AD%E3%81%BF%E8%BE%BC%E3%81%BF%E3%80%81%E8%BF%94%E3%81%A3%E3%81%A6%E3%81%8D%E3%81%9F%E5%80%A4%E3%81%AF0x1001101%E3%81%A7%E3%81%97%E3%81%9F%E3%80%82%3C%2FP%3E%3CP%3E%E4%BD%95%E3%81%8B%E6%8F%90%E6%A1%88%E3%81%AF%E3%81%82%E3%82%8A%E3%81%BE%E3%81%99%E3%81%8B%EF%BC%9F%E7%90%86%E6%83%B3%E7%9A%84%E3%81%AB%E3%81%AF%E3%80%81%E3%83%96%E3%83%AD%E3%83%83%E3%82%AD%E3%83%B3%E3%82%B0%E8%BB%A2%E9%80%81%E3%81%AE%E5%BE%8C%E3%80%81LPSPI%E3%81%AF%E3%82%A2%E3%82%A4%E3%83%89%E3%83%AB%E7%8A%B6%E6%85%8B%E3%81%AB%E3%81%AA%E3%81%A3%E3%81%A6%E3%81%84%E3%82%8B%E3%81%AF%E3%81%9A%E3%81%A7%E3%81%99%E3%80%82%E5%8F%82%E8%80%83%E3%81%BE%E3%81%A7%E3%81%AB%E3%80%81%E4%BB%A5%E4%B8%8B%E3%81%AE%E3%82%B3%E3%83%BC%E3%83%89%E3%82%B9%E3%83%8A%E3%83%83%E3%83%97%E3%82%B7%E3%83%A7%E3%83%83%E3%83%88%E3%82%92%E5%85%B1%E6%9C%89%E3%81%97%E3%81%BE%E3%81%99%E3%80%82%3C%2FP%3E%3CBR%20%2F%3E%3CPRE%20class%3D%22lia-code-sample%20language-c%22%3E%3CCODE%20translate%3D%22no%22%3E%20%20%20%20if((staus_flag%20%26amp%3B%20kLPSPI_ModuleBusyFlag)%20%3D%3D%20kLPSPI_ModuleBusyFlag)%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20ret%20%3D%20STATUS_BUSY%3B%0A%20%20%20%20%20%20%20%20PRINTF(%22SPI%20Busy%2C%20%25x%2C%20%25d%5Cr%5Cn%22%2C%20staus_flag%2C%20count)%3B%0A%20%20%20%20%7D%0A%20%20%20%20else%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20masterXfer.txData%20%20%20%3D%20SpiTxData%3B%0A%20%20%20%20%20%20%20%20masterXfer.rxData%20%20%20%3D%20SpiRxData%3B%0A%20%20%20%20%20%20%20%20masterXfer.dataSize%20%3D%20spiTransferSize%3B%0A%20%20%20%20%20%20%20%20masterXfer.configFlags%20%3D%0A%20%20%20%20%20%20%20%20kLPSPI_MasterPcs0%20%7C%20kLPSPI_MasterPcsContinuous%3B%0A%20%20%20%20%20%20%20%20status%20%3D%20LPSPI_MasterTransferBlocking(LPSPI1%2C%20%26amp%3BmasterXfer)%3B%0A%20%20%20%20%20%20%20%20ret%20%3D%20STATUS_SUCCESS%3B%0A%20%20%20%20%20%20%20%20staus_flag%20%3D%20LPSPI_GetStatusFlags(IMU_SPI_IF)%3B%0A%20%20%20%20%20%20%20%20PRINTF(%22staus_flag%3A%20%25x%5Cr%5Cn%22%2C%20staus_flag)%3B%0A%20%20%20%20%20%20%20%20count%2B%2B%3B%0A%20%20%20%20%20%20%20%20%2F%2Fsw_asm_delay_us(2U)%3B%0A%20%20%20%20%7D%3C%2FCODE%3E%3C%2FPRE%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2086408%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3AImxRT%201176%20LPSPI%E3%83%96%E3%83%AD%E3%83%83%E3%82%AD%E3%83%B3%E3%82%B0%E6%A9%9F%E8%83%BD%E3%81%AE%E5%95%8F%E9%A1%8C%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2086408%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%E3%81%A8%E3%81%93%E3%82%8D%E3%81%A7%E3%80%81LPSPI1%E3%81%A8IMU_SPI_IF%E3%81%AF%E5%90%8C%E3%81%98%E3%81%A7%E3%81%99%E3%80%82%3C%2FP%3E%3C%2FLINGO-BODY%3E