Hi @Rp777 ,
Thanks for your private message code.
Do you test it on the NXP MIMXRT1020-EVK board, also meet the issues or not?
You mentioned it fails in mem_init, which detail function, give me the related debug result.
I checked your code, you already use the RT1020 related files in the SDK.
Do you try to build release project, and download it to the MIMXRT1020-EVK board, then test it with the blhost, whether your usb connection works or not?
As the ota_bootloader also can support the flashloader function.
The ISP related command:
https://community.nxp.com/t5/i-MX-RT-Knowledge-Base/RT1060-OTA-bootloader-ISP-and-swap-rollback-usag...
2.2 ISP test related command
You can try it on your side.
Due to COVID-2019, I am limited to working at home, and don't have the MIMXRT1020-EVK board on my side, so I can't test it, and need your test result to analysis it.
Best Regards,
Kerry