4 Replies Latest reply on May 2, 2017 7:46 AM by epr_1639216




          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!

        • 1. Re: SPI-FLASH DMA(PSOC4)

          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:





          • 2. Re: SPI-FLASH DMA(PSOC4)

            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.

            • 3. Re: SPI-FLASH DMA(PSOC4)



              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)
                  return (CYRET_SUCCESS);

              • 4. Re: SPI-FLASH DMA(PSOC4)

                It could be you are getting stuck in one of the two loops?


                Also, you can check the RX buffer and see if any return data is received.