Update, it's resolved. tumbleweed was wright. I have tried to replicate the problem with the sound function and serin2/serout2 problems and it's only the ANSELC that was not set properly.

To my "excuse" here is a picture of the Datasheet and why I dismiss ANSELC at first. Thank you Ioannis, tumbleweed and Richard. To Richard, I wrote a small program to check for the problem, but there is nothing to check anymore. The PPS registers can be ignored if the peripherals are not enabled (confirmed).

Name:  Screen Shot 2025-03-07 at 10.57.44.398 AM.png
Views: 623
Size:  74.2 KB