Transfer/ Receive n bytes & Synchronous Transmit via SPI

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

Transfer/ Receive n bytes & Synchronous Transmit via SPI

跳至解决方案
1,674 次查看
SuperBeginner
Contributor III

Dear NXP,

I have two questions regarding SPI communication development using MBDT:

  • How can I read or write n bytes (>2 bytes)?
    I have verified that 2-byte data transmission is working fine with the packet generator using the example project "s32k3xx_spi_async_interr_ebt".
    However, when I try to transmit 4 bytes of data (0xAA 0xAB), the EVB only receives the 0xAA data.
    I know this is quite normal, but I just want to provide an example to help you better understand my issue.
  • How do I develop synchronous transmit?
    I referenced the example "s32k344_spi_sync_master_ebt" and tried to start data transmission with LPSPI2, but it doesn’t work.
    I checked the status. "SPI_SetupEB" shows 0 and "SPI_SyncTransmit" shows 1.

    I have confirmed that my hardware connections are normal, as the asynchronous example project works correctly when programmed directly.
    SPI_async_mode.PNG

     

    SPI_async_mode_freemaster.PNG

Please help me. Thank you.

MBDT  S32K312EVB-Q172 

0 项奖励
回复
1 解答
1,587 次查看
Irina_Costachescu
NXP Employee
NXP Employee

Hi @SuperBeginner 

I would like to point you to the following thread, as a reference to a similar use case that was approached. Could you please check if the solution provided here is suitable for your use case? https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/SPI-configuration-MODEL-based-design-to...

Hope this helps,

Irina

在原帖中查看解决方案

0 项奖励
回复
3 回复数
1,599 次查看
SuperBeginner
Contributor III

Dear NXP,

Regarding the second question - "How do I develop synchronous transmit?", I found the answer myself.

I found this was an oversight on my part, I didn't enable SpiPhyUnitSync under the S32 Config tool.

SPI_Setting_1.PNG

SPI_Setting_2.PNG

This resulted in my SPI communication not functioning in synchronous mode.

But regarding the first question - "How can I read or write n bytes (>2 bytes)?", I still need your help.

I don't know who can help me.

Please forgive me for now tagging engineers who have helped me in the past.

Thank you.

@Irina_Costachescu  @dragostoma 

0 项奖励
回复
1,588 次查看
Irina_Costachescu
NXP Employee
NXP Employee

Hi @SuperBeginner 

I would like to point you to the following thread, as a reference to a similar use case that was approached. Could you please check if the solution provided here is suitable for your use case? https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/SPI-configuration-MODEL-based-design-to...

Hope this helps,

Irina

0 项奖励
回复
1,575 次查看
SuperBeginner
Contributor III

Hi @Irina_Costachescu ,

Thank you for your reply.

You solved my problem, thanks.

