You are right about that. I will try to elaborate;
in my main.c I run a test-rutine that writes to an SDRAM address, verifies this by reading and checking the value, and afterwards writes on the serial-port
"Addr 0x%08x, Data 0x%08x, Counter %d \r\n",pData,*pData,i"
In case I should not read the right value I should get a:
"Error at address 0x%08x, Counter = %d",pData,i
When running the program like this, the last thing i see on the serial monitor is:
"Addr 0x280000bc, Data 0x55555555, Counter 47"
Right now I am trying to write and access the first 1000 addresses (4kb), so when writing on the serial-port for each itteration it stops at the 48th write/read, but not because verification of data was not successful. Instead it just stops.
When trying to write a change in software to the internal flash it fails. I need to set a jumper that halts the processor before it "crashes" so I can re-upload new software to test any changes.
I was wondering if I can access any hardfault interrupt vectors (or any failure vectors) through the j-tag interface so that I can see where in the program it crashes?
It is worth to mention that I have made a TestArray[1000] where I use the same verification function as for the SDRAM so test wether it was my test-function or SDRAM config that was making these crashes.
When I try to write data to the array, verify and serial-print the results, it does the same thing as for the SDRAM. NOW - when I do the same test but I disable my setupexternalmemory() function, it works fine!
I have also tried the SDRAM verification for the first 1000 addresses without serial-writing for each address. Before It would crash at the 48th itteration EVERY TIME. In this test I get a "sucess" around 50% af the times. The other 50% it crashes.
It seems very strange so I am wondering what in my code makes this crash. I don't know what exactly is happening to the M4 core when it suddenly stops giving serial-data and I have a hard time re-uploading new code to the internal flash.
I have attached my project to this answer