RX/TX problem: ARDUINO code on ATMEGA328P

Done, I add the setup code (the void loop code is not relevant I think).

I'm using a pin where pinMode is changing in different code parts.

EDIT: I have solved adding delay on setup part.