0

Missing SERCOM4/5 decls for SPI on trinket m0
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Missing SERCOM4/5 decls for SPI on trinket m0

by eeriedescent on Thu Jun 06, 2019 9:08 pm

Not even sure where to begin with this. I've followed the instructions on getting the m0 set up in Arduino, but trying to use SPI (or libraries like Adafruit_DotStar which seem to pull it in) cause compilation failures:

Code: Select all | TOGGLE FULL SIZE
Arduino: 1.8.9 (Linux), Board: "Adafruit Trinket M0, Arduino"

/home/bjc/.arduino15/packages/adafruit/hardware/samd/1.5.0/libraries/SPI/SPI.cpp:408:6: error: 'SERCOM4' was not declared in this scope
   { &SERCOM4->SPI.DATA.reg, SERCOM4_DMAC_ID_TX, SERCOM4_DMAC_ID_RX },
      ^
/home/bjc/.arduino15/packages/adafruit/hardware/samd/1.5.0/libraries/SPI/SPI.cpp:408:29: error: 'SERCOM4_DMAC_ID_TX' was not declared in this scope
   { &SERCOM4->SPI.DATA.reg, SERCOM4_DMAC_ID_TX, SERCOM4_DMAC_ID_RX },
                             ^
/home/bjc/.arduino15/packages/adafruit/hardware/samd/1.5.0/libraries/SPI/SPI.cpp:408:49: error: 'SERCOM4_DMAC_ID_RX' was not declared in this scope
   { &SERCOM4->SPI.DATA.reg, SERCOM4_DMAC_ID_TX, SERCOM4_DMAC_ID_RX },
                                                 ^
/home/bjc/.arduino15/packages/adafruit/hardware/samd/1.5.0/libraries/SPI/SPI.cpp:409:6: error: 'SERCOM5' was not declared in this scope
   { &SERCOM5->SPI.DATA.reg, SERCOM5_DMAC_ID_TX, SERCOM5_DMAC_ID_RX },
      ^
/home/bjc/.arduino15/packages/adafruit/hardware/samd/1.5.0/libraries/SPI/SPI.cpp:409:29: error: 'SERCOM5_DMAC_ID_TX' was not declared in this scope
   { &SERCOM5->SPI.DATA.reg, SERCOM5_DMAC_ID_TX, SERCOM5_DMAC_ID_RX },
                             ^
/home/bjc/.arduino15/packages/adafruit/hardware/samd/1.5.0/libraries/SPI/SPI.cpp:409:49: error: 'SERCOM5_DMAC_ID_RX' was not declared in this scope
   { &SERCOM5->SPI.DATA.reg, SERCOM5_DMAC_ID_TX, SERCOM5_DMAC_ID_RX },
                                                 ^
exit status 1
Error compiling for board Adafruit Trinket M0.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

eeriedescent
 
Posts: 10
Joined: Fri Apr 12, 2019 9:07 pm

Re: Missing SERCOM4/5 decls for SPI on trinket m0

by franklin97355 on Thu Jun 06, 2019 9:34 pm

Do you have both the Adafruit and Arduino SAMD board files installed?

franklin97355
 
Posts: 21216
Joined: Mon Apr 21, 2008 2:33 pm
Location: Lacomb, OR.

Re: Missing SERCOM4/5 decls for SPI on trinket m0

by eeriedescent on Fri Jun 07, 2019 6:24 am

Yes, I've got Arduino SAMD v. 1.6.21 and Adafruit SAMD v. 1.5.0 installed.

eeriedescent
 
Posts: 10
Joined: Fri Apr 12, 2019 9:07 pm

Re: Missing SERCOM4/5 decls for SPI on trinket m0

by wcullison on Tue Jun 11, 2019 7:09 am

I'm having the same issue, is there any resolution?

If I revert back to Adafruit SAMD Boards v1.4.1, the problem is resolved. After comparing the two revisions (1.4.1 & 1.5.0) I haven't figured out which differences are causing the compile issue.

wcullison
 
Posts: 1
Joined: Tue Jun 11, 2019 7:08 am

Re: Missing SERCOM4/5 decls for SPI on trinket m0

by eeriedescent on Sat Jun 15, 2019 2:00 pm

I've had a chance to look further at this, and have a simple patch that seems to work. This is based off of https://github.com/adafruit/ArduinoCore-samd.git and not the 1.5.0 library, since I couldn't find the source for that:

Code: Select all | TOGGLE FULL SIZE
diff --git a/libraries/SPI/SPI.cpp b/libraries/SPI/SPI.cpp
index 1dc690d..48ae32c 100644
--- a/libraries/SPI/SPI.cpp
+++ b/libraries/SPI/SPI.cpp
@@ -405,8 +405,12 @@ static const struct {
   { &SERCOM1->SPI.DATA.reg, SERCOM1_DMAC_ID_TX, SERCOM1_DMAC_ID_RX },
   { &SERCOM2->SPI.DATA.reg, SERCOM2_DMAC_ID_TX, SERCOM2_DMAC_ID_RX },
   { &SERCOM3->SPI.DATA.reg, SERCOM3_DMAC_ID_TX, SERCOM3_DMAC_ID_RX },
+#if defined(SERCOM4)
   { &SERCOM4->SPI.DATA.reg, SERCOM4_DMAC_ID_TX, SERCOM4_DMAC_ID_RX },
+#endif
+#if defined(SERCOM5)
   { &SERCOM5->SPI.DATA.reg, SERCOM5_DMAC_ID_TX, SERCOM5_DMAC_ID_RX },
+#endif
 #if defined(SERCOM6)
   { &SERCOM6->SPI.DATA.reg, SERCOM6_DMAC_ID_TX, SERCOM6_DMAC_ID_RX },
 #endif

eeriedescent
 
Posts: 10
Joined: Fri Apr 12, 2019 9:07 pm

Please be positive and constructive with your questions and comments.