I have the following scheme RPI, L298n with 6v DC motor. I'm trying to add a XL6009 boost converter but set to boost 5v into 6v but sometimes the motor is rotating and sometimes is buzzing. Does this have any connection with PWM? I would like the motor to rotate all the time when I run my code. Without XL6009 is working without any problem.
"sometimes the motor is rotating and sometimes is buzzing" is a clue that the boost IC does not have enough current to start a stopped motor. It is random because the position of the motor contacts is not random.
At a stop state the motor contacts are engaged so the motor will start. Either the start current is borderline with what the booster IC can work with, or you need larger value electrolytic caps on the power to the motor.
Also check the current limiting on the booster IC. Maybe it is adjustable and can put out more current safely to start the motor every time. The 'buzzing' sound is the boost IC trying to start the motor with pulses of current that are not quite strong enough, so the motor does not turn, but sits there in an over current state-buzzing. The motor needs more starting current.