USB board malfunction has become a common fault with this phone (and to be honest, all Samsung phones). The board rarely dies completely all of a sudden, almost always shows a couple of faults but works OK in other ways.
Fairly sure this will fix your problem, and given how cheap it is, you might as well try it before you start spending serious money taking it to a service centre or local mobile repair shop. If that's not the problem, it's likely something else on the motherboard but as to exactly what, that's impossible to say without the phone in front of us.
Replace the USB board & see, given you've tried different batteries & charges, it points to the board/port.
If it's important enough to cause you grief if it's lost, back it up. No excuses
Trolling for thanks is lame
Does Samsung's auto-brightness implementation crap drive you to self-harm ? A solution !
Failure to search is the leading cause of male impotence on XDA
If you don't know how to recover if things go wrong, what are you doing flashing custom roms ?