This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi Hercules experts,
I have an silly issue (I reckon) but spent hours to figure out without success.
I use DMA to continuously transfer 12 ADC results to a memory. The memory is defined as static in the adc.c module. ADC is configured to do the conversion continuously, and DMA is triggered when all 12 channels have been converted.
When debugging, the memory address monitored gave me expected results. See picture below.
However, when I read the memory in the application , it gave me the initialised data instead of the ADC data seen above. Insert a breakpoint to the reading adc function, the memory is automatically reset to my initialised data 0xA5, and this is the data I've got in the application instead of ADC data seen above. See picture below
If I cleared the breakpoint and let the the program run freely, then refresh the memory browser, I see the ADC data again in the debug window but not inside the application. Try continuous refreshing also gave me updated ADC results frequently in the debug window only.
I suspect the issue has something to do with memory mapping. Please anyone can explain and give me a suggestion to solve this?
Many thanks.
Phil
Hi Charles,
Thank you for the explanation, it makes much more sense now. Thanks a lot!!
I try to insert a breakpoint when CPU get into the prefetch abort, but it never get hit. By pausing the program I've got the following status
The instruction fault address is right at the prefetch abort entry, and the instruction error status is zero.
Is there something I missed when debugging?
Kind regards,
Phil
Hi Charles,
You said if you place a breakpoint at prefetchEntry and it will never stop there. If you simply halt the CPU and you will find the PC already at prefetchEntry. Is this the correct understanding?
Yes that was what I meant.
Can you first place a breakpoint at prefetchEntry and do a system reset and then let it run?
That is always the case how I debug. Tried to reset/restart and place a breakpoint at prefetchEntry, then run. However that breakpoint never gets hit.
Can you also show the instruction fault status register? You only showed the auxilliary fault status register.
I'm still puzzled as to how a prefetch abort is generated. I can understand better if it is a data abort exception. Prefetch abort means an error is detected while the CPU is fetching the code. Are you solely running code out of the flash? Can you show your MPU setting like below? You have shown the IFSR and IFAR. Can you also show the Data Fault Status Register and Data Fault Address Register? Are they zero or not-zero values?
Rather than setting a breakpoint at the prefetchEntry, you can also try enabling "Break on Undefined Instruction", "Break on Prefetch Abort" and "Break on Data Abort" in the CCS debugger ARM Advanced Features. That causes the debugger to halt upon any of those exceptions.That is always the case how I debug. Tried to reset/restart and place a breakpoint at prefetchEntry, then run. However that breakpoint never gets hit
The following example is a program halting upon after a Data Abort exception caused by a test program which deliberately accessed an invalid pointer at address 0x1234DEAD as a result of "Break on Data Abort" being selected:
The CCS debugger doesn't seem to remember the settings for "Break on Undefined Instruction", "Break on Prefetch Abort" and "Break on Data Abort", so you have to re-enable them every time a new debug session is started.
Hi Phil,
For some reason you are writing to the flash as indicated by the Data Fault Status Register and Data Fault Address Register. Can you setup a watchpoint and watch for the address 0x37. 0x37 is what is indicated in the data fault address status. But I think you can watch any address that is in the address range of the flash memory. So once you setup the watchpoint then edit below breakpoint property when setting up the watchpoint. See the Range Mask is set to 0x3FFFFF. So the watchpoint is watching for any write to the first 4MB of CPU memory map.
Are you running some type of RTOS?