SPI communication with microSD card

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

SPI communication with microSD card

2,349 Views
r_1280
Contributor II

Hello,

I currently working on a project where I need to communicate with a SD card using SPI. As of now I think I successfully managed to send message, but the RXDATA is always 0. Anyone who knows what I am doing wrong here? I do find it strange that the TxData doesn't reset to 0 after the transmission finished flag is set...

I linked the source and include folder as a zip file. The electrical schematic of the SD card is also included together with the correct pins on the MPC5744P.

Regards,

Ruben

Tags (2)
0 Kudos
Reply
3 Replies

2,320 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

seems pin setting is not correct if you are using MPC5744P DSPI_3 on PD5, PD6,PD7 and PD12 pins.
Check pin muxing table of the MPC5744P RM.
SIN config looks right, but SOUT, SCK should have SSS=4. DSPI_3 PCS2 is on D12 pin, so either use this, set SSS properly and update command word to use CS2 in code or select different pin where CS0 is available, like PD10.

BR, Petr

0 Kudos
Reply

2,310 Views
r_1280
Contributor II
Hi Petr,

Thank you the reply.
I changed the SSS of the SOUT and SCK pins to 4 now and the SSS of PD12 to 3 for CS2. However, when I change the PCS flag in SPI_3.PUSHR.PUSHR to either 2 or 3 I still don't receive any other response than 0. Is there something I am missing here?
0 Kudos
Reply

2,288 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

update MCR[PCSIS] as well to have defined inactive state for used PCS.
Then try to disconnect slave and connect SOUT to SIN and send frame, to know it will be received and you will know pins are properly configured. If yes, connect slave and try to communicate to it. Measure SPI signals with scope/analyzer to know frame is correct.

BR, Petr

0 Kudos
Reply