SPI no data transfer in S32K344_T172 MBDT example project

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

SPI no data transfer in S32K344_T172 MBDT example project

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

I've been trying to adjust/fix the example project "s32k3xx_spi_async_interr_s32ct" for the K344 172 pin version since by default it was configured for the 257 pin version. 
The problem I encoutered first was that there was no other signal working except for the clock. 

IMG_2087.jpg

 After analysing the Configuration tool project I've managed to switch the PCS pin to PTC12 and change the configuration for ExternalDevice_0 to PCS1 LOW. This resulted in the CS signal working as shown in the image below. ALthough, even if the PCS is working, there is no exchange of data bewteen MOSI and MISO pins, and there is an odd HIGH signal before PCS LOW on the MISO pin. I would like to know which configurations are needed to be modified additionally for the SPI communication to work properly.

SPI_Config.jpg

IMG_2115.jpg

Setup.jpg



タグ(4)
0 件の賞賛
返信
1 解決策
1,634件の閲覧回数
stefanvlad
NXP Employee
NXP Employee

Hi @ErwinR ,

 

The problem with that pin PTB9 is that is also connected to LIN1_RX as in schematic:

s32k3xx_spi_async_interr_s32ct_PTB9.png

 This way the pin PTB9 is connected to LIN1_RX that goes to the TJA1022T:

s32k3xx_spi_async_interr_s32ct_TJA1022T.png

This might act like a voltage divider because of the R363 10kOhm pull-up.

 

I was also testing another LPSPI instance for the Master instance, my advice is to change PTB9 pin with PTE25, that is free, with no other connections on the board:

s32k3xx_spi_async_interr_s32ct_PTE25.png

 

Let me know if it works with PTE25,

Stefan V.

元の投稿で解決策を見る

11 返答(返信)
1,738件の閲覧回数
stefanvlad
NXP Employee
NXP Employee

Hi @ErwinR ,

 

Before we start, what revision of the S32K3X4EVB-T172 board do you have? for example: SCH-53148 Rev B1

Have you selected the S32K344-Q172 S32 CT in the Hardware Implementation menu? (Step1)

s32k3xx_spi_async_interr_s32ct_HW.png

Please select S32K344-Q172 S32 Config Tool in the Project Template (Step2) then a pop-up will appear:

s32k3xx_spi_async_interr_s32ct_Ok.png

Press "OK" , another Pop-up will appear "Please wait...", this will disappear in 1-2min, then press Apply (Step3) and OK.

This has the purpose of loading the specific configuration made for the selected hardware part/board.

Then you need to Build, Deploy & Start (CTRL+B) to rebuild and deploy the code on the T172 board. Wait for the process to complete and flash the board, then proceed to wiring.

Download the board schematics from https://www.nxp.com/webapp/Download?colCode=S32K3X4EVB-T172-HWPACK

Just to be sure, have you made the same connections as in the table below:

s32k3xx_spi_async_interr_s32ct_Table.png

I have made same connections on my board, for example connecting pin PTB3 with PTB15, PTB2 with PTB16 on so on, according to the table above:

s32k3xx_spi_async_interr_s32ct_Pins.jpg

 The blue LED will start blinking once per second.

Open the s32k3xx_spi_async_interr_s32ct.pmpx with FreeMASTER and see the values increasing:

s32k3xx_spi_async_interr_s32ct_FM.png

  • master_send
  • master_recv
  • slave_recv

 

Assuming the connections have been properly wired up, can you provide details about the board you are using?

Also, are you using the latest version of NXP Model-Based Design Toolbox for S32K3 version 1.6.0?

 

Hope this works also on your side,

Stefan V.

0 件の賞賛
返信
1,725件の閲覧回数
ErwinR
Contributor III

Hi @stefanvlad,

Concerning your questions about the S32K344 evb and Simulink, the Revision of the board is SCH-53148 Rev B. The version of the MDBT for S32K3 is 1.6.0 

I did not change to S32K344-Q172 S32 Config Tool from the simulink project but I switched the processor from the Configuration Tool window Switch package option.

Config_Tool.jpg

SwitchPackage.jpg

  It let me switch to the 172 pin version of the board while saving the LPSPI configuration. I just needed to change the LPSPI2 Chip Select pin to PCS1(PTC12). And this gave me the result that I mentioned in my post.

As for Your guide, I tried switching to S32K344-Q172 S32 Config Tool from Simulink Hardware Settings and build the project. This resulted in the same issue of no data exchange between MOSI and MISO pins.  What comes to FreeMaster preview, only the master_send variable was displaying a change in value.

FreeMaster_Screen.jpg

IMG_2125.jpg

IMG_2127.jpg

0 件の賞賛
返信
1,713件の閲覧回数
stefanvlad
NXP Employee
NXP Employee

Hi @ErwinR ,

 

I have presented above the steps needed to change to S32K344-Q172 S32 Config Tool in the Hardware Settings, please always use that workflow.

 

