S32K148 - LPSPI Simulink Example

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

S32K148 - LPSPI Simulink Example

1,802 Views
mfarag
Contributor II

Hi all,

I am trying to adapt the S32K144 LPSPI example to the S32K148 board.

The connections as described in the example is as follows:

pastedImage_1.png 

I have made the following changes but no success:

[Master: MOSI] B1 - A20 [Slave: MOSI]

[Master: MISO] B3 - A18 [Slave: MISO]

[Master: SCK  ] B2 - A19 [Slave: SCK  ]

[Master: PCS0] B0 - A21 [Slave: PCS0]

pastedImage_15.png

By Freemaster, I always get the value of A to increment, meanwhile the slave receive value is always 0

pastedImage_16.png

Can someone help in this topic?

Thanks,

Mohammed Farag

Labels (2)
0 Kudos
3 Replies

1,041 Views
constantinrazva
NXP Employee
NXP Employee

Hello mfarag‌,

The changes you did seem to be good - can you send me the exact model you're using to test it myself? There might be an issue where the variable you are using in FreeMASTER to read the received data is not generated in Simulink. If that is the issue, you'll just have to go to the respective dataStoreMemory block, right click, go to options, Signal Attributes tab and select from the Code generation - Storage class to be Volatile. This way you can make sure the variable is generated. Once you post the model I can quickly check this out for you.

Hope this helps,

Razvan.

0 Kudos

1,041 Views
mfarag
Contributor II

Hello constantinrazvan.chivu

Thank you for your fast response. The model is attached in the original post (I am attaching it here as well).

Best regards,

Mohammed Farag

0 Kudos

1,041 Views
constantinrazva
NXP Employee
NXP Employee

Hello mfarag‌,

I've tested your model and the master outputs the correct signals (observed on the oscilloscope) but the slave does not respond. The settings are correctly set, but there seems to be a problem with the pin usage - if I use the following pins, the model works as expected:

Master (LPSPI0)                           Slave(LPSPI1)

   (SIN)     PTE1                                (SIN)     PTD1

   (SOUT) PTB1                                (SOUT) PTD2

   (SCK)    PTB2                                (SCK)   PTD0

   (PCS0)  PTB0                                (PCS0) PTD3

I have attached the model with the LPSPI configured with these pin settings. I will try and find what is the problem when using the pins that you initially configured. There may be a mismatch between the board and the schematic or some other problem. I will post back here when I find out what exactly triggers this behavior.

Hope this helps,

Razvan.

0 Kudos