I'm tring to write data to internal program memory using DMA. The chip I work with is TMS320C6701.
My code consists of two functions, the main function in internal memory and a DMA transfer function in external memory.
I want to overwrite internal program memory with the binary code data of a new program.
The procedure of the main function is :
1) read the binary file of the new program, store the data in extenal data memory;
2) jump to the DMA transfer function.
The procedure of the DMA transfer function is:
1) transfer data to internal data memory;
2) transfer data to internal program memory.
3) jump to the entrance of the new program
The transfer function works fine when transfering data to internal data memory, but not with internal program memory.
However, when I debug the code and run it by step, I can see the DMA registers change, DMA_SRC and DMA_DST are increasing and the new program works fine when the transfer is done(by checking the STATUS bits in PRICTL). If I run the code free without breakpoints, nothing happens.
TMS320C6000 DMA Example Applications(SPRA529A) says:
"Internal program memory always gives the CPU priority over the DMA. For the DMA to access
program memory, there must be time slots during which it can get in. These slots occur when a
fetch packet (eight instructions) contains multiple execute packets (a group of instructions
executed in one cycle). This leaves cycles in which the CPU is not requesting a fetch packet, and
the DMA can access the program memory."
Is it possible that when I debug the code by step, CPU stops requesting when I halt the code and DMA starts to work, but when I run the code free, CPU always have prioriy to internal program memory and DMA does not have access to internal program memory?
If so, how can I stop CPU and let DMA gain access to the internal program memory?
Thank you!