I am currently trying to utilize a LS7366R Encoder Buffer alongside the TB9051FTG driver to control my Pololu Gearmotors.
However, the TB9051FTG occupies one of the SPI pins (PIN 12, sends M2 Diagnostic Data) required by the LS7366R to send encoder data. Are there ways to force the TB9051FTG to free up PIN 12 to allow me to use SPI comms?
I’ve tried hard wiring all the connections from the shield to the Arduino except for PIN 12, but alas, the driver won’t run properly.
I’ve also tried changing the pin callout on DualTB9051FTGMotorShield.cpp from 12 to something else (like A5), and still no ability to make the driver function properly.
Please let me know if you know of ways to allow SPI comms for an encoder buffer with this shield.
Have you tested your Dual TB9051FTG Motor Driver Shield separately (without your encoder buffer) to make sure it works as expected when connected as a shield and running the unmodified Demo.ino example program (with the unmodified library)?
Wiring the driver as a general-purpose driver (i.e. not as a shield) and either leaving M2DIAG disconnected or connecting it to a different pin should have worked. (Note that you can also continue using it as a shield with the M2DIAG connection cut or remapped; see the “Remapping the Arduino connections” section in the user’s guide for more information.)
If you remap M2DIAG and want to be able to read it through the library, you do need to let the library know which other pin you are using. Instead of modifying the library, you could use the alternate constructor which lets you remap the pins, so you might try that instead to see if that gives you any results. You can find details about the alternate constructor in the Dual TB9051FTG Motor Driver Shield Arduino library’s README documentation.
If that does not work, can you post pictures of your setup that show all of your connections and describe what happens when the driver doesn’t work properly?