Arduino pro mini + DRV8838 motor driver

Hi, I have a question about DRV8838 motor driver with Arduino pro mini.
I connect all wires to Arduino and motor driver and you can see attached picture.

Code 1

int enablePin = 9;
void setup(){
 pinMode(enablePin, INPUT);
}
void loop(){
  digitalWrite(enablePin, HIGH);
}

Code 2

int enablePin =  9;
int value = 200;
void setup(){
 pinMode(enablePin, INPUT);
}
void loop(){
 analogWrite(enablePin, value);
}

In case of the code 1, the DC motor operates with maximum speed.
In case of the code 1 with changing the pin setting as pinMode(enablePin, OUTPUT), the DC motor does not operate.
In case of the code 2, the DC motor also does not operate.

I know that the duty cycle of PWM is related to the speed of motor.

What is the problem?
Am I something missing?

Hello.

I am sorry you are having trouble controlling your DRV8838 with your Arduino Pro Mini. digitalWrite() enables/disables the Arduino’s internal pull-up when it is an input, so it makes sense that Code 1 works fine since ENABLE is being connected to logic high. However, changing the pinMode() to OUTPUT and setting the ENABLE pin HIGH with digitalWrite() should also work to control the ENABLE pin. Additionally, analogWrite() automatically sets pinMode() to OUTPUT, so Code 2 should also work. Given this behavior, it sounds like pin 9 could be damaged in some way. Can you try using a pin other than pin 9 to test this?

By the way, the Arduino VCC is not likely to be an appropriate power source for a motor. Instead, you should use a separate power supply, like a wall wart or battery.

-Jon