Itsbitsy M4 express (SAMD51G19A) compiling issue

Hey All,

Was looking into using a new board and driver rather than the all-in-one I was using before (Storm32). However, when trying to compile the code I am see a lot of errors shown below:

pio\libdeps\adafruit_itsybitsy_m4\Simple FOC\src\drivers\hardware_specific\samd51_mcu.cpp:23:17: error: 'TC4_CH1' was not declared in this scope; did you mean 'TC3_CH1'?
   23 |   { PORTB,   9, TC4_CH1,   1, NOT_ON_TIMER,  0, NOT_ON_TIMER,  0},
      |                 ^~~~~~~
      |                 TC3_CH1
.pio\libdeps\adafruit_itsybitsy_m4\Simple FOC\src\drivers\hardware_specific\samd51_mcu.cpp:34:17: error: 'TC5_CH0' was not declared in this scope; did you mean 'TC3_CH0'?
   34 |   { PORTB,  10, TC5_CH0,   0, TCC0_CH0,   4, TCC1_CH0,   0}, //?
      |                 ^~~~~~~
      |                 TC3_CH0
.pio\libdeps\adafruit_itsybitsy_m4\Simple FOC\src\drivers\hardware_specific\samd51_mcu.cpp:35:17: error: 'TC5_CH1' was not declared in this scope; did you mean 'TC3_CH1'?
   35 |   { PORTB,  11, TC5_CH1,   1, TCC0_CH1,    5, TCC1_CH1,   1}, //?
      |                 ^~~~~~~
      |                 TC3_CH1
.pio\libdeps\adafruit_itsybitsy_m4\Simple FOC\src\drivers\hardware_specific\samd51_mcu.cpp:36:17: error: 'TC4_CH0' was not declared in this scope; did you mean 'TC3_CH0'?
   36 |   { PORTB,  12, TC4_CH0,   0, TCC3_CH0,   0, TCC0_CH0,   0},
      |                 ^~~~~~~
      |                 TC3_CH0
.pio\libdeps\adafruit_itsybitsy_m4\Simple FOC\src\drivers\hardware_specific\samd51_mcu.cpp:36:31: error: 'TCC3_CH0' 
was not declared in this scope; did you mean 'TC3_CH0'?
   36 |   { PORTB,  12, TC4_CH0,   0, TCC3_CH0,   0, TCC0_CH0,   0},
      |                               ^~~~~~~~
      |                               TC3_CH0
.pio\libdeps\adafruit_itsybitsy_m4\Simple FOC\src\drivers\hardware_specific\samd51_mcu.cpp:37:17: error: 'TC4_CH1' was not declared in this scope; did you mean 'TC3_CH1'?
   37 |   { PORTB,  13, TC4_CH1,   1, TCC3_CH1,   1, TCC0_CH1,   1},
      |                 ^~~~~~~
      |                 TC3_CH1
.pio\libdeps\adafruit_itsybitsy_m4\Simple FOC\src\drivers\hardware_specific\samd51_mcu.cpp:37:31: error: 'TCC3_CH1' 
was not declared in this scope; did you mean 'TC3_CH1'?
   37 |   { PORTB,  13, TC4_CH1,   1, TCC3_CH1,   1, TCC0_CH1,   1},
      |                               ^~~~~~~~
      |                               TC3_CH1
.pio\libdeps\adafruit_itsybitsy_m4\Simple FOC\src\drivers\hardware_specific\samd51_mcu.cpp:38:17: error: 'TC5_CH0' was not declared in this scope; did you mean 'TC3_CH0'?
   38 |   { PORTB,  14, TC5_CH0,   0, TCC4_CH0,   0, TCC0_CH2,   2},
      |                 ^~~~~~~
      |                 TC3_CH0
.pio\libdeps\adafruit_itsybitsy_m4\Simple FOC\src\drivers\hardware_specific\samd51_mcu.cpp:38:31: error: 'TCC4_CH0' 
was not declared in this scope; did you mean 'TCC2_CH0'?
   38 |   { PORTB,  14, TC5_CH0,   0, TCC4_CH0,   0, TCC0_CH2,   2},
      |                               ^~~~~~~~
      |                               TCC2_CH0
