Hi,
Possible issues…
- Reset while flashing … some SBC or anything
- Incorrect Flash clocks … good to check also bus clock
- The MCU is secured…suggest t mass erase entire memory and then write unsecure bits because if they are not set to unsecure state then any reset secures the MCU.
- The MCU is secured after loading the code. It is not possible to read the code from outside but it should be normally executed.
Best regards,
Ladislav