S32K144 SPI config issue

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

S32K144 SPI config issue

2,573 Views
648811715
Contributor I

First of all, I'm not very professional, and I'm still learning, so if I ask questions that seem stupid, I hope you can help me answer them, thank you very much;

I am implementing SPI communication function on S32k144 chip, using LPSPI2. The pins used are as follows:

  • PTC1: LPSPI2_SOUT
  • PTC0: LPSPI2_SIN
  • PTC15: LPSPI2_SCK
  • PTC4: LPSPI2_PCS0

The development tool I use is IAR. My program mimics the code in the lpspi_transfer_s32k144 project and is configured as master. However, when the program reached the LPSPI_Init(base) line in the lPSPI_DRv_Masterinit() function at runtime, it could not continue, and there was a hard fault. I have been debugging for several days, but it still hasn't been solved. I hope anyone can help me. The code is in txt file.

 

 

Looking forward to answering. Thank you exeryone.

Tags (1)
0 Kudos
Reply
5 Replies

2,541 Views
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @648811715,

Firstly, could your share your IDE and SDK version, if possible? Is this the S32K144-EVB or a custom board?

I can see you are using Processor Expert, so firstly I suggest comparing the configuration for Send/Receive LPSPI between the example and your project. Also, please confirm if you have the peripheral clocks available for the LPSPI instance you need (2 in your case).

Julin_AragnM_1-1737664911696.png

Best regards,
Julián

0 Kudos
Reply

2,514 Views
648811715
Contributor I

Thank you for your response. The board is a custom board. The IDE I use is IAR embedded workbench for ARM 8.32.1. I am not sure about the SDK version, but I know that the program was acquired in 2019, and the library files have not changed since then. Processor Expert probably wasn't actually used because I couldn't find the definition for PEX_ROS_INIT, and I commented out the Processor Expert part of the code and stopped running in the same place. I actually commented out all the code in main, just copied the example code into my main function, and the program stopped running on the same line.

0 Kudos
Reply

2,502 Views
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @648811715,

If you are not using PE, I imagine you are building your application through baremetal, or at least hardcoding the configuration. You can use AN5413: S32K1xx Series Cookbook – Application Note for a reference project on SPI (chapter 2.8).

Please go over the configuration for LPSPI and compare it with yours.

Best regards,
Julián

0 Kudos
Reply

2,345 Views
648811715
Contributor I

I'm afraid it's really a problem with my SDK version. I have compared some files and they are really different. Maybe I'll have to update the SDK first.

0 Kudos
Reply

2,233 Views
648811715
Contributor I

Sorry. My bad. The SPI clock is not configured. No hardware fault appeares after the clock is configured

0 Kudos
Reply