Dual MC33926 Motor Driver Shield with Ethernet Shield - Fixed

I know this has been discussed before but I’ve not been able to work out what to do from those posts. I have a Mega 2560 with an Ethernet shield plugged in (I think a recent one as it has a connector in the middle of the Mega) and the MC33926 plugged on top although the first two pins on each side don’t mate with anything.
The issue is that motor 2 comes on every time I send a UDP message and as I have constant event updates this is pretty much all the time. Obviously this is a pin conflict. I thought pin 10 was to blame so I remapped M2PWM to various other pins but the fault persisted. I tried to remap other pins but mostly ended up with a motor fault.
Is there a tried and trusted way to make this work?

Further investigation:
After realising I was being a bit stupid expecting the reassignment to work without patching I removed the driver board and patched cables across. When patched as per the normal pinout and using the standard test demo it worked as before. When I physically moved pin 10 to pin 11 and uploaded again with the changed mapping motor 2 no longer worked. Its like the remapping does nothing. Remapping code below.

// Motor pins
unsigned char nD2 = 4;
unsigned char M1DIR = 7;
unsigned char M2DIR = 8;
unsigned char M1PWM = 9;
unsigned char M2PWM = 11; // Reassigned from 10
unsigned char nSF = 12;
unsigned char M1FB = 0;
unsigned char M2FB = 1;

DualMC33926MotorShield md(M1DIR, M1PWM, M1FB, M2DIR, M2PWM, M2FB, nD2, nSF);

More investigation:
Discovered that the PWM pins cannot be moved in spite of being allowed in the constructor. Should have looked at the code earlier. I moved all the others but the fault still persists so it is down to I think pin10 which can’t be moved unless someone has a code hack to move the timer. What a shame as it make the motor driver completely useless to me.

In case anyone has the same issue
Actually the code was quite easy to change. The library is not that great because it goes lowest common denominator rather than take the Arduino board into account. The Mega 2560 has 6 timers. I chose to use Timer 3 which is 16 bit same as timer 1 (the fixed default) and uses pins 2,3 and 5. A couple of edits to the files.

In DualMC33926MotorShield.h -
//static const unsigned char _M1PWM = 9;
//static const unsigned char _M2PWM = 10;
static const unsigned char _M1PWM = 2;
static const unsigned char _M2PWM = 3;

In DualMC33926MotorShield.cpp -
//TCCR1A = 0b10100000;
//TCCR1B = 0b00010001;
TCCR3A = 0b10100000;
TCCR3B = 0b00010001;

Re-patch pin 9 to pin2 and pin 10 to pin 3 and the problem has gone. Now I can cut those two pins off, plug the board back in and put in a couple of links.



Thank you for letting us know you found the problem and for sharing your solution.