I am using Texas Instrument's USB stick for the TMS320C5515 processor
and interfaced to this on the PCB is the NOR Spansion flash. The number
on the flash is: S29AL032D70TF104 002FF413K.
Question: Is it possible to
perform data buffer writes to the NOR flash (external memory) using Direct Memory Access (DMA) ? I am using the DMA 3 controller since only this can access external memory.
When I execute the Chip Support Library (CSL) code and integrate the NOR_write code for writing data from internal memory to using DMA, I get the following system message:
C55xx: Trouble Reading Memory Block at 0x400000 on Page 1 of Length 0x30: Error 0x80000002/-1143 Fatal Error during: Memory, The memory at 0x00800000 continually indicated it was 'not ready' All memory operations currently in progress were aborted in order to regain control of the processor. This is considered a catastrophic event, but the debugger should still be able to access memory and CPU registers. System state has been altered. It is strongly advised that the processor should be reset before resuming execution,
Though I am trying the write to the external memory it gives me this Trouble Reading Memory message.
(In this above mentioned USB stick, the NOR flash is external memory CS2 space. )
Thus any insights and help regarding NOR flash writing using DMA will help.
Before using DMA, make sure that the EMIF is programmed properly. This is accomplished through the use of the following registers:
Asynchronous Wait Cycle Configuration Register 1
Asynchronous Wait Cycle Configuration Register 2
Asynchronous CS2 Configuration Register 1
Asynchronous CS2 Configuration Register 2
These registers configure the EMIF's setup, strobe, hold, wait, and turn around time of each external access in terms of CPU clock cycles. It also sets the data bus width for the corresponding chip select. Once these are configured to match the timings of your NOR, the DMA should be able to read and write to NOR.
I am configuring the registers you mentioned as follows:
/* Config EMIF - ASYNC-Wait Config Registers */ EMIF_AWCCR1 = 0x00FF; // to set the MEWC field to maximum 0xFF; EMIF_AWCCR2 = 0x00E4; // bits 8 to 15 still remain non-zero EMIF_ACS2CR1 |= 0x000D; // Asynchronous data bus 16-bit width and // and Minimum turn-around time set to max 3.
EMIF_ACS2CR2 |= 0x4000; // bit 14 is tried to be set to '1' in order to enable the Extended wait cycles
// however bit 14 does not become '1' after this instr.
I do not know what other bits to set. I am referring to "SPRUGU6–March 2010 External Memory Interface (EMIF)" document.
When I execute the code, only every eighth word is correctly written to external NOR flash as is illustrated below:
Please note that for the present I only want to get the writing to NOR flash via DAM to be done perfectly.
Also the buffer that I am using to send the external memory is:
00A0 0005 00A0 0007 00A0 0009 00A0 000B 00A0 000D 00A0 000F 00A0 0011 00A0 0013 00A0 0015 00A0 0017 ....
The NOR flash is then reset to all FFFFs as:
FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF ...
And the data that is transferred to the external NOR using DMA is :
FFFF 0005 FFFF FFFF FFFF FFFF FFFF FFFF FFFF 000D FFFF FFFF FFFF FFFF FFFF FFFF FFFF 0015 FFFF FFFF
Thus only every eighth word is transferred.
Note that the buffer has 00A0 every alternate word since the NOR flash needs this to be able to write the next word.
Thus please give me further hints and clues what to do since I need to be able to write to NOR flash using DMA.
Thanks in advance.
Are you able to write to the NOR flash with out using DMA?. Are you sure that your flash needs only 00A0 for writing a word?. Most of the Spansion NOR flash chips require a specific command sequence(0xAA, 0x55, 0xA0) for programming a word. Please verify the NOR read and write operations with out using DMA to make sure that your EMIF and other configurations are fine. Then making the write operation work with DMA becomes easy. Check if your NOR flash supports command to write multiple words, this command is more suitable for DMA operation.
Yes I am able to read and write to NOR flash without DMA.
I am also able to read from NOR flash with DMA.
Writing to NOR flash with DMA is the issue. Pratap, Have you ever been able to do it ?
There is a Unlock Bypass Mode wherein after you unlock the NOR flash then it is only required to send 00A0 before every word to be written.
As answered to your email, DMA to NOR can not be done that simple. When DMA starts, it keeps writing to NOR and it's checking the writing finished.
Can you tell me why you want to use DMA write to NOR?
Please click the Verify Answer button on this post if it answers your question.
Check out these great resources
Hi Hyun et al,
It is nice to get your prompt reply.
I want to be able to write to NOR flash using DMA to be able to record voice samples while the DSP is doing some processing.
Now based on your reply I am trying to use the SD card to achieve my goal. Hope to interact and correspond with you for the same.
Thanks and Regards,
I'll do my best to resolve your issues.
As mentioned by you, part of programming the EMIF porperly is to configure the Asynchronous CS2 Configuration Register 2.
Now this is an I/O register at location 0x001011. The MSB of this register cannot be edited by programming nor by View -> Memory and physically
changing the value. If writing to the NOR flash using DMA is to be done then this has to be looked at and resolved.
I am using the USB ezDSP stick 5515. Code composer studio Version: 4.1.3.00038 and Code Generation Tool 4.3.5.
Thanks and regards,
Please check the configuration of "EMIF System Control Register (ESCR) [1C33h]" in your program.
You need to set this register to word access to allow the CPU to access 16 bits of the EMIF registers.
Thanks for your solution.
However the bigger problem does remain, that is, still I am not able to write data to the external NOR flash using DMA.
Only every eight word is getting stored.
All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.
TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs andembedded processors, along with software, tools and the industry’s largest sales/support staff.