Hello Support,
Can you please provide "Example Code including CCS Project" to Read from and Write to RAM ECC Area [0x0840_0000 -- ] using Bit 8 of RAMCTRL Register?
Thank you.
Regards
Pashan
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.
Hello Support,
Can you please provide "Example Code including CCS Project" to Read from and Write to RAM ECC Area [0x0840_0000 -- ] using Bit 8 of RAMCTRL Register?
Thank you.
Regards
Pashan
Hello Pashan:
I believe the attached project is the example you are looking for. This test case is designed to execute from RAM using the RAM-FLASH Swap feature. As such, ECC RAM is mapped to 0x00400000 instead of the normal 0x0840000.
Hello Chuck,
In spnu499.pdf TRM, Page 302 shows the following text :
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
The ECC memory can also be directly accessed via memory-mapped offset addresses starting from 4MB,
as shown in . A read from the ECC space results in the 8-bit ECC value appearing on each byte of the
64-bit CPU data. The ECC memory can only be written to as a 64-bit access. The write to the ECC space
must also first be enabled via the RAM Control Register (RAMCTRL).
Accesses to the ECC space are not traced out to the RAM Trace Port (RTP).
------------------------------------------------------------------------------------------------------------------------------------------
I have marked in RED. In the code I see you are writing in BYTE mode in ECC99.c file at following line :
*temp_ram_odd = 0x0F;
So, which one is correct?
TRM or code?
Please help,
Thank you.
Regards
Pashan
Hello Pashan,
I am working to get clarification on the discrepancy between the TRM and the test case. At this point, though, I am fairly certain that the TRM statement is not correct and that the ECC RAM can be written as a byte. This is because the ECC data is an 8-bit value that corresponds to a 64-bit RAM value so there should be no issue in only modifying the 8-bit value by itself.
Hello Chuck,
I am attaching a PDF file which shows that the given example does not write to ECC RAM Space by using a comparison.
The modified ECC99.c file is attached also.
Can you please try the modfied ECC99.c file as attached in the ZIP file at your place and confirm it is running?
Any help is appreciated.
Thank you.
Regards
Pashan
Hello Pashan,
I am not 100% certain what the issue is with the code you are running. When I execute the code on my bench, I get the expected results. (see attached screen shot)
One issue is that the compare that you are using if(*temp_ram_odd != 0x0A) is not the correct logic. The expected read value would be 0x0F. Note that this code is designed to be ran from RAM so you would need to perform the steps to complete a RAM swap with Flash. I don't expect that this is your issue though.
Hello Chuck,
I am attaching the PDF file which shows that I have modified the original CODE to write 0x0A instead of 0x0F.
Then I am comparing with 0x0A at the end of WRITE, by reading the ECC RAM Space.
The compare should pass and hence the Program should reach the end of main().
Instead, you will see that the code enters the COMPARE Fail BLOCK of code.
That is the issue I am trying to understand.
Yes, I am runing from RAM. By this, I mean, MEMSW = 0x05 in BMMCR1 Register. Then CPURSTCR = 0x01. Debugger will get automatic DISCONNECT. Then Connect Debugger again. Load the .out file into RAM.
Then RUN the loaded program.
Let me know if you are seeing the same problem.
Any help is appreciated.
I am assuming you are not performing any more steps in the DEBUGGER other than the one I have mentioned.
Please try modifying to 0x0A and compare with 0x0A at the end of WRITE.
You will see that it is failing and not going to END of main().
Thank you.
Regards
Pashan
Pashan,
I have a quick question about your attached pdf. You show that the bit is not changed.
If the code-execution behavior is due to latency in execution, then you will see a difference if you step through this code OR run through this code. Can you try this? If this is the problem, it is easy enough to read back the RAMCTRL register in order to assure that the writes have taken place prior to moving into the if-statement.
Regards,
Forum Support
Hello Support,
I am attaching the modified file for your review.
The comparison still fails whether I step through Debugger or RUN.
Please let me know after you review the modified code from the original baseline as given by Chuck.
Thank you.
Regards
Pashan
Hello Pashan,
I also was seeing mixed results when I checked this on the bench and executed it multiple times. One thing you need to be cognisent of is that once you corrupt the ECC value and halt at the forever loop in your check, you will have do do a system reset on the device and re-download your code to return everything to a clean state. If not, the next time you run you will possible have ECC enabled and a corrupt ECC value which will cause an exception. At a minimum, you wll have ECC enabled which will generate an abort when you attempt to write to the ECC RAM.
Also, I found that there were much better results when I moved your 'if' statement to the pabort() ISR after the ECC disable call. This is because with ECC enabled, the value shown within the debugger memory window will be a value that is adjusted/corrected by the ECC logic and will not really show what you wrote to it.
Debugging with ECC can be tricky since the logic will perform corrections on the data that is shown in the debugger and I think this is what is throwing us off in this case. Also, I have been using CCS5.2 while you have been using CCS3.3 which might also create some discontinuity in restults. I am hopeful to be able to install CCS3.3 on my lab PC and check under the same circumstances as you so we can, at least, be on the same setup. However, this isn't something that I can finish up this week due to some time constraints.