This figure shows the pinouts of the P8 and P9 expansion headers on the BeagleBone Black, color-coded by subsystem. P9 is shown on the left and P8 is shown on the right, to match their physical orientation on the board:
The pins with multiple functions can only be used for one thing at a time, for example, PWM1A shouldn't be used if GPIO1_18 is already in use.