.pio\libdeps\adafruit_itsybitsy_m4\Simple FOC\src\drivers\hardware_specific\samd51_mcu.cpp:39:17: error: 'TC5_CH1' was not declared in this scope; did you mean 'TC3_CH1'?
   39 |   { PORTB,  15, TC5_CH1,   1, TCC4_CH1,   1, TCC0_CH3,   3},
      |                 ^~~~~~~
      |                 TC3_CH1
.pio\libdeps\adafruit_itsybitsy_m4\Simple FOC\src\drivers\hardware_specific\samd51_mcu.cpp:39:31: error: 'TCC4_CH1' 
was not declared in this scope; did you mean 'TCC2_CH1'?
   39 |   { PORTB,  15, TC5_CH1,   1, TCC4_CH1,   1, TCC0_CH3,   3},
      |                               ^~~~~~~~
      |                               TCC2_CH1
.pio\libdeps\adafruit_itsybitsy_m4\Simple FOC\src\drivers\hardware_specific\samd51_mcu.cpp:69:17: error: 'TC6_CH0' was not declared in this scope; did you mean 'TC3_CH0'?
   69 |   { PORTB,  16, TC6_CH0,  0, TCC3_CH0,   0, TCC0_CH0,   4},
      |                 ^~~~~~~
      |                 TC3_CH0
.pio\libdeps\adafruit_itsybitsy_m4\Simple FOC\src\drivers\hardware_specific\samd51_mcu.cpp:69:30: error: 'TCC3_CH0' 
was not declared in this scope; did you mean 'TC3_CH0'?
   69 |   { PORTB,  16, TC6_CH0,  0, TCC3_CH0,   0, TCC0_CH0,   4},
      |                              ^~~~~~~~
      |                              TC3_CH0
.pio\libdeps\adafruit_itsybitsy_m4\Simple FOC\src\drivers\hardware_specific\samd51_mcu.cpp:70:17: error: 'TC6_CH1' was not declared in this scope; did you mean 'TC3_CH1'?
   70 |   { PORTB,  17, TC6_CH1,  1, TCC3_CH1,   1, TCC0_CH1,   5},
      |                 ^~~~~~~
      |                 TC3_CH1
.pio\libdeps\adafruit_itsybitsy_m4\Simple FOC\src\drivers\hardware_specific\samd51_mcu.cpp:70:30: error: 'TCC3_CH1' 
was not declared in this scope; did you mean 'TC3_CH1'?
   70 |   { PORTB,  17, TC6_CH1,  1, TCC3_CH1,   1, TCC0_CH1,   5},
      |                              ^~~~~~~~
      |                              TC3_CH1
.pio\libdeps\adafruit_itsybitsy_m4\Simple FOC\src\drivers\hardware_specific\samd51_mcu.cpp:75:17: error: 'TC7_CH0' was not declared in this scope; did you mean 'TC3_CH0'?
   75 |   { PORTA,  20, TC7_CH0,  0, TCC1_CH0,   4, TCC0_CH0,   0},
      |                 ^~~~~~~
      |                 TC3_CH0
.pio\libdeps\adafruit_itsybitsy_m4\Simple FOC\src\drivers\hardware_specific\samd51_mcu.cpp:76:17: error: 'TC7_CH1' was not declared in this scope; did you mean 'TC3_CH1'?
Compiling .pio\build\adafruit_itsybitsy_m4\FrameworkArduino\IPAddress.cpp.o
   76 |   { PORTA,  21, TC7_CH1,  1, TCC1_CH1,   5, TCC0_CH1,   1},
      |                 ^~~~~~~
      |                 TC3_CH1
.pio\libdeps\adafruit_itsybitsy_m4\Simple FOC\src\drivers\hardware_specific\samd51_mcu.cpp:77:17: error: 'TC4_CH0' was not declared in this scope; did you mean 'TC3_CH0'?
   77 |   { PORTA,  22, TC4_CH0,  0, TCC1_CH2,   6, TCC0_CH2,   2},
      |                 ^~~~~~~
      |                 TC3_CH0
.pio\libdeps\adafruit_itsybitsy_m4\Simple FOC\src\drivers\hardware_specific\samd51_mcu.cpp:78:17: error: 'TC4_CH1' was not declared in this scope; did you mean 'TC3_CH1'?
Compiling .pio\build\adafruit_itsybitsy_m4\FrameworkArduino\Print.cpp.o
   78 |   { PORTA,  23, TC4_CH1,  1, TCC1_CH3,   7, TCC0_CH3,   3},
      |                 ^~~~~~~
      |                 TC3_CH1
