2

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);
crj11
  • 5,480
  • 1
  • 13
  • 32

0 Answers0