S32K148 LPSPI match configuration

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

S32K148 LPSPI match configuration

971 次查看
SONGTAOSI
Contributor I

Hi,

when I test the LPSPI_CFGR1_MATCFG bit ,There is one question that bothers me。

I configure LPSPI0 as master,LPSPI1 as slave. LPSPI1 transfer 5 datas[0x64,0x63,0x62,0x61,0x60] to LPSPI0, and

LPSPI0->CFGR1 |= LPSPI_CFGR1_MATCFG(3); 

LPSPI0->IER |= LPSPI_IER_DMIE_MASK;//LPSPI_IER_DMIE_MASK;
LPSPI0->TCR |= LPSPI_TCR_CONT_MASK;  //连续传输

LPSPI0->CFGR0 |= LPSPI_CFGR0_RDMO_MASK; //仅接收匹配

LPSPI0->DMR0 = 0x60; //最后一个数据进行匹配;
LPSPI0->DMR1 = 0x59; 

After testing, I found that the last one data can't match with DMR0 and DMR1,regardless LPSPI_CFGR1_MATCFG(3) or 4,5,6,7.

Looking forward to your reply!Thanks.

0 项奖励
回复
5 回复数

961 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @SONGTAOSI,

You use the continuous transfer mode (CONT = 1).

Do you terminate the continous transfer with a new TCR command?

 

Thank you,

BR, Daniel

0 项奖励
回复

957 次查看
SONGTAOSI
Contributor I

Hi

Thank you for your reply,but I'm sorry I didn't understand "Do you terminate the continous transfer with a new TCR command? "  . I only config CONT=1,PCS is always keep asserted. I can match 4 datas except the last one.

 

 

0 项奖励
回复

949 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

Hello @SONGTAOSI,

Can you negate the PCS (terminate the transfer) after the last frame?

This is done by writing the TCR FIFO with a new command.

danielmartynek_0-1682494644910.png

 

Thanks,

BR, Daniel

0 项奖励
回复

936 次查看
SONGTAOSI
Contributor I

Hi,

Your answer is very useful,Thank you so much.But I have another doubt.

if i transfer data quantity exceed 4, it should add a delay between Transfer and new TCR.

LPSPI_DRV_MasterTransfer(INST_LPSPI_1, master_buffer.tx, master_buffer.rx, 5);

delayCycles(100);

LPSPI_SetTxCommandReg(LPSPI0, &txCmdCfgSet );

the picture is add delay,it's ok

SONGTAOSI_0-1682598094814.png

this picture is not add delay, after transfer 4 data,the PCS is negate.

SONGTAOSI_1-1682598328518.png

Is this because the FIFO size Max is 4 word?

0 项奖励
回复

934 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @SONGTAOSI,

The SDK driver should terminate the transfer in the CONT mode after the 5th byte, there is no need to do it in the user code.

Which version of the SDK do you use?

You use the non-blocking transfer function which returns immediately while the transfer is still ongoing. Thus the delay. But you can use the blocking function instead.

 

Do you need the CONT mode though?

You can simply set the frame size to 40bits and leave CONT = 0.

 

Regards,

Daniel

 

0 项奖励
回复