.pio\libdeps\adafruit_itsybitsy_m4\Simple FOC\src\drivers\hardware_specific\samd51_mcu.cpp:79:17: error: 'TC5_CH0' was not declared in this scope; did you mean 'TC3_CH0'?
   79 |   { PORTA,  24, TC5_CH0,  0, TCC2_CH2,   2, NOT_ON_TIMER,  0}, // PDEC0
      |                 ^~~~~~~
      |                 TC3_CH0
Compiling .pio\build\adafruit_itsybitsy_m4\FrameworkArduino\Reset.cpp.o
.pio\libdeps\adafruit_itsybitsy_m4\Simple FOC\src\drivers\hardware_specific\samd51_mcu.cpp:80:17: error: 'TC5_CH1' was not declared in this scope; did you mean 'TC3_CH1'?
   80 |   { PORTA,  25, TC5_CH1,  1, NOT_ON_TIMER,  0, NOT_ON_TIMER,  0}, // PDEC1
      |                 ^~~~Compiling .pio\build\adafruit_itsybitsy_m4\FrameworkArduino\SERCOM.cpp.o
~~~
      |                 TC3_CH1
.pio\libdeps\adafruit_itsybitsy_m4\Simple FOC\src\drivers\hardware_specific\samd51_mcu.cpp:81:17: error: 'TC7_CH0' was not declared in this scope; did you mean 'TC3_CH0'?
   81 |   { PORTB,  22, TC7_CH0,  0, NOT_ON_TIMER,  0, NOT_ON_TIMER,  0}, // PDEC2
      |                 ^~~~~~~
      |                 TC3_CH0
.pio\libdeps\adafruit_itsybitsy_m4\Simple FOC\src\drivers\hardware_specific\samd51_mcu.cpp:82:17: error: 'TC7_CH1' was not declared in this scope; did you mean 'TC3_CH1'?
   82 |   { PORTB,  23, TC7_CH1,  1, NOT_ON_TIMER,  0, NOT_ON_TIMER, 0}, // PDEC0
      |                 ^~~~~~~
      |                 TC3_CH1
.pio\libdeps\adafruit_itsybitsy_m4\Simple FOC\src\drivers\hardware_specific\samd51_mcu.cpp:90:17: error: 'TC6_CH0' was not declared in this scope; did you mean 'TC3_CH0'?
   90 |   { PORTA,  30, TC6_CH0,  0, TCC2_CH0,   0, NOT_ON_TIMER,  0},
      |                 ^~~~~~~
      |                 TC3_CH0
.pio\libdeps\adafruit_itsybitsy_m4\Simple FOC\src\drivers\hardware_specific\samd51_mcu.cpp:91:17: error: 'TC6_CH1' was not declared in this scope; did you mean 'TC3_CH1'?
   91 |   { PORTA,  31, TC6_CH1,  1, TCC2_CH1,   1, NOT_ON_TIMER,  0},
      |                 ^~~~~~~
      |                 TC3_CH1
.pio\libdeps\adafruit_itsybitsy_m4\Simple FOC\src\drivers\hardware_specific\samd51_mcu.cpp:92:30: error: 'TCC4_CH0' 
was not declared in this scope; did you mean 'TCC2_CH0'?
   92 |   { PORTB,  30, TC0_CH0,  0, TCC4_CH0,   0, TCC0_CH2,   6},
      |                              ^~~~~~~~
      |                              TCC2_CH0
.pio\libdeps\adafruit_itsybitsy_m4\Simple FOC\src\drivers\hardware_specific\samd51_mcu.cpp:93:30: error: 'TCC4_CH1' 
was not declared in this scope; did you mean 'TCC2_CH1'?
   93 |   { PORTB,  31, TC0_CH1,  1, TCC4_CH1,   1, TCC0_CH3,   7},
      |                              ^~~~~~~~
      |                              TCC2_CH1
