Samd21G17D Prototyping maybe

Hello, Before I can program learn to program this processor I need to build it first. I'm not good atdatasheets but i'm trying. A Friend of mine gave me 5 of these processors the SamD21G17D. I wanted to learn how i can program that but also I need to make a board for them. So I bought a few 48TQFP prototype PCB to solder the processor to. I have pretty much all I need, I jut need to figure out how to wire it all up to a breadboard for testing. I know breadboard not the bed for this but to test it is more then enough. Only problem I'm having is where the Crystal I just need to confirm it is PA00 and PA01. Is this correct I'm reading this right. Also there are multiple VCC and Ground pins. I'm unsure do I conenct them all? I have a SWD programmer that will support the voltage of 3.3v and to program this. I used it on my SamD21G18A processor a year ago. I just need help with figuring out the pinout and wiring for the voltages and crystal. Someone please help me? Thank you

Joseph

Depends on which oscillator?

They should all be connected yes, though in some circumstances you might want to connect them to different power rails. Unless you know that you need that, you'll probably be fine connecting all to the same rail. Keep in mind that VDDCORE is a power output not a power input. I suggest you read chapter 8 of the datasheet.

Thank you very much. I will tie all the VCC and Gnd together on the rails. For the 32khz crystal is PA00 and PA01. What is the XOSC for? that is on PA14 and PA15.

Joseph

Hi @josephchrzempiec

There's section at the back of the SAMD21 datasheet in chapter 42. called "Schematic Checklist" that provides information about design requirements and hardware considerations, such as an external crystal, decoupling, filtering, etc...

The XOSC oscillator port pins: PA14 and PA15 can be used to connect a 0.4 to 32MHz (AT cut) external crystal. However, Arduino never employed this option in their original Arduino Zero design and instead chose an external 32.768kHz crystal (XOSC32K). The SAMD21's internal Digital Frequency Locked Loop multiplying 32.768kHz up to 48MHz (DFLL48M) required by the CPU.

The SAMD21 also has the option to go crystalless, automatically using either the 1kHz "Start Of Frame" (SOF) signal when the USB is connected, or the chip's internal 32.768kHz oscillator (OSC32K) when it is not. Again, both are multiplied up to 48MHz by the DFLL. The issue with the internal 32k oscillator, is that it lacks the external crystal's accuracy and precision, so isn't really suitable for applications that require the SAMD21's internal RTC (you could lose/gain 20 minutes a day), or for absolute timings over a long duration. Boards such as the Arduino IoT 33 Nano and the Adafruit Itsy Bitsy M0 are both crystalless and use this method.

To be honest, if you've got the board real estate, it's probably easiest just to go with an external 32k crystal.

Hello Martin, Yes I will add an external crystal. First think I looked for when I got these processors from my friend I went to digikey and got some. And Thank you for the information. I'm however missing some .1 caps I just ordered and won't be here until Tuesday.

Joseph

Hi guys,
Looks very interesting. I personally use a lot of ATSAMD21G18A for personnal projects in custom boards. I generally use the internal 8 MHz RC oscillator multiplied to 48MHz for processing (default conf) , and external 32k XTAL for RTC when needed for precision.
Anyway my problem is that I generally use the Sparkfun M0 breadboard bootloader which works fine.
But those days, the G18 is quite hard to find and most sellers ask for 3 to 12 months of delay...
G17 is much easier to get, and 128k flash is largely enough for most of my projects. But when I try to flash the bootloader which is done for G18, Microchip studio programming tool rejects the file , even if I try to reduce it externally to half size.
Martin, any idea to solve this problem ?
Or is there a way to change the processor parameters in the IDE in order to get the good bin size, and flash it with Microchip Studio instead of using the bootloader ?
Best regards

Hi @fmaingot

One reason why you're unable to burn the bootloader binary, might be because of the BOOTPROT (bootloader protect) fuse. This needs to be set to 0x7 (hexidecimal), or on newer versions of Microchip Studio, turned off. Fuses can be set with the Microchip Studio programming tool.

Another issue is that the bootloader stores the double tap reset "magic number" in the last 4 byes of RAM. Obviously, since the RAM size of the G17 and G18 differ, it's necessary either to use an existing bootloader from a board that uses the "17" variant (same size RAM), or modify your existing bootloader code.

Fortunately, the bootloader code isn't too fussy about whether the chip size is an 'E', 'G', or 'J', only that the memory size matches.

Hi MartinL, thanks for answering me.
I can manage now to flash a bootloader with a j-link and Microchip Studio, no pb ! I was just missing to know how to recompile a bootloader for the G17. Now it's done, thanks to a lot of posts I have read since on the subject (many from you !!). So the double tap hint and ROM/RAM sizes are done.
My last problem is with the Arduino IDE and the management of packages.
Once more I have read and followed your (excellent) posts on this subject, but my IDE (2.03) still doesn't accept the package I have prepared to add a few new variants based on the G17, and hopefully using the Mattair Tech Bossac with can work with them.
I have also tried to modify the package from Sparkfun directly on the disk : The IDE can read them correctly and proposes me the new variants, but Sparkfun HW uses Arduino Bossac, and I just cannot flash the chips... (error message at upload attemps).
So the best way is to use the right procedure with the JSON file and the zip package, and I have spent a lot of time to check everything in it :

  • board.txt (with different attempts of VID/PID)
  • variants including linker files with correct memory sizes
  • package zipped and SHA256 calculated with sha256deep
  • json file modified to include variants and mattair tech bossac fork (copied from their json)
    But unvariably, the IDE still give me a message file with this json, apparently cannot find the files which are on my computer..
    "Some indexes could not be updated. Invalid package index in custom_boards/package_IOT_sensor_index.json: open custom_boards/package_IOT_sensor_index.json: Le chemin d’accès spécifié est introuvable.: file://C:/custom_boards/package_IOT_sensor_index.json"
    Maybe I can also add my json :
    package_IOT_sensor_index.json.txt (3,3 Ko)

Any idea ?

Hello, sorry or the cross post, however I saw you on a forum helping out with pwm on Arduino zero, but this thread was already closed, so I wanted to ask if you could give me any advice. Thanks

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.