Flight Crew Multiengine; Flight Crew Instrument; Flight Crew Air Transport Pilot (ATP)
Situational Awareness; Troubleshooting
Aircraft Equipment Problem Critical; Flight Deck / Cabin / Aircraft Event Smoke / Fire / Fumes / Odor
Air Traffic Control Provided Assistance; Flight Crew Landed in Emergency Condition; Flight Crew Diverted; General Maintenance Action
Environment - Non Weather Related; Aircraft
Climbing out of ZZZ; my FO informed me that he was having problems trimming down the aircraft. As he voiced that statement. The message PTRIM MAIN INOP appeared on our ECIS. I aided him with the backup trim and the aircraft was in control. We then engaged the autopilot and it worked. During that time; I took the radios and read the QRH. As I reached the part of Main Trim Cutoff and push it. My FO informed me that the autopilot had not been following the flight director and he was going to turn it off. As soon as he voiced it- the autopilot disengaged and we got an ECIS message AUTOPILOT FAIL. At the same time a foul odor was smelt in the flight station. Our FA [Flight Attendant] rung to say that there was a foul odor in the cabin. With that we [notified ATC] and prepare the aircraft. We choose ZZZ1; [and] informed ATC. Advised the number of souls and fuel on board. I informed the FA and she prepared the aircraft without a need to brace. Obtained the weather for ZZZ2 and was given the ILS Rwy XX and thus prepared it. Obtained the speeds and flap settings. We landed safely and then I asked the FA if there was any smoke or if she could smell that foul odor. The answer was a negative and so we comfortably to the gate.
EMB-145 Captain reported a sudden onset of foul odor in the aircraft while handling a 'Pitch Trim/Auto Pilot' malfunction. Flight crew executed a diversion.