Thanks for your reply sir Ladislav.
Do you think is it a problem to use internal pull up outside of the main box of the embedded systems that I am building?
I tried to disable the pull up in Port AB and M as I was thinking that external pull up circuit are more safe.
If I can't disable internal pull up I will put a transistor to switch to the ground on every signal that goes out to a remote switch.
An other point that I am thinking about is the way I write to the register.
You suggested DDRA &= B11000011
I do DDRA = 0x00.
Normally the reset state of DDRA is all zero then even if I don't write the register it should be the right setup.
But maybe the way I write to the register is not right. I will try your method.
And do you think I need to setup the pins before or after the CAN initialisation?
Actually I do bus clock then vars initialisation then pin setup then Sci initialisation then CAN initialisation.
Maybe it mess up the port initialisation previously done and I need to initialise the CAN and Sci before the pins.
Will try everything again when I have time.
Regards