Issue with SD card using SPI on S32K146 - CMD17 response not zero ?

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

Issue with SD card using SPI on S32K146 - CMD17 response not zero ?

310 Views
johngreenjets
Contributor III

I am trying to and read and write to a mico SD card via SPI using the UCANS32K146 development board and the Fatfs driver, but I get an error at CMD17 (read single block).

This is the process:

1. Send CMD0.... receives 0x01

2. Send CMD8.... receives 0x00

3. Send CMD17.... and receives 0xC0 (with a 2GB card) and 0xFF (with a 16GB card).  This is where it fails as it is expecting a value of zero.

This is happening during when the 'f_open' function is called from main()...

	LPSPI0_init_master();

	f_mount(&FatFs, "", 1);		/* Give a work area to the default drive */

	fr = f_open(&Fil, "newfile.txt", FA_WRITE | FA_CREATE_ALWAYS);	/* Create a file */
	if (fr == FR_OK) {
		f_write(&Fil, "It works!\r\n", 11, &bw);	/* Write data to the file */
		fr = f_close(&Fil);							/* Close the file */

	}

 

The SD card board is a Digilent 410-380 connected to SPI0 on the NXP board...

johngreenjets_0-1705593692650.png

The code is attached for reference and code originally came from this post...

https://community.nxp.com/t5/S32-SDK/S32K144-Fatfs/m-p/1218874 

 

0 Kudos
0 Replies