I am trying to make a SAME51 variant of an arduino board, in the end I would like to have an arduino compatible board, BSP, and library for controlling canbus.

I have already gone through some things, but I believe I need a slight bit of guidance for the next step, mostly just reference files.

What I have done so far is fork the adafruit SAMD BSP and added a variant. Since the normal Bossa does not recognize my CPU ID I had to add it and recompile bossa. I also went ahead and made a UF2 style bootloader and a corresponding windows driver with matching PIDs/VIDs. At this point I had a working arduino board, but it still thinks it's a SAMD51, not a SAME51. Asking for anything to do with can leads to missing references, which makes sense since SAMD does not have CAN (but it's in DFPs?)

So finally I decided to edit boards.txt again and change the build flag from -D__SAMD51G19A to SAME51G19A. I also found SAME51 DFP online and added them to arduino/tools/CMSIS-Atmel, but this is just me guessing. I also used the DFP to build the UF2 bootloader previously. This breaks everything and if I had to guess from looking the compiler is missing the DFP and everything is very upset about that.

Earlier I had found a version of what I am after, except for a SAMC21 and not a SAME51. I thought the can peripheral was the same for each, so this should be an easy port besides maybe configuring the gclk since those are different from M0 to M4. If you compare DFPs, both are identical as far as CANBUS is concerned, at least at that level.

But, using this code and the SAMC21 BSP referenced in the readme will compile!


Is it something to do with adafruit fork using CMSIS 5.4 and arduino using CMSIS-Atmel 1.2.0?

Thank you in advance for any and all tips!

  • I have that part worked out, and it works fine for the SAMC21. When compiling for SAME51 all definitions are missing. I believe the issue is Arduino SAMD core has compile support for SAMC21 in /arduino15/packages/arduino/tools/cmsis-atmel/1.2.0.../samc21. By default there is no same51, so using SAME51G19 as a build flag fails. I don't know how to add support for same51, nor am I even sure the adafruit fork uses the same compiler tools in the first place. I think that's where I'm stuck.
    – Moonie223
    Sep 17 '20 at 20:09
  • and if you reference the Adadruit BSP with SAMD51 support? github.com/adafruit/ArduinoCore-samd
    – Juraj
    Sep 17 '20 at 20:21
  • That is the initial fork of the BSP I modified, not the official arduino BSP. I still have the official core installed because the Adafruit BSP references many of the arduino/tools/ files.
    – Moonie223
    Sep 17 '20 at 21:52
  • I think I may have made it work. I am not certain, but I think any sam.h defines in the BSP point to CMSIS-ATMEL. The default does not have same51 support, and just adding the files isn't enough. Have to edit the sam.h files to make sure the required files are included.
    – Moonie223
    Sep 17 '20 at 22:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.