SPI-FLASH DMA(PSOC4) | Cypress Semiconductor

SPI-FLASH DMA(PSOC4)

Summary:3 Replies, Latest post by chongchong.ding_2073086 on 24 Apr 2017 01:34 AM PDT
Verified Answers:0
Last post
Log in to post new comments.

hi,bro:

   I got some troubles with PSOC4 ble kit,and need some help.

Q :Cause of the low speed of write flash directly with "spi serial communication block", we have decide to use the DMA component,but i am puzzle with the struct "cydma_init_struct".

the "addressIncrement" field witch comment as:   /* Specifies whether the source and/or destination address will be
   * incremented after the transfer of each single data element.*/

i donn't know how to configure with it where i actually need the source address increased but does not the destination address.

what's more ,could you post me the detail of this struct ,or the sample driver of 'S25FL128' will much more better.

                                                                                                                                                     thanks a lot!

user_1377889's picture
User
10249 posts

Welcome in the forum.

"Q :Cause of the low speed of write flash directly with "spi serial communication block" This might be a language problem, so can you please tell us a bit more what you exactly mean.Writing to flash using DMA is not possible and the question is why you want to write to flash at all:

 

Bob

hli
user_78878863's picture
User
2689 posts

Sorry, my crystal ball is currently in repair, but I can make an assumption:you want to write to a SPI Flash memory chip (S25FL128).We would need to look at your code to determine why you think SPI communication is slow.You can be quite efficient when sending data via SPI, when using the FIFO (basically as fast as you can write a look checking a flag and putting a byte into memory).

When you want to use DMA:the source address needs to be incremented so you transfer the complate buffer.Start at the beginning of your buffer, and set the transfer count to the size of your buffer (e.g. 256 bytes).The destination address is the FIFO register of the SPI master.Read the documentation of the DMA component, it explains all the needed API calls.

Using google for 'psoc spi dma' I find two app notes regarding SPI master and DMA.Altough they are for PSoC3/5, the principle should be clear.

hi:

you are right,that's what i want to do.when i try to eraseall the flash ,but failed.please see the code below:

 

cystatus EMI_EraseAll(void)
{
   EMI_SPIM_SpiUartClearRxBuffer();
   EMI_SPIM_SpiUartClearTxBuffer();
   uint8 cmd[2]={NOR_FLASH_INSTRUCTION_WRITE_ENABLE,NOR_FLASH_INSTRUCTION_BULK_ERASE};
   EMI_SPIM_SpiUartPutArray(cmd,2);
   while(EMI_SPIM_SpiUartGetTxBufferSize()!=0) 
   {
   }
   EMI_SPIM_SpiUartClearRxBuffer();
   EMI_SPIM_SpiUartClearTxBuffer();
   while(EMI_IsBusy())
   {
       ;
   }
   return (CYRET_SUCCESS);
}

Log in to post new comments.