Without model numbers we can't give you an exact answer.
On many receivers you have to assign a connection to an input name. Check the receiver input set up menu.
On the TV you may have to turn the optical output on, the internal speakers off, and change the audio output type to get it working.