Hi,
I've got a module with the Kinetis PK60X256 and I need to write to an external Flash. This external flash is a Micron M25P80 Serial Flash.
To do this, I'm using an example of SPI communication for the K40x256 DMA. But I'm not sure if this is totally compatible with my MCU.
Is this example's code compatible with what I need? I ask this, because I don't get what I suppose that I should get.
And, if it is, I would need to know how to write a READ IDENTIFICATION function to start checking things to know what could be wrong, but in the example, almost all the functions are WRITE functions, so I don't know how to build a Read function. These are the functions that I'm using from the example commented:
//INIT
SPI_Init
//WRITE
Mem_WriteEnable
Mem_WriteSR
Mem_Set4TXDMA
DMA_Init_Tx
SPI_DMA
//READ
DMA_Init_Rx
SPI_DMA_Rx
Mem_EraseSector
I are working very well here with an M25P16. I'm not ready to just 'give' our routines to the 'whole world', but if you contact me at goodrich@lectronix.biz I will be happy to supply our ID and read/write routines. We don't use DMA, partially because at the times-of-access saving the CPU cycles is not useful, but just as much because doing DMA with this SPI module is 'difficult', what with the packed command bytes in every write cycle.
Hi Earl,
I have solved the read problem and apparently also the bulk erase problem.
What i have done is to uncomment the line "SPI2_MCR |= SPI_MCR_CLR_RXF_MASK; //Make sure each command starts out with empty Rx FIFO" into the function "fnSPI_command"
Now the only problem is that i still can't erase a sector.
Any help will be apreciated.
Thanks and best regards