Problem with the BLDC motor's smooth rotation

The motor does not perform poorly at low speeds, for example, below 0.05 radians per second, but at higher speeds, it moves in a stepwise manner and always produces a loud noise. In addition to the motor getting slightly warm, the L298 driver also heats up. What is the problem?
In the closed-loop code, the motor can maintain its position, but there is still noise, and it does not respond to commands. If you forcibly turn it, it tries to correct its angle within a certain range, but after a point, it gets stuck in a specific area.

Hey Amir,
Welcome to the forum!

We will nee more information in order to help you with your questions.

What motor are you using?
What sensor?
What microcontroller?

Did you make sure that your driver and sensor are working right on their own?

You can check the getting started page in the docs:

"Thank you! In response to the questions, I should mention that the motor model is GM4108, and it seems to be functioning well, but I’m starting to have some doubts about it. Regarding the microcontroller, I initially started with an Arduino Nano, but due to the stepwise movement of the motor, I thought that the PWM resolution of the Arduino Nano might be insufficient. Later, I installed a bootloader on one of my Blue Pill boards, but the result was still the same stepwise movement and noise.
The sensor I’m using is an AS5048A, which I work with using its PWM output. I know you mentioned in one of the comments that these sensors don’t yield good results, but overall, I checked its output on the oscilloscope, and it appears to be functioning correctly.
Another issue I’m facing is that whenever I run the closed-loop code, I receive the following message:

‘MOT: PP check: fail - estimated pp: 1.34.’

I’m curious why this parameter is being estimated, and what’s more interesting is that as far as I remember, it estimates a different value each time. However, I do recall that they were all close to 11 with a difference of about 2 or 3. In my last test, the motor was able to maintain its position, so I conclude that the encoder is working fine. However, when I gave position commands, the motor behaved strangely. Do you think it’s possible that the motor is damaged?
Another question I have is whether using the L298 could be causing these problems? Also, while the motor voltage is listed as 20 volts on various sites, I’m operating it at 12 volts. Could this lower voltage be contributing to these issues?