What is your thinking behind a PWM?
Your description is to turn on the relay, then delay in a LONG loop and repeat.
PWMs are used to control things "quickly" like managing current by pulsing quickly (many times per second)
If you want to use "baremetal" then fins a millisecond delay loop. Typically there will be one that uses the system tick.
IF you aren't concerned about power (i mean really low power) then it doesn't really matter much if you use a crystal for a clock or one of the internal oscillators.
IF you can invest the time to figure it out, try using MQX-Lite, This will let you setup a clock source, give you a delay function, and let you create a task to turn things on and off on a schedule. AND this will be a solid basis for additional projects in the future.