SAMD21G18A GPIO, Uart and SPI

Hi,
I am using the SAMD21G18A in a custom board and I am using the ZERO bootloader.
How can i change the GPIO for my custom board?
How to setup uart and spi ?
Anyone could help me out? , I'm new here.

Hi @Missa

You'll need to edit the board's variant.h and variant.cpp files. The Arduino SAMD variant files can (on my Windows PC at least) be found here:

C:\Users\Computer\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.8.13\variants

It depends on how close your custom board is to Arduino's existing designs. If it uses the same analog and digital pins then you should automatically acquire UART (on Serial1) and SPI functionality. If however it deviates somewhat then you'll have to configure your own in the variant files.

thank you . but if i have for exemple PA17 and PA16 for I2C, what should i change in the variant files?

Hi @Missa

Please could you specify which SERCOM (Serial Communication) module you intend to use on port pins PA16 and PA17?

On these pins it's possible to select either SERCOM1 or the alternative SERCOM3.

i'm trying to use SERCOM1

SPI sercom

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