How to configure the Chip Select output in SPI communication of MPC5748G?

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

How to configure the Chip Select output in SPI communication of MPC5748G?

1,221 Views
Hanry
Contributor I

1.Question description

How to configure the Chip Select output in SPI communication of MPC5748G from the default optional pin to another Chip Select output pin of DSPI?

Hanry_0-1645076349802.png

the default pin of Chip Select output  in SPI_0 communication of MPC5748G is PI15. there is need to change the pin PI15 into PD15 of DSPI_1.

Hanry_1-1645080236098.png

Hanry_2-1645080290765.png

2.Source program

Hanry_3-1645080814912.png

Hanry_4-1645080852686.png

3.The changed program

Hanry_5-1645081033606.png

Hanry_6-1645081101284.png

The changed program doesn't make the SPI communication. Don't know what the problem is. Hope someone can help me. Thanks.

 

 

 

 

 

 

 

 

0 Kudos
Reply
4 Replies

1,162 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

this is bus signals from original demo.

PetrS_0-1645450466211.png

You can see chip select is deasserted. Seems spi_pal driver does not allow continuous selection.
After your modification, you did it in fact, but probably it is not allowed. Bus signals is

 PetrS_1-1645450599614.png

So you need to deassert CS between each byte, you can do it as 

PetrS_2-1645450691116.png

then signals looks 

PetrS_3-1645450713619.png

and communication is correct.
You can also test dspi driver which has an option for continuous selection.

BR, Petr

 

1,115 Views
Hanry
Contributor I

The problem has been solved. Thank you very much for your help!

Wish you a pleasant day

0 Kudos
Reply

1,205 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

so does it mean you do not see PTD15 pin toggled by SW?
You should not set PTD15 in DSPI tab of pin_mux component, but rather in SIUL tab.
So remove it from DSPI1 and add below

PetrS_0-1645178048554.png

generate PE code and build.

BR, Petr

0 Kudos
Reply

1,174 Views
Hanry
Contributor I

Thank you for your reply.

I'm sorry we didn't make this problem clear. Let me rephrase the question.

1.Question description

The official demo program uses SPI_0 and DSPI_0 configurations in SPI communication. Where, the default pin of Chip Select output in SPI_0 is PI15.

Hanry_24-1645423303050.png

Hanry_25-1645423324915.png

We now need to use a different pin as the CS output pin. Here, we chose the PD15 pin in GPIO.

Hanry_27-1645423462947.png

Hanry_36-1645428175243.png

Generate PE code and build.

Hanry_37-1645428207089.png

Hanry_30-1645423645505.pngHanry_31-1645423654930.png

2.Source program

The source program for SPI communication is shown below.

Hanry_34-1645423878931.png

Hanry_35-1645423945159.png

3.The changed program

Hanry_39-1645428378515.png

First pull the PD15 pin high.

Hanry_40-1645428445218.png

Then, pull the PD15 pin low before communication, and pull the PD15 pin high after communication.

But, the changed program doesn't make the SPI communication. Don't know what the problem is. Thank you for your help. Thanks.

 

0 Kudos
Reply