We don't know what you know about trucks and electronics, so an easy start. Every 12V truck circuit needs power and grounds. It appears you have some power and some grounding, but you need to be sure you have circuits that have no excessive resistance. If you live in salt country, the salt causes corrosion, and corrosion is resistance. You need to check the ground at the trailer connector vs the ground at the battery negative terminal. This is called voltage drop testing and can be done on both the negative wiring and positive wiring. The only tool needed is a voltmeter. Lots of youtube videos about voltage drop testing, South Main Auto is my favorite poster. That's where I would start.
There are 2 electrical devices near the rear axle near the frame and they are the relay and the module. The module has the 'smarts' and the module outputs the power to the brakes. That's the easy explanation. Of course it's much more complex than that. Many people find that replacing the relay fixes their problems, others replace the module, and some replace both. Your problem COULD be there.