Control Pb3 and PD3 to M2 motor driver having problems

The outputs from the cpu to the Toshiba M2 motor driver are identical even though the inention was to keep PB3 = Low and PD3 = high.
M1 motor is working fine but since the signals PB3 and PD3 are pulsing high and low at the same time the outputs from the motor driver are low. I have observed the pulses on a oscilloscope. Have also checked on a multimeter that PB3 and PD3 are not shorted on the Toshiba chip. Here is the simple code I am using to drive the two motors. M1 is working as expected. I have physical disconnected the USB program Loader board that use the PB3 pin for SPI interface. Any ideas why this is not working ?

#define F_CPU 20000000UL
#include <avr/io.h>
#include <util/delay.h>
#include <pololu/orangutan.h>

int main (void)
DDRD |= 0b01101010; //m1 (bit 5 and 6) and m2 (bit 3)
DDRB |= 0b00001000; //m2 (bit 3)
DDRC |= 0b01000000;
PORTC |= 0b01000000; //disables motor standby
while (1)
PORTD |= 0b00101010;
PORTB &= ~0b00001000;
return 0;

Hello, bhavi.

What Orangutan board do you have?

There might be a power problem that causes your whole system to reset when you try to drive the motor. Could you add some LED blinking code at the beginning so you can easily tell when your program resets? Could you also try disconnecting the motors?

If that doesn’t work, how about you post some images of oscilloscope traces here so we can see what’s going on. Be sure to tell us what the vertical and horizontal scales are. Also, if you post code, please use the [ code] and [/ code] tags (without spaces) to format it.