I believe I have accidentally overwritten the option setting memory when uploading a program to an RA2A1 MCU. I am using it with a J-Link mini tool on Linux. The symptoms are:
1) I can reset and halt the CPU and examine registers and memory
2) I can single step through the program
3) Writes to SRAM are ignored - it always reads as zero
4) I can't flash new code/option bytes as the JLink tools require use of RAM within the MCU
Is there a way to restore the device to factory defaults using the J-Link mini tool. I have tried various Renesas tools and none seem to work. I keep getting an error "Emulator does not support pin override"
If you have enabled the security MPU by writing prgram data into the Option Setting memory 0x400 to 0x43F
then there is the destinct possibility you have locked the device. The only thing I can suggest…
How's it going so far? I hope our RA experts can give you a definite answer soon. In the meantime, you might want to refer to these resources and see if you'll get some ideas. Kindly refer to these urls:
Renesas RA Family System Specifications for Standard Boot Firmware
Clearing ID Codes using the ALeRASE Command with Synergy MCUs | Renesas Customer Hub
RA2A1 Group, RA2L1 Group, RA2E1 Group, RA4M1 Group, RA4W1 Group, RA6M1 Group, RA6M2 Group, RA6M3 Group, RA6T1 Group, Note on ALeRASE command (renesas.com)
I hope that can help you. All the best!
SaiRenesasRulz Forum Moderator
then there is the destinct possibility you have locked the device. The only thing I can suggest is you try the attached script, that will try to erase block 0 of the code flash, with the JLink directly writing to the flash controller registers (rather than using a RAM based kernel to do the erasing, that it normal does).You will need the Segger software and documentation pack to be installed :-www.segger.com/.../Then edit the JLink_path.bat to point to the location of JLink.exe.Open a CMD prompt and run Erase_Block_0_RA2A1.bat.If it erases block 0 of the code flash successfully, you should see :-
If this does not work, then the device really is locked.
The script is written for Windows.
Thanks Jeremy. That worked great for me. I'm running on Linux and had to do my own version of the batch file but the jlink script did the trick. I was trying figure this out yesterday and had got a little bit down the road you are suggesting but it would have taken me a VERY long time to get all of those commands figured out.
Hello again Jeremy, thanks again for your help. I have put together a few low level examples with a view to educating myself about the operation of the RA2A1 over here: https://ioprog.com/2021/06/17/the-renesas-ra2a1-microcontroller/