SAMC21 Xplained Pro - UART Pinmux problem

Go To Last Post
2 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have taken the USART Quick Start example and want to remap the UART tx/rx from the default (USB CDC debug on PB10 & PB11, SERCOM4) to SERCOM3, PA22 & PA23.  I have everything set up as shown below but get absolutely no output on the tx pin (looking at it with an oscilloscope).  I am toggling the LED on the Xplained Pro board everytime it successfully executes the usart_write_buffer_wait() function and it works just fine.  What am I doing wrong?

 

 

 

static struct usart_module cdc_instance;


// Configure USART
static void configure_usart_cdc(void)
{
    struct usart_config config_cdc;
    usart_get_config_defaults(&config_cdc);
    config_cdc.baudrate	 = 38400;
    
    /*
    config_cdc.mux_setting = EDBG_CDC_SERCOM_MUX_SETTING;
    config_cdc.pinmux_pad0 = EDBG_CDC_SERCOM_PINMUX_PAD0;
    config_cdc.pinmux_pad1 = EDBG_CDC_SERCOM_PINMUX_PAD1;
    config_cdc.pinmux_pad2 = EDBG_CDC_SERCOM_PINMUX_PAD2;
    config_cdc.pinmux_pad3 = EDBG_CDC_SERCOM_PINMUX_PAD3;
    */

    config_cdc.mux_setting = USART_RX_1_TX_0_XCK_1;
    config_cdc.pinmux_pad0 = EXT3_PIN_UART_TX;
    config_cdc.pinmux_pad1 = EXT3_PIN_UART_RX;
    config_cdc.pinmux_pad2 = PINMUX_UNUSED;
    config_cdc.pinmux_pad3 = PINMUX_UNUSED;
    
    while (usart_init(&cdc_instance, SERCOM3, &config_cdc) != STATUS_OK);

    usart_enable(&cdc_instance);
}

uint8_t string[] = "Hello World";

// Somewhere in main() .......


 if(usart_write_buffer_wait(&cdc_instance, string, sizeof(string)) == STATUS_OK)
 {
    port_pin_toggle_output_level(LED_0_PIN);
 }

 

This topic has a solution.
Last Edited: Mon. Mar 19, 2018 - 02:32 PM
This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1
    config_cdc.pinmux_pad0 = EXT3_PIN_UART_TX;
    config_cdc.pinmux_pad1 = EXT3_PIN_UART_RX;

is not ok, the pinmux settings need PINMUX defines, in this case

PINMUX_PA22C_SERCOM3_PAD0
PINMUX_PA23C_SERCOM3_PAD1

 

Note you can't expect there are EXTx_ defines for all possible combinations. 

/Lars