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.
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.
解決済! 解決策の投稿を見る。
Hi @ErwinR ,
The problem with that pin PTB9 is that is also connected to LIN1_RX as in schematic:
This way the pin PTB9 is connected to LIN1_RX that goes to the TJA1022T:
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:
Let me know if it works with PTE25,
Stefan V.
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)
Please select S32K344-Q172 S32 Config Tool in the Project Template (Step2) then a pop-up will appear:
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:
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:
The blue LED will start blinking once per second.
Open the s32k3xx_spi_async_interr_s32ct.pmpx with FreeMASTER and see the values increasing:
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.
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.
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.
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:
The above connections are the same in the table provided in the help s32k3xx_spi_async_interr_s32ct_example_readme.html:
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.
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.
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:
While on the other board we have better results, working well with T172 RevB1 , Q172 boards:
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.
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..
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
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.
Hi @ErwinR ,
The problem with that pin PTB9 is that is also connected to LIN1_RX as in schematic:
This way the pin PTB9 is connected to LIN1_RX that goes to the TJA1022T:
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:
Let me know if it works with PTE25,
Stefan V.
Everything works now. Thank You for the help!
You're welcome, glad to help
Stefan V.