Is it possible to use internal pullups on SAMD21 when pins are configured for SERCOM (SPI) mode?

Electrical Engineering Asked by crj11 on December 3, 2020

According to the datasheet screen clip shown below, the internal pull up/dn configured in the PORT registers is still supposed to work even when the pin is configured for use by the SERCOM/SPI peripheral.

SPI SERCOM Doc Snippet

When I step through the SERCOM SPI Slave initialization code snippet below, I can see the pin pulled up after gpio_set_pin_pull_mode(), but the pullup goes away as soon as gpio_set_pin_function() is called. At this point, I can still pull up the pin with an external resistor. The internal pullup comes back after the second gpio_set_pin_function() call returns the pin to GPIO mode. SPI_LCC_CSL is the GPIO pin macro from Atmel START.

Is the documentation wrong, or is there something else that I need to do to keep the pullup enabled in SPI mode?

    gpio_set_pin_direction(SPI_LCC_CSL, GPIO_DIRECTION_IN);

    gpio_set_pin_pull_mode(SPI_LCC_CSL, GPIO_PULL_UP);

    // Internal pullup goes away ...
    gpio_set_pin_function(SPI_LCC_CSL, PINMUX_PA10D_SERCOM2_PAD2);

    // Internal pullup returns ...
    gpio_set_pin_function(SPI_LCC_CSL, GPIO_PIN_FUNCTION_OFF);

Add your own answers!

Related Questions

Cannot find this 6 pin IC 362J38

1  Asked on January 2, 2021 by richl


Small shock from mains

3  Asked on January 1, 2021 by mr_random_guy


MCP3461 analog side broken “somehow”?

1  Asked on December 30, 2020 by spiros-makris


UVC Lamp causes Atmega 328P to malfunction

1  Asked on December 29, 2020 by shafiyyah


Voltage doubler for LED backlight

2  Asked on December 29, 2020 by mike-spivey


I/O panel filtering for shielded room

1  Asked on December 29, 2020 by lars-petersson


Mute / blank an amplifier fast

0  Asked on December 28, 2020 by p-egli


MOSFET Driver P-channel

0  Asked on December 28, 2020 by brent-thierens


How to calculate torque of the motor?

1  Asked on December 27, 2020 by tushar-dubey


Regarding Ferrite Bead

3  Asked on December 27, 2020


Ask a Question

Get help from others!

© 2022 All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP, SolveDir