That's right, PWM is designed for brightness tuning, but it can also be used flexibly. Actually, the PERIOD can be programmed (see Chapter 47.2.2.5, mx51RM for the detail.) and the frequency is much accurate that GPIO way. Anyway, if the accuracy is not important, such as for a buzzer, the GPIO method should be OK.