An update after a short break...
Now I am almost sure that there is a problem with my circuit and/or PCB setup.
I made a new prototype PCB. I replaced the IRFZ44 MOSFETs with IRLZ44 logic level counterparts. I used 75 ohm gate resistors and 47 k resistors from the gate to GND. Just for testing purposes I used a small electric motor which draws about 100 - 150 mA. This motor has 100 nF caps between the terminals and the case.
I wrote a short code which reads a rotary encoder and sets the PWM output to the motor from 0 to 255. The motor starts turning at about 15 - 20 PWM and as soon as the motor starts turning the MPU resets or hangs.
Then I grabbed an Arduino Uno and built the same setup on a breadboard. That means the same PWM pin (Arduino 6), 75 ohms gate resistor, 47 k GND resistor, IRLZ44 MOSFET, a similar rotary encoder and the same motor. Uploaded the same code and it works without any problems!!!
You can see my board and the motor on the photo (the two Schottky diodes are under the PCB. Don't bother for the two thin wire bridges. They will be replaced by thicker ones in the final product.).
This motor is a very low power mtor and even if it would be short circuited, it is impossible for the power supply to collapse.
You can see the PCB layout on the other photo.
I am really confused. This is not my first project using an AVR directly instead of an Arduino board. Actually I have more than 25 projects using Atmega328 or Attiny85 and they are working in my RC aricraft for years now without any problems. But now I really need help...
Now I am almost sure that there is a problem with my circuit and/or PCB setup.
I made a new prototype PCB. I replaced the IRFZ44 MOSFETs with IRLZ44 logic level counterparts. I used 75 ohm gate resistors and 47 k resistors from the gate to GND. Just for testing purposes I used a small electric motor which draws about 100 - 150 mA. This motor has 100 nF caps between the terminals and the case.
I wrote a short code which reads a rotary encoder and sets the PWM output to the motor from 0 to 255. The motor starts turning at about 15 - 20 PWM and as soon as the motor starts turning the MPU resets or hangs.
Then I grabbed an Arduino Uno and built the same setup on a breadboard. That means the same PWM pin (Arduino 6), 75 ohms gate resistor, 47 k GND resistor, IRLZ44 MOSFET, a similar rotary encoder and the same motor. Uploaded the same code and it works without any problems!!!
You can see my board and the motor on the photo (the two Schottky diodes are under the PCB. Don't bother for the two thin wire bridges. They will be replaced by thicker ones in the final product.).
This motor is a very low power mtor and even if it would be short circuited, it is impossible for the power supply to collapse.
You can see the PCB layout on the other photo.
I am really confused. This is not my first project using an AVR directly instead of an Arduino board. Actually I have more than 25 projects using Atmega328 or Attiny85 and they are working in my RC aricraft for years now without any problems. But now I really need help...