0 项奖励
回复
%3CLINGO-SUB%20id%3D%22lingo-sub-1956107%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%E9%80%9A%E8%BF%87%20SPI%20%E4%BC%A0%E8%BE%93%2F%E6%8E%A5%E6%94%B6%20n%20%E4%B8%AA%E5%AD%97%E8%8A%82%E5%B9%B6%E5%90%8C%E6%AD%A5%E4%BC%A0%E8%BE%93%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1956107%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EDear%20NXP%2C%3C%2FP%3E%3CP%3E%E5%85%B3%E4%BA%8E%E4%BD%BF%E7%94%A8%20MBDT%20%E8%BF%9B%E8%A1%8C%20SPI%20%E9%80%9A%E4%BF%A1%E5%BC%80%E5%8F%91%EF%BC%8C%E6%88%91%E6%9C%89%3CSTRONG%3E%3CFONT%20color%3D%22%23FF0000%22%3E%E4%B8%A4%E4%B8%AA%E9%97%AE%E9%A2%98%3C%2FFONT%3E%3C%2FSTRONG%3E%EF%BC%9A%3C%2FP%3E%3CUL%3E%3CLI%3E%3CSTRONG%3E%3CFONT%20color%3D%22%23FF0000%22%3E%E6%88%91%E5%A6%82%E4%BD%95%E8%AF%BB%E5%8F%96%E6%88%96%E5%86%99%E5%85%A5%20n%20%E4%B8%AA%E5%AD%97%E8%8A%82%EF%BC%88%26gt%3B2%20%E4%B8%AA%E5%AD%97%E8%8A%82%EF%BC%89%EF%BC%9F%3C%2FFONT%3E%3C%2FSTRONG%3E%3CBR%20%2F%3E%E6%88%91%E5%B7%B2%E7%BB%8F%E4%BD%BF%E7%94%A8%E7%A4%BA%E4%BE%8B%E9%A1%B9%E7%9B%AE%E2%80%9C%20%3CSTRONG%3Es32k3xx_spi_async_interr_eb%3C%2FSTRONG%3E%20t%E2%80%9D%E9%AA%8C%E8%AF%81%E4%BA%86%202%20%E5%AD%97%E8%8A%82%E6%95%B0%E6%8D%AE%E4%BC%A0%E8%BE%93%E4%B8%8E%E6%95%B0%E6%8D%AE%E5%8C%85%E7%94%9F%E6%88%90%E5%99%A8%3CSTRONG%3E%E9%85%8D%E5%90%88%E8%89%AF%E5%A5%BD%3C%2FSTRONG%3E%E3%80%82%3CBR%20%2F%3E%E7%84%B6%E8%80%8C%EF%BC%8C%E5%BD%93%E6%88%91%E5%B0%9D%E8%AF%95%E4%BC%A0%E8%BE%93%3CSTRONG%3E4%20%E4%B8%AA%E5%AD%97%E8%8A%82%3C%2FSTRONG%3E%E7%9A%84%E6%95%B0%E6%8D%AE%EF%BC%88%20%3CSTRONG%3E0xAA%200xAB%3C%2FSTRONG%3E%20%EF%BC%89%E6%97%B6%EF%BC%8CEVB%20%E4%BB%85%E6%8E%A5%E6%94%B6%3CSTRONG%3E0xAA%3C%2FSTRONG%3E%E6%95%B0%E6%8D%AE%E3%80%82%3CBR%20%2F%3E%E6%88%91%E7%9F%A5%E9%81%93%E8%BF%99%E5%BE%88%E6%AD%A3%E5%B8%B8%EF%BC%8C%E4%BD%86%E6%88%91%E5%8F%AA%E6%98%AF%E6%83%B3%E6%8F%90%E4%BE%9B%E4%B8%80%E4%B8%AA%E4%BE%8B%E5%AD%90%E6%9D%A5%E5%B8%AE%E5%8A%A9%E6%82%A8%E6%9B%B4%E5%A5%BD%E5%9C%B0%E7%90%86%E8%A7%A3%E6%88%91%E7%9A%84%E9%97%AE%E9%A2%98%E3%80%82%3C%2FLI%3E%3CLI%3E%3CFONT%20color%3D%22%23FF0000%22%3E%3CSTRONG%3E%E5%A6%82%E4%BD%95%E5%BC%80%E5%8F%91%E5%90%8C%E6%AD%A5%E4%BC%A0%E8%BE%93%EF%BC%9F%3C%2FSTRONG%3E%3C%2FFONT%3E%3CBR%20%2F%3E%E6%88%91%E5%8F%82%E8%80%83%E4%BA%86%E7%A4%BA%E4%BE%8B%E2%80%9C%20%3CSTRONG%3Es32k344_spi_sync_master_ebt%3C%2FSTRONG%3E%20%E2%80%9D%EF%BC%8C%E5%B9%B6%E5%B0%9D%E8%AF%95%E4%BD%BF%E7%94%A8%3CSTRONG%3ELPSPI2%3C%2FSTRONG%3E%E5%90%AF%E5%8A%A8%E6%95%B0%E6%8D%AE%E4%BC%A0%E8%BE%93%EF%BC%8C%E4%BD%86%E5%AE%83%E4%B8%8D%E8%B5%B7%E4%BD%9C%E7%94%A8%E3%80%82%3CBR%20%2F%3E%E6%88%91%E6%A3%80%E6%9F%A5%E4%BA%86%E7%8A%B6%E6%80%81%E3%80%82%E2%80%9C%20%3CSTRONG%3ESPI_SetupEB%3C%2FSTRONG%3E%20%E2%80%9D%E6%98%BE%E7%A4%BA%3CSTRONG%3E0%3C%2FSTRONG%3E%20%EF%BC%8C%E2%80%9C%20%3CSTRONG%3ESPI_SyncTransmit%3C%2FSTRONG%3E%20%E2%80%9D%E6%98%BE%E7%A4%BA%3CSTRONG%3E1%3C%2FSTRONG%3E%20%E3%80%82%3CBR%20%2F%3E%3CP%3E%E6%88%91%E5%B7%B2%E7%BB%8F%E7%A1%AE%E8%AE%A4%E6%88%91%E7%9A%84%E7%A1%AC%E4%BB%B6%E8%BF%9E%E6%8E%A5%E6%AD%A3%E5%B8%B8%EF%BC%8C%E5%9B%A0%E4%B8%BA%E5%BC%82%E6%AD%A5%E7%A4%BA%E4%BE%8B%E9%A1%B9%E7%9B%AE%E5%9C%A8%E7%9B%B4%E6%8E%A5%E7%BC%96%E7%A8%8B%E6%97%B6%E5%8F%AF%E4%BB%A5%E6%AD%A3%E5%B8%B8%E5%B7%A5%E4%BD%9C%E3%80%82%3CBR%20%2F%3E%20%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22SPI_async_mode.PNG%22%20style%3D%22width%3A%20536px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22SPI_async_mode.PNG%22%20style%3D%22width%3A%20536px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F299560i805B3BC25B2CB5A9%2Fimage-dimensions%2F536x277%3Fv%3Dv2%22%20width%3D%22536%22%20height%3D%22277%22%20role%3D%22button%22%20title%3D%22SPI_async_mode.PNG%22%20alt%3D%22SPI_async_mode.PNG%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22SPI_async_mode_freemaster.PNG%22%20style%3D%22width%3A%20543px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22SPI_async_mode_freemaster.PNG%22%20style%3D%22width%3A%20543px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F299559i563E5AF0E217A5D4%2Fimage-dimensions%2F543x166%3Fv%3Dv2%22%20width%3D%22543%22%20height%3D%22166%22%20role%3D%22button%22%20title%3D%22SPI_async_mode_freemaster.PNG%22%20alt%3D%22SPI_async_mode_freemaster.PNG%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLI%3E%3C%2FUL%3E%3CP%3E%E8%AF%B7%E5%B8%AE%E6%88%91%E3%80%82%E8%B0%A2%E8%B0%A2%E3%80%82%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fc-pwmxy87654%2FMBDT%2Fpd-p%2FMBDT%22%20class%3D%22lia-product-mention%22%20data-product%3D%222259-1%22%20target%3D%22_blank%22%3EMBDT%3C%2FA%3E%20%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fc-pwmxy87654%2FS32K312EVB-Q172%2Fpd-p%2FS32K312EVB-Q172%22%20class%3D%22lia-product-mention%22%20data-product%3D%223493-1%22%20target%3D%22_blank%22%3ES32K312EVB-Q172%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1958514%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%E5%9B%9E%E5%A4%8D%EF%BC%9A%E9%80%9A%E8%BF%87%20SPI%20%E4%BC%A0%E8%BE%93%2F%E6%8E%A5%E6%94%B6%20n%20%E4%B8%AA%E5%AD%97%E8%8A%82%E5%B9%B6%E5%90%8C%E6%AD%A5%E4%BC%A0%E8%BE%93%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1958514%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%E4%BD%A0%E5%A5%BD%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F100054%22%20target%3D%22_blank%22%3E%40Irina_Costachescu%3C%2FA%3E%20%EF%BC%8C%3C%2FP%3E%3CP%3E%E6%84%9F%E8%B0%A2%E6%82%A8%E7%9A%84%E5%9B%9E%E5%A4%8D%E3%80%82%3C%2FP%3E%3CP%3E%E4%BD%A0%E8%A7%A3%E5%86%B3%E4%BA%86%E6%88%91%E7%9A%84%E9%97%AE%E9%A2%98%EF%BC%8C%E8%B0%A2%E8%B0%A2%E3%80%82%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1958406%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%E5%9B%9E%E5%A4%8D%EF%BC%9A%E9%80%9A%E8%BF%87%20SPI%20%E4%BC%A0%E8%BE%93%2F%E6%8E%A5%E6%94%B6%20n%20%E4%B8%AA%E5%AD%97%E8%8A%82%E5%B9%B6%E5%90%8C%E6%AD%A5%E4%BC%A0%E8%BE%93%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1958406%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%E4%BD%A0%E5%A5%BD%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F239656%22%20target%3D%22_blank%22%3E%40SuperBeginner%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%E6%88%91%E6%83%B3%E5%90%91%E6%82%A8%E6%8C%87%E5%87%BA%E4%BB%A5%E4%B8%8B%E7%BA%BF%E7%A8%8B%EF%BC%8C%E4%BD%9C%E4%B8%BA%E5%AF%B9%E7%B1%BB%E4%BC%BC%E7%94%A8%E4%BE%8B%E7%9A%84%E5%8F%82%E8%80%83%E3%80%82%E6%82%A8%E8%83%BD%E5%90%A6%E6%A3%80%E6%9F%A5%E8%BF%99%E9%87%8C%E6%8F%90%E4%BE%9B%E7%9A%84%E8%A7%A3%E5%86%B3%E6%96%B9%E6%A1%88%E6%98%AF%E5%90%A6%E9%80%82%E5%90%88%E6%82%A8%E7%9A%84%E7%94%A8%E4%BE%8B%EF%BC%9F%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2FModel-Based-Design-Toolbox-MBDT%2FSPI-configuration-MODEL-based-design-tool-box-32-bit-instruction%2Fm-p%2F1384476%22%20target%3D%22_self%22%3Ehttps%3A%2F%2Fcommunity.nxp.com%2Ft5%2FModel-Based-Design-Toolbox-MBDT%2FSPI-configuration-MODEL-based-design-tool-box-32-bit-instruction%2Fmp%2F1384476%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%E5%B8%8C%E6%9C%9B%E8%BF%99%E8%83%BD%E5%B8%AE%E5%88%B0%E6%82%A8%EF%BC%8C%3C%2FP%3E%0A%3CP%3EIrina%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1958392%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%E5%9B%9E%E5%A4%8D%EF%BC%9A%E9%80%9A%E8%BF%87%20SPI%20%E4%BC%A0%E8%BE%93%2F%E6%8E%A5%E6%94%B6%20n%20%E4%B8%AA%E5%AD%97%E8%8A%82%E5%B9%B6%E5%90%8C%E6%AD%A5%E4%BC%A0%E8%BE%93%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1958392%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EDear%20NXP%2C%3C%2FP%3E%3CP%3E%E5%85%B3%E4%BA%8E%E7%AC%AC%E4%BA%8C%E4%B8%AA%E9%97%AE%E9%A2%98%E2%80%9C%3CFONT%20color%3D%22%23FF0000%22%3E%3CSTRONG%3E%E5%A6%82%E4%BD%95%E5%BC%80%E5%8F%91%E5%90%8C%E6%AD%A5%E4%BC%A0%E8%BE%93%EF%BC%9F%3C%2FSTRONG%3E%3C%2FFONT%3E%20%E2%80%9D%EF%BC%8C%E6%88%91%E8%87%AA%E5%B7%B1%E6%89%BE%E5%88%B0%E4%BA%86%E7%AD%94%E6%A1%88%E3%80%82%3C%2FP%3E%3CP%3E%E6%88%91%E5%8F%91%E7%8E%B0%E8%BF%99%E6%98%AF%E6%88%91%E7%9A%84%E7%96%8F%E5%BF%BD%EF%BC%8C%E6%88%91%E6%B2%A1%E6%9C%89%E5%9C%A8%20S32%20%E9%85%8D%E7%BD%AE%E5%B7%A5%E5%85%B7%E4%B8%8B%E5%90%AF%E7%94%A8%3CSTRONG%3E%3CFONT%20color%3D%22%23FF0000%22%3ESpiPhyUnitSync%3C%2FFONT%3E%3C%2FSTRONG%3E%20%E3%80%82%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22SPI_Setting_1.PNG%22%20style%3D%22width%3A%20384px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22SPI_Setting_1.PNG%22%20style%3D%22width%3A%20384px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F300251i7F530B191A0F1210%2Fimage-dimensions%2F384x503%3Fv%3Dv2%22%20width%3D%22384%22%20height%3D%22503%22%20role%3D%22button%22%20title%3D%22SPI_Setting_1.PNG%22%20alt%3D%22SPI_Setting_1.PNG%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22SPI_Setting_2.PNG%22%20style%3D%22width%3A%20385px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22SPI_Setting_2.PNG%22%20style%3D%22width%3A%20385px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F300250iE7EA56F719338A74%2Fimage-dimensions%2F385x247%3Fv%3Dv2%22%20width%3D%22385%22%20height%3D%22247%22%20role%3D%22button%22%20title%3D%22SPI_Setting_2.PNG%22%20alt%3D%22SPI_Setting_2.PNG%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%E8%BF%99%E5%AF%BC%E8%87%B4%E6%88%91%E7%9A%84%20SPI%20%E9%80%9A%E4%BF%A1%E6%97%A0%E6%B3%95%E5%9C%A8%E5%90%8C%E6%AD%A5%E6%A8%A1%E5%BC%8F%E4%B8%8B%E8%BF%90%E8%A1%8C%E3%80%82%3C%2FP%3E%3CP%3E%E4%BD%86%E5%85%B3%E4%BA%8E%E7%AC%AC%E4%B8%80%E4%B8%AA%E9%97%AE%E9%A2%98%E2%80%94%E2%80%94%E2%80%9C%3CSTRONG%3E%3CFONT%20color%3D%22%23FF0000%22%3E%E6%88%91%E5%A6%82%E4%BD%95%E8%AF%BB%E5%8F%96%E6%88%96%E5%86%99%E5%85%A5%20n%20%E4%B8%AA%E5%AD%97%E8%8A%82%EF%BC%88%26gt%3B2%20%E4%B8%AA%E5%AD%97%E8%8A%82%EF%BC%89%EF%BC%9F%3C%2FFONT%3E%3C%2FSTRONG%3E%20%E2%80%9D%EF%BC%8C%E6%88%91%E4%BB%8D%E9%9C%80%E8%A6%81%E4%BD%A0%E7%9A%84%E5%B8%AE%E5%8A%A9%E3%80%82%3C%2FP%3E%3CP%3E%E6%88%91%E4%B8%8D%E7%9F%A5%E9%81%93%E8%B0%81%E8%83%BD%E5%B8%AE%E5%8A%A9%E6%88%91%E3%80%82%3C%2FP%3E%3CP%3E%E8%AF%B7%E5%8E%9F%E8%B0%85%E6%88%91%E7%8E%B0%E5%9C%A8%E6%A0%87%E8%AE%B0%E8%BF%87%E5%8E%BB%E5%B8%AE%E5%8A%A9%E8%BF%87%E6%88%91%E7%9A%84%E5%B7%A5%E7%A8%8B%E5%B8%88%E3%80%82%3C%2FP%3E%3CP%3E%E8%B0%A2%E8%B0%A2%EF%BC%81%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F100054%22%20target%3D%22_blank%22%3E%3CFONT%3E%40Irina_Costachescu%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FFONT%3E%3C%2FA%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F199423%22%20target%3D%22_blank%22%3E%3CFONT%3E%40dragostoma%3C%2FFONT%3E%3C%2FA%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E