Hi @AsafTv
Please accept my apologies for delaying on my response. I really appreciate your patience.
Regarding your issue, it seems that it is not a problem with the code, because that error always appear when your target is not being recognized by your computer or some hardware issue is happening.
Also I would like to know if you still need help with the code for emulating EEPROM, because I did not receive answer from you to the email that I sent you. I achieved to get a demo that might be helpful for the request that you asked on your other closed request.
Please let me know your comments, and I will stay tuned to your answer.
Best Regards.
Pablo Avalos.