.pio\libdeps\adafruit_itsybitsy_m4\Simple FOC\src\drivers\hardware_specific\samd51_mcu.cpp:95:17: error: 'TC7_CH0' was not declared in this scope; did you mean 'TC3_CH0'?
   95 |   { PORTB,   0, TC7_CH0,  0, NOT_ON_TIMER,  0, NOT_ON_TIMER,  0},
      |                 ^~~~~~~
      |                 TC3_CH0
.pio\libdeps\adafruit_itsybitsy_m4\Simple FOC\src\drivers\hardware_specific\samd51_mcu.cpp:96:17: error: 'TC7_CH1' was not declared in this scope; did you mean 'TC3_CH1'?
   96 |   { PORTB,   1, TC7_CH1,  1, NOT_ON_TIMER,  0, NOT_ON_TIMER, 0},
      |                 ^~~~~~~
      |                 TC3_CH1
.pio\libdeps\adafruit_itsybitsy_m4\Simple FOC\src\drivers\hardware_specific\samd51_mcu.cpp:97:17: error: 'TC6_CH0' was not declared in this scope; did you mean 'TC3_CH0'?
   97 |   { PORTB,   2, TC6_CH0,  0, TCC2_CH2,   2, NOT_ON_TIMER, 0},
      |                 ^~~~~~~
      |                 TC3_CH0
.pio\libdeps\adafruit_itsybitsy_m4\Simple FOC\src\drivers\hardware_specific\samd51_mcu.cpp:103:72: error: 'TCC3_CC_NUM' was not declared in this scope; did you mean 'TC3_CC_NUM'?
  103 | uint8_t TCC_CHANNEL_COUNT[] = { TCC0_CC_NUM, TCC1_CC_NUM, TCC2_CC_NUM, TCC3_CC_NUM, TCC4_CC_NUM };
      |                                                                        ^~~~~~~~~~~
      |                                                                        TC3_CC_NUM
.pio\libdeps\adafruit_itsybitsy_m4\Simple FOC\src\drivers\hardware_specific\samd51_mcu.cpp:103:85: error: 'TCC4_CC_NUM' was not declared in this scope; did you mean 'TCC2_CC_NUM'?
  103 | uint8_t TCC_CHANNEL_COUNT[] = { TCC0_CC_NUM, TCC1_CC_NUM, TCC2_CC_NUM, TCC3_CC_NUM, TCC4_CC_NUM };
      |                                                                                     ^~~~~~~~~~~
      |                                                                                     TCC2_CC_NUM
.pio\libdeps\adafruit_itsybitsy_m4\Simple FOC\src\drivers\hardware_specific\samd51_mcu.cpp: In function 'void configureTCC(tccConfiguration&, long int, bool, float)':
.pio\libdeps\adafruit_itsybitsy_m4\Simple FOC\src\drivers\hardware_specific\samd51_mcu.cpp:261:7: warning: unused variable 'tc' [-Wunused-variable]
  261 |   Tc* tc = (Tc*)GetTC(tccConfig.tcc.chaninfo);
      |       ^~
*** [.pio\build\adafruit_itsybitsy_m4\libb56\Simple FOC\drivers\hardware_specific\samd51_mcu.cpp.o] Error 1

To be honest not even sure what the issue could be but anyone have any ideas on pointing me in the right direction? Thank you in advance!

Hiya,

I’ll have to look into this for you. From the SAMD51 datasheet:
image

So your SAMD51 should have a TCC3_CH0, etc…

The problem is probably that the board descriptions used with the itsibitsy are in some way incorrect or incomplete. We may have to add some board-specific #defines to get it to compile for you.

May I ask which environment you are in, and which board-manager URL and version you are using for the itsi-bitsy? Are you in PlatformIO?

I’ll try to reproduce it and see what can be done.

1 Like

@runger, glad to have the expert of these boards helping out.

I am using platformIO at the moment and selected the itsybitsy M4 from the list of boards for my project (so don’t think I needed the board manager URL could be wrong). As for the version of board, I am using the itsy-bitsy M4 express. Let me know if there is any other info I can provide.

And here is the platformio.ini file if that helps at all:

[env:adafruit_itsybitsy_m4]

platform = atmelsam

board = adafruit_itsybitsy_m4

framework = arduino

monitor_speed = 115200

lib_deps = 

    https://github.com/simplefoc/Arduino-FOC

    SPI 

    Wire

Wanted to follow up and see if anyone has a solution for this?