LPSPI data transfer and recieve in S32K358

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

LPSPI data transfer and recieve in S32K358

427 Views
soumik1506
Contributor III

Hello,

I am trying to transfer data from the ADC1_P0 from SPI_externalHW0_instance0 to SPI_externalHW1_instance1 via half duplex support. I have configured the SCK, PCS and the SIN and SOUT pins for the SPI instances.

When i run the program on 358 board, i am not able to transfer the ADC data from my TXbuffer to my RXbuffer even after initialising and setting the callbacks LPSPI_IP_HALF_DUPLEX_TRANSMIT and LPSPI_IP_HALF_DUPLEX_RECEIVE respectively.

 

Please find the attached project. Thanks in advanced. Soumik

0 Kudos
Reply
10 Replies

408 Views
VaneB
NXP TechSupport
NXP TechSupport

Hi @soumik1506 

A Lpspi_Ip_HalfDuplexTransfer sample code is provided with the RTDs. The application uses the LPSPI driver to transfer data between 2 LPSPI physical units in half-duplex mode. 

This can be a good reference for SPI driver configuration.

 

BR, VaneB

0 Kudos
Reply

394 Views
soumik1506
Contributor III

I have also tried running the example code without making any changes in the code or in the configurations, the data is not getting transferred like i want to.

0 Kudos
Reply

385 Views
VaneB
NXP TechSupport
NXP TechSupport

Hi @soumik1506 

Could you share a picture of the SPI signals to verify if the information is being transferred?

0 Kudos
Reply

356 Views
soumik1506
Contributor III

WhatsApp Image 2024-10-09 at 10.15.54.jpeg

This is the signal that is going from the LPSPI2_SOUT pin  

WhatsApp Image 2024-10-09 at 10.13.55.jpeg

This is the signal that is going from the LPSPI0_SIN pin

I have made sure that the configurations are exactly the same from the example. I have set the number of bytes to 1 instead of 10 just to check the data getting transferred.

I also went through each function call while debugging, the value that i want to transfer is not getting set in the TDR bit which further doesn't set the transfer complete flag.

Can you please tell where i am going wrong or what i am missing out. Why is this happening?

0 Kudos
Reply

309 Views
VaneB
NXP TechSupport
NXP TechSupport

Hi @soumik1506 

Sorry for the delay.

I was able to reproduce your problem, it seems that there is a problem with the pins used for MOSI, I need to do some further tests to verify this situation.

In the meantime, the workaround is to change the pins used. I changed PTF2 -> PTB27 and PTC9 -> PTE0.

VaneB_0-1728675314212.png

0 Kudos
Reply

273 Views
soumik1506
Contributor III
I have been trying this project using the pin available for the 172HDQFP package. Please tell me where i am going wrong and what is the theory behind it
0 Kudos
Reply

263 Views
VaneB
NXP TechSupport
NXP TechSupport

Hi @soumik1506 

Sorry for the inconvenience, but I am a bit confused, you mentioned "172 HDQFP package", but the EVB is a 289 MAPBGA package. Are you using a custom board?

0 Kudos
Reply

230 Views
soumik1506
Contributor III
Yes, i am using a custom board with 172 HDQFP package for my application
0 Kudos
Reply

201 Views
VaneB
NXP TechSupport
NXP TechSupport

Hi @soumik1506 

I am sorry for any inconvenience this may cause you, but since the software works on our end, it seems to be a hardware issue with your board. Since we cannot reproduce it, it is very difficult to pinpoint a hardware issue through this support channel.

Unfortunately, the only general guidelines I can give you is to follow the Hardware Design Guidelines for S32K3xx Microcontrollers (S32K3 MCUs for General Purpose – Hardware Design Package) and check the S32K3X8EVB-Q289 Evaluation Board Design Files. You can also try configuring another board or MCU to rule out a faulty product.

0 Kudos
Reply

398 Views
soumik1506
Contributor III
i have used that code and came up with the project that i have attached in the main post. I have made sure that the configurations are similar to the example. I have just added few lines where i am transferring the converted ADC input data from SPI instance 0 (master) to SPI instance 1 (slave) using half duplex support. Whatever changes i do in the code or in the configurations it is doesn't work. Can you please tell me where i am going wrong.
0 Kudos
Reply