RedBoard Artemis Nano + Qwiic Motor Driver; examples fail to compile

Hi.

I have a project that was using a RedBoard (328P/UNO style) without a problem, and now I’m building its sister project using a RedBoard Artemis, and running into issues with the SparkFun Qwiic Motor Driver when trying to compile Arduino code for it.

Using Arduino IDE 2.1.0, I open up the example sketch “MotorTest.ino” from the Serial Controlled Motor Driver library (v1.04), choose the RedBoard Artemis Nano (I’ve got v2.2.1 of SparkFun Apollo3 Boards installed). When I hit compile I get the following errors, seemingly related to SPI (which I’m not using, I’m using the example sketch as is, in I2C mode)…

/Documents/Arduino/libraries/Serial_Controlled_Motor_Driver/src/SCMD.cpp: In member function 'uint8_t SCMD::begin()':
/Documents/Arduino/libraries/Serial_Controlled_Motor_Driver/src/SCMD.cpp:106:7: error: 'class arduino::MbedSPI' has no member named 'setClockDivider'
   SPI.setClockDivider(SPI_CLOCK_DIV32);
       ^~~~~~~~~~~~~~~
/Documents/Arduino/libraries/Serial_Controlled_Motor_Driver/src/SCMD.cpp:106:23: error: 'SPI_CLOCK_DIV32' was not declared in this scope
   SPI.setClockDivider(SPI_CLOCK_DIV32);
                       ^~~~~~~~~~~~~~~
/Documents/Arduino/libraries/Serial_Controlled_Motor_Driver/src/SCMD.cpp:108:7: error: 'class arduino::MbedSPI' has no member named 'setBitOrder'
   SPI.setBitOrder(MSBFIRST);
       ^~~~~~~~~~~
/Documents/Arduino/libraries/Serial_Controlled_Motor_Driver/src/SCMD.cpp:111:7: error: 'class arduino::MbedSPI' has no member named 'setDataMode'
   SPI.setDataMode(SPI_MODE0);
       ^~~~~~~~~~~

exit status 1

Compilation error: exit status 1

If I change the board target to the old SparkFun Redboard, it compiles without a problem.

If been digging for information for a few hours now, but not coming up with anything useful. Any ideas?

The way SPI is initialized is the “old” way. It is not advised anymore in the modern SPI libraries for the many different boards. I have tried to transform the “old” way to the new style for the Apollo3, but can not test it as I do not have a motor to test. Try the attached and let us know the outcome.

SparkFun_Serial_Controlled_Motor_Driver_Arduino_Library-master.zip (33.5 KB)