been searching for a while and cant find a good way to reflash from custom rom back to samsung stock nougat firmware.. flashing with odin always failed
<ID:0/003> Added!!What is the fail code for odin?
you can try different odin versions ( sometime older version works) and different usb cable then odin will flash successfully.
If both failed, you can flash working custom rom than try to flash with odin.
Hope these works...