M3S256 used with SAMD21 DEV Breakout

I just got one of this and I plan to use the SAMD21 for its speed and 6 serial ports. So I bought a Sparkfun SAMD21 DEV BREAKOUT board. and I hooked it all up.

I followed the M3S256 setup instructions, which so far are clear and nicely written. Of course it didn’t work. I bit of digging around I found the answer.

Anywhere in the examples provided by Pololu where Serial.Print is intended to print to the serial monitor via the USB port has to be replaced with SerialUSB (Find: “Serial” Replace: “SerialUSB”). If you don’t want to make these changes, you have to add a serial transceiver on the default Rx/Tx pins.

Example: Serial.println(F("Error: Command too long.")); needs to read
SerialUSB.println(F("Error: Command too long."));

When using Search and Replace be careful not to replace “Serial” in the function, variable names and calls.

Example: void processSerialByte(uint8_t byteReceived) { .... }
In this example, he function “processSerialByte” should remain unchanged

Also, in Setup(), you have to add a line of code that waits for the USB serial port to open

void setup() // dafault debug function
{
  Serial.begin(9600);  // <---- Add WAIT after this line
  WIRE.begin();
  mc.setBus(&WIRE);
  SerialUSB.print("Setup");
}

needs to changed to

void setup()
{
  SerialUSB.begin(9600);
    while (!SerialUSB) {            // <--- don't forget to add the curly braces
       ; // wait for SerialUSB port to connect. Needed for native USB port only
     }

  WIRE.begin();
  mc.setBus(&WIRE);
  SerialUSB.print("Setup");
}
1 Like

Hello.

I am glad to hear that you were able to get your Motoron M3S256 working with your SAMD21. Thanks for sharing your solution!

- Patrick