# SAMD21 + DRV8316 Board

**URL:** https://community.simplefoc.com/t/samd21-drv8316-board/1086
**Category:** hardware support
**Tags:** samd21, drv8316
**Created:** [August 7, 2021, 2:42am UTC](https://community.simplefoc.com/t/samd21-drv8316-board/1086 "2021-08-07T02:42:37Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![AdinAck](https://community.simplefoc.com/user_avatar/community.simplefoc.com/adinack/32/1242_2.png) [@AdinAck](https://community.simplefoc.com/u/AdinAck)
#### Post date: [August 7, 2021, 2:42am UTC](https://community.simplefoc.com/t/samd21-drv8316-board/1086/1 "2021-08-07T02:42:38Z")

</div>

Hello, I have just made a motor-mounted controller inspired by @Jason_Kirsons board with the help of @runger designed to fit snugly on 41xx motors.

The Altium files and flashing instructions are on the repository [here](https://github.com/AdinAck/Motor-Controller) (WIP).

So far the SAMD21 is able to keep up with controlling motors well enough, and the DRV8316 is also working like a champ (as expected). Motors do not get warm when idle and are essentially silent so it seems to be functioning properly.

The board _should_ be able to work with a supply voltage of up to 40v.  
The board also has a USB Type C port and there is a USB protection circuit that pulls DRVOFF high if the USB port is the current source.

Total cost is about $25, assuming you can find stock for the SAMD21G18 ¯\_(ツ)\_/¯

Here is what it looks like:

 ![pic](https://community.simplefoc.com/uploads/default/original/2X/9/9da59feddbc12fdeddce68c0e1a0cc910b6e8b77.jpeg)

Any IO stuff (digital read or write for instance) definitely interfere with the FOC loop so I would like to look into redesigning this board with the RP2040 to utilize the dual cores.

---

<div class="post-metadata">

### Author: ![Jason\_Kirsons](https://community.simplefoc.com/user_avatar/community.simplefoc.com/jason_kirsons/32/625_2.png) [@Jason\_Kirsons](https://community.simplefoc.com/u/Jason_Kirsons)
#### Post date: [August 7, 2021, 8:03am UTC](https://community.simplefoc.com/t/samd21-drv8316-board/1086/2 "2021-08-07T08:03:28Z")

</div>

Nice work!

 ![image](https://community.simplefoc.com/uploads/default/original/2X/3/344e63ebd1d6673ca34babb76254867bf7fcd623.png)

I like the block title 🙂

---

<div class="post-metadata">

### Author: ![malem](https://community.simplefoc.com/user_avatar/community.simplefoc.com/malem/32/1169_2.png) [@malem](https://community.simplefoc.com/u/malem)
#### Post date: [August 8, 2021, 6:05pm UTC](https://community.simplefoc.com/t/samd21-drv8316-board/1086/3 "2021-08-08T18:05:38Z")

</div>

awesome! love it. I think I might try it, with a samd51

---

<div class="post-metadata">

### Author: ![AdinAck](https://community.simplefoc.com/user_avatar/community.simplefoc.com/adinack/32/1242_2.png) [@AdinAck](https://community.simplefoc.com/u/AdinAck)
#### Post date: [August 8, 2021, 7:49pm UTC](https://community.simplefoc.com/t/samd21-drv8316-board/1086/4 "2021-08-08T19:49:57Z")

</div>

Haha I just checked the datasheets and I had no idea the pinouts were _exactly_ the same, maybe I’ll get some SAMD51s to put on these boards!

---

<div class="post-metadata">

### Author: ![xcalplaxis](https://community.simplefoc.com/user_avatar/community.simplefoc.com/xcalplaxis/32/761_2.png) [@xcalplaxis](https://community.simplefoc.com/u/xcalplaxis)
#### Post date: [August 16, 2021, 12:43pm UTC](https://community.simplefoc.com/t/samd21-drv8316-board/1086/5 "2021-08-16T12:43:13Z")

</div>

That’s one nice looking board. Excited to see some motors spinning!

Thanks,  
Matt

---

<div class="post-metadata">

### Author: ![ChrisA](https://community.simplefoc.com/user_avatar/community.simplefoc.com/chrisa/32/2214_2.png) [@ChrisA](https://community.simplefoc.com/u/ChrisA)
#### Post date: [November 3, 2022, 4:55am UTC](https://community.simplefoc.com/t/samd21-drv8316-board/1086/6 "2022-11-03T04:55:39Z")

</div>

Looking at micro controllers. I can buy aSTM23M4 for the price of a SAM21. The M4 has hardware floating point and CAN bus pins. The crazy chip supply has some M4 cheaper than M0

Multitasking can be make easier with an RTOS. But I admit to ignorance about mixing SimpleFOC and an RTOS although Google finds many people running FOC in a real-time task.

Using a faster uP with hardware math and one of the RTOSes opens up a lot of silly stuff like “Micro ROS”, CAN bus, One is [freertos.org](http://freertos.org), another is [zephyrproject.org](http://zephyrproject.org)

---

<div class="post-metadata">

### Author: ![hs307](https://community.simplefoc.com/user_avatar/community.simplefoc.com/hs307/32/5379_2.png) [@hs307](https://community.simplefoc.com/u/hs307)
#### Post date: [August 25, 2024, 2:14am UTC](https://community.simplefoc.com/t/samd21-drv8316-board/1086/7 "2024-08-25T02:14:12Z")

</div>

Hi everyone,

apologies for a duplicate question here. I created a separate post and then realised, the right place to ask this question is here.

I am updating @AdinAck SAMD21 board to SAMD51. I’d appreciate a helping hand on confirming the following please:

We are using ATSAMD51G18A-MF. Considering the SERCOM config, what should be the SPI host pinouts to communicate with 2 SPI devices supporting the simpleFOC firmware?

Currently mapped as -  
MOSI- PA12  
MISO- PA14  
SCK- PA13  
SS1- PA18  
SS2- PA19

Is this mapping ok?

 ![image (78)](https://community.simplefoc.com/uploads/default/original/2X/3/3bd3eed3ff26143569ef998ef0a7a65abdf89b81.png)

@AdinAck - thanks for this board design.

---

<div class="post-metadata">

### Author: ![SdAN](https://community.simplefoc.com/user_avatar/community.simplefoc.com/sdan/32/8550_2.png) [@SdAN](https://community.simplefoc.com/u/SdAN)
#### Post date: [April 11, 2025, 9:24pm UTC](https://community.simplefoc.com/t/samd21-drv8316-board/1086/8 "2025-04-11T21:24:59Z")

</div>

May I revive this topic? I am building this board but I am struggling to find the correct motor. It seems that the holes on the board are 12mm apart while I have seen most of the motor have 19mm distance between the screws.  
May I ask you which motor you used?

Many thank  
Salva