In order to test easier the recommended setup,  please download the attached s32k3xx_spi_async_interr_s32ct.zip, and rewrite your local files with the ones from the archive.

Flash the s32k3xx_spi_async_interr_s32ct.elf file by using the MATLAB command: 

>> mbd_s32k3.nxp.download.jtag('s32k3xx_spi_async_interr_s32ct.elf','S32K344')

Also please connect the 4 wires as in the diagram below:

s32k3xx_spi_async_interr_s32ct_Connections2.png

The above connections are the same in the table provided in the help s32k3xx_spi_async_interr_s32ct_example_readme.html:

stefanvlad_0-1742225415484.png

Please follow the steps above and this will result in a working setup for the SPI model.

My last question is why did you change the PCS1(PTC12) pin? 

 

Best regards,

Stefan V. 

0 件の賞賛
返信
1,707件の閲覧回数
ErwinR
Contributor III

Hi @stefanvlad ,

I have uploaded your project .elf file and unfortunately I am getting the same result. I tried uploading the same file onto my colleagues evalboard and got the same result. Could this be some sort of hardware defect/error?

In my previous project I switched the PCS to PTC12 because after doing the package switch to the 172 pin version in Configuration Tool the PTB25 pin was occupied by another peripheral.

IMG_2129.jpg

freemaster.jpg

0 件の賞賛
返信
1,681件の閲覧回数
stefanvlad
NXP Employee
NXP Employee

Hi @ErwinR ,

 

I've manage to also test the .elf on a S32K3X4EVB-T172 RevB, same as your board.

With this board, i was able to reproduce the issue, with the Logic Analyzer, i saw that PTB15-MOSI signal is missing:

s32k3xx_spi_async_interr_s32ct_T172RevB.png

 While on the other board we have better results, working well with T172 RevB1 , Q172 boards:

s32k3xx_spi_async_interr_s32ct_T172RevB1.png

We are further investigating this issue, so far i have tested on multiple boards:

S32K344-Q172 S32K344-T172 RevB S32K344-T172 RevB1
P32K344EHVPBS P32K344EHVPBS 32K344HMS
1P55A 0P55A 1P55A
CTZX2128B CTZW22130

CTAK2228M

SPI works

SPI doesn't work

SPI works

Can you provide the revision of the S32K344 you have, these are the markings on the chip, they are similar to the table above.

 

Regards,

Stefan V.

0 件の賞賛
返信
1,654件の閲覧回数
ErwinR
Contributor III

Hi @stefanvlad,

I tried changing from LPSPI2 to LPSPI4 and it seemed to work. The LPSPI4 (PTB10-SCK, PTB11-SIN, PTB9-SOUT, PTC10-PCS0) is set up as a slave and the LPSPI1 is set as master. Although the MOSI signal is now working, the MISO signal isn't working yet and by viewing the FreeMaster window it seems that slave_recv variable is not changing its value. So probably it may be a matter of correctly setting up the SLAVE channel and the Simulink block..

Config_Tool.jpg

IMG_2138.jpg

freemaster.jpg

0 件の賞賛
返信
1,668件の閲覧回数
ErwinR
Contributor III

Hi @stefanvlad ,

Thank You for the information,
We'll be awaiting any possible solution for this error. 
The exact s32k344 boeard that we have is P32K344EHVPBS 0P55A CTZW22130 which is the board on which SPI does not work

0 件の賞賛
返信
1,641件の閲覧回数
ErwinR
Contributor III

Small update:
I've switched LPSPI1 to be SLAVE and LPSPI4 to be MASTER and the communication works now. The only problem is that the signal in connection between PTB9 and PTB15 pins shifts to 2-2.5V as HIGH halfway through the signal.

IMG_2140.jpg

0 件の賞賛
返信
1,635件の閲覧回数
stefanvlad
NXP Employee
NXP Employee

Hi @ErwinR ,

 

The problem with that pin PTB9 is that is also connected to LIN1_RX as in schematic:

s32k3xx_spi_async_interr_s32ct_PTB9.png

 This way the pin PTB9 is connected to LIN1_RX that goes to the TJA1022T:

s32k3xx_spi_async_interr_s32ct_TJA1022T.png

This might act like a voltage divider because of the R363 10kOhm pull-up.

 

I was also testing another LPSPI instance for the Master instance, my advice is to change PTB9 pin with PTE25, that is free, with no other connections on the board:

s32k3xx_spi_async_interr_s32ct_PTE25.png

 

Let me know if it works with PTE25,

Stefan V.

1,626件の閲覧回数
ErwinR
Contributor III

Everything works now. Thank You for the help!

freemaster.jpg

0 件の賞賛
返信
1,608件の閲覧回数
stefanvlad
NXP Employee
NXP Employee

You're welcome, glad to help

Stefan V.

0 件の賞賛
返信