TransWikia.com

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!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP