S32K144 Fatfs

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

S32K144 Fatfs

Jump to solution
9,548 Views
Teja114
Contributor III

Hi there ,

I tried to port fatfs to S32K144 device , it compiled but not working .

please find the attachment , and give me the suggestions what  to change in the code ...

Thanks in advance .....

Labels (1)
0 Kudos
1 Solution
9,529 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi,

The project is rather complex, we can't debug it for you.

Do you have any specific questions?

 

Thanks,

BR, Daniel

View solution in original post

0 Kudos
16 Replies
9,455 Views
Teja114
Contributor III

Hi @Mrudula ,

please find the attached image ..

for the CS pin check out pin mux configurations i mentioned it as a PORTE->PCR[6] |= PORT_PCR_MUX(1); /* Port E6: MUX = ALT1, LPSPI1_PCS3 CS */. iam using CS as a GPIO pin .

if you want to use as a dedicated chip select PORTE->PCR[6] |= PORT_PCR_MUX(2); depending on your pin configurations ...sd_card_pins.JPG

9,319 Views
rathi_tg
Contributor III

Hi @Teja114 

 

The file which you have shared is very helpful.

But, I made few modifications as a part of experiment.

Basically, I changed the Configuration of the pins as follow:- 

PCC->PCCn[PCC_PORTC_INDEX] |= PCC_PCCn_CGC_MASK; /* Enable clock for PORTB */
PCC->PCCn[PCC_PORTA_INDEX] |= PCC_PCCn_CGC_MASK; /* Enable clock for PORTB */
PORTC->PCR[15] |= PORT_PCR_MUX(2); /* Port B14: MUX = ALT3, LPSPI1_SCK */
PORTC->PCR[0] |= PORT_PCR_MUX(2); /* Port B15: MUX = ALT3, LPSPI1_SIN */
PORTC->PCR[1] |= PORT_PCR_MUX(2); /* Port B16: MUX = ALT3, LPSPI1_SOUT */
PORTA->PCR[15] |= PORT_PCR_MUX(2); /* Port B17: MUX = ALT3, LPSPI1_PCS3 */

 

PCC->PCCn[PCC_LPSPI2_INDEX] = 0; /* Disable clocks to modify PCS ( default) */
PCC->PCCn[PCC_LPSPI2_INDEX] = 0xC6000000; /* Enable PCS=SPLL_DIV2 (40 MHz func'l clock) */

 

 

"All the LPSPI0 are replaced with LPSPI2" in SPI_MSDO_Driver .

The Cord Builds fine without any error but no data is written on the Sd card.

Output on console is "Write Error 3".

 

Could you Even Throw light on Data Reading From Sd card.

 

Thanks in Advance!!!

Regards

Gopal Rathi.

0 Kudos
9,298 Views
Teja114
Contributor III

Hi @rathi_tg ,

please check the pin configurations first.

Did you changed the pins on reading the datasheet ?

Is the PCR_MUX is '2' ? or something else ?

cross check the code with  datasheet .

Thanks,

Teja..  

0 Kudos
9,292 Views
rathi_tg
Contributor III

Hi @Teja114 

I tired Searching the Mux value but could not figure it out.

Could you Please guide me too do the Same

Regards 

Gopal Rathi

0 Kudos
9,290 Views
Teja114
Contributor III

Hi @rathi_tg ,

 

Open the  S32k reference manual .

please find the attachments where can you find 

0 Kudos
9,281 Views
rathi_tg
Contributor III

Hi @Teja114 

I have followed the Excel sheet and made changes as required.

But, I am still unable to write data on SD Card.

I have attached the .c file of the Driver.

Please let me know if i missed something.

 

Regards 

Gopal Rathi.

0 Kudos
9,240 Views
Teja114
Contributor III

Hi @rathi_tg ,

i went through the file , everything was looking fine. 

please check the connections from sdcard module to board .

And the supply voltage should be 3.3v.

if you're using sdcard module it is having 5v to 3.3v  regulator , must give 5V as a input .

Thanks,

saiteja.v

0 Kudos
9,175 Views
rathi_tg
Contributor III

Hi @Teja114 

If I amusing the Configuration which you have specified everything works fine. But, as soon as i change the pin configuration I am unable to read or write the data.

 

I have tried various combinations of pins as well as LPSPI but was not successful.

 

Could you please once change the Pins to other Configuration Lets take LPSPI2 and burn the code and let me know if it was successful.

I have Tried the same using LPSPI0, LPSPI1 and LPSPI2.

 

Thanks in advance.

Regards

Gopal Rathi.

0 Kudos
9,169 Views
Teja114
Contributor III

@rathi_tg ,

Sure will try and let you know ....

0 Kudos
9,163 Views
rathi_tg
Contributor III

@Teja114 

Thanks for help.

Will be waiting for your response.

Regards

Gopal Rathi

0 Kudos
9,530 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi,

The project is rather complex, we can't debug it for you.

Do you have any specific questions?

 

Thanks,

BR, Daniel

0 Kudos
9,523 Views
Teja114
Contributor III

Hi @danielmartynek ,

coding done its working ..

Thanks for your response

0 Kudos
9,481 Views
Mrudula
Contributor I

Hi @Teja114 ,

I am working on SD card data logging with S32k144. I found your drivers useful however I'm not able to see how and where exactly in the code the ports are configured for the MOSI, MISO, SCK and CS signals.

Could you please help?

 

Regards,

Mrudula

0 Kudos
9,471 Views
Teja114
Contributor III

Hi @Mrudula ,

find the zip file for sdcard data_logging  modify application layer for your requirements.

0 Kudos
8,767 Views
Nayan123
Contributor II

Hii, @Teja114 ,

I found your driver file really helpful.

But during debugging it is showing me creating directory failed 
: 3 on the console.

Could you help me to figure it out this error??

0 Kudos
9,463 Views
Mrudula
Contributor I

Hi @Teja114 ,

Thankyou for your help! In this zip file too I'm not able to find how the MOSI,MISO , SCK and CS signals are configured for hardware implementation. Please help.

 

Regards,

Mrudula

0 Kudos