Reading SPI NOR ID using kinetis k70

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

Reading SPI NOR ID using kinetis k70

743 Views
sameerarvikar
Contributor III

I am using spi 1 of kinetis k70 (connected to spi nor)

I am trying to read manufacturer id of spi nor ,

For this i have to write "9f" to spi nor and it will written manufacturer id ,but i am able to read the data

I have used the example given in help

and used spi and consoleio components from processor expert

#include "Cpu.h"
#include "Events.h"
#include "SM1.h"
#include "CsIO1.h"
#include "IO1.h"
/* Including shared modules, which are used for whole project */
#include "PE_Types.h"
#include "PE_Error.h"
#include "PE_Const.h"
#include "IO_Map.h"

#define BLOCK_SIZE 4

uint8_t OutData[BLOCK_SIZE] = "9F";

uint8_t InpData[BLOCK_SIZE];
volatile LDD_SPIMASTER_TError ComError = 0U;
LDD_TError Error;
LDD_TDeviceData *MySPIPtr;

int main(void)

{
/*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/
PE_low_level_init();
/*** End of Processor Expert internal initialization. ***/


MySPIPtr = SM1_Init(NULL); /* Initialization of SM1 component */

while(1){
SM1_SelectConfiguration(MySPIPtr, 1U, 1U); /* Select chip select 0 and attribute set 0 */
Error = SM1_ReceiveBlock(MySPIPtr, InpData, BLOCK_SIZE); /* Request data block reception */
printf("Receive --> %x\n",InpData);
Error = SM1_SendBlock(MySPIPtr, OutData, BLOCK_SIZE); /* Start transmission/reception */
while (!SM1_GetBlockReceivedStatus(MySPIPtr)) { /* Wait until data block is transmitted/received */
SM1_Main(MySPIPtr);
}

}

#ifdef PEX_RTOS_START
PEX_RTOS_START(); /* Startup of the selected RTOS. Macro is defined by the RTOS component. */
#endif
/*** End of RTOS startup code. ***/
/*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/
for(;;){}
/*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/
} /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***/

/* END main */
/*!
** @}
*/
/*
** ###################################################################
**
** This file was created by Processor Expert 10.5 [05.21]
** for the Freescale Kinetis series of microcontrollers.
**
** ###################################################################
*/

So when i print i get Receive --> 1fff00d8

which is some wrong value ,ii think i am not reading correctly,what should i change in the program to do it

Labels (1)
0 Kudos
4 Replies

513 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi,

Please refer below document as an example:

https://community.nxp.com/docs/DOC-100304 

Wish it helps.


Have a great day,
Ma Hui

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

513 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi,

Could you provide more info about the SPI NOR Flash part number?

And if possible, could you post the Processor Expert code for double check?


Have a great day,
Ma Hui

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

513 Views
sameerarvikar
Contributor III

N25Q00AA13G1240E

I am not able to find any link to attach the generated code of processor expert

0 Kudos

513 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi,

Please check below picture to use advanced editor to attach the project.

pastedImage_1.png

Best regards,

Ma Hui

0 Kudos