While waiting for more useful replies - note that your J-Link module version in the IAR IDE is 7.88j - quite old. Consider installing the latest J-Flash version from Segger. It should find and update J-Link module in your IAR installation.
Same Error: Failed to restore target. RAMCode never stops ERROR: Erase returned with error code -5.
It is related to bad board power delivery design.
To give better visibility on the answered topics, please click on "Best answer" on the reply which solved your issue or answered your question.Best regards,FBL