I am using the l298 with both outputs connected in parallel for more current output, because of the current peaks the motor has when suddenly changes direction in response to a step wave.
I was using the default fast pwm at 1khz for pwm, but I could hear the motor making a sound so I changed the prescaler on timer0 which is the timer on pin13 that I use for pwm, (atmega1280), to 1 instead of the default 64.
So now its at 62.5 khz (16Mhz/256).
Another thing I though of just right now was the response of the components inside the l298n if they are as fast switching as the pwm because lets say at 90% pwm, they are only switched off 10% of the period (1/62.5khz).
So I am thinking that it doesnt have time to switch off and turns on again very quick. So I will change the prescaler back to 64 and check the diferences.
I don't just need a solution but if someone as tips on what it could be it i will be grateful ;D EDIT:
So I tested at diferent pwm frequencies and the results vary greatly, at 1khz, 7.8khz and 62.5khz (64,8,1 prescaler).
Here are the results, I got suprised by the 7.8khz.
The torque seems to be significantly weaker at 62.5khz at 60% pwm than at 1khz.
The motor rotates after 25.5%pwm at 1khz and at 62.5khz only after 50%.
There is something wrong about the 7.8khz, I am going to try to run it at 31khz using phase correct and check the results.
SYMBOL PARAMETER test condition min typ. max unit
fc (Vi) Commutation Frequency IL = 2A 25 40 KHz
Fast 1khz Fast 7.8khz Fast 62.5khz
phase corr 490hz phase corr 3.9khz phase corr 31.25khz