SAM D20 mux and pin settings

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

Hi,

 

I'm using a SAM D20 Xplained pro board and having some difficulty understanding how the muxing works. I'm using Atmel Studio.

 

This configuration works for me with SERCOM4 configured as USART.

 

    config_usart.mux_setting = USART_RX_1_TX_0_XCK_1;
    config_usart.pinmux_pad2 = PINMUX_PB08D_SERCOM4_PAD0; //TX
    config_usart.pinmux_pad3 = PINMUX_PB09D_SERCOM4_PAD1; //RX

 

What should my settings be if I want to use SERCOM3 as a USART with PA03 = TXD and PA04 = RXD?

 

TIA

Mia Dawson

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Starting by looking at "I/O Multiplexing and Considerations" in the data sheet. SERCOM are functions (columns in the table) C and D. For PA03 there are no SERCOM assignments listed so this is not a possible configuration.

Another lazy approach with ASF is to start typing the pad setting in the code, e.g., start typing PINMUX_PA03, you get a popup menu with possible definitions, however there is nothing for SERCOM. Start typing PINMUX_PA04 and PINMUX_PA04D_SERCOM0_PAD0 pops up as the only possible SERCOM assignment for that pin.

Another part of the configuration is assigning what each pad (0-3) will be used for, in ASF this is encoded as, e.g,  USART_RX_1_TX_0_XCK_1. You can select such a symbol in a Atmel Studio project and "Goto implementation" or Alt+G to check what is possible. Or look at the actual configuration this stands for in the data sheet, the description of  RXPO and TXPO in the SERCOM USART CTRLA register description.

/Lars
 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

"When all else fails, read the directions"

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Lajon wrote:
Starting by looking at "I/O Multiplexing and Considerations" in the data sheet.

Yes - that is the key.

 

ASF can't do anything that isn't supported by the underlying hardware!

ASF is just encoding the information from that table.

 

In addition, for the SERCOM PAD assignments, you have to look at the sections for the individual modes:

  • USART mode - the RXPO and TXPO bits in CTRL A;
  • SPI mode - the DIPO and DOPO bits in CTRL A;
  • I2C mode - the PINOUT bit in CTRL A.

 

Again, ASF is just encoding this information.

 

Another lazy approach with ASF is to start typing the pad setting in the code, e.g., start typing PINMUX_PA03, you get a popup menu with possible definitions

Indeed.

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
Last Edited: Fri. Mar 17, 2017 - 08:06 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Lajon wrote:

Starting by looking at "I/O Multiplexing and Considerations" in the data sheet. SERCOM are functions (columns in the table) C and D. For PA03 there are no SERCOM assignments listed so this is not a possible configuration.

Another lazy approach with ASF is to start typing the pad setting in the code, e.g., start typing PINMUX_PA03, you get a popup menu with possible definitions, however there is nothing for SERCOM. Start typing PINMUX_PA04 and PINMUX_PA04D_SERCOM0_PAD0 pops up as the only possible SERCOM assignment for that pin.

Another part of the configuration is assigning what each pad (0-3) will be used for, in ASF this is encoded as, e.g,  USART_RX_1_TX_0_XCK_1. You can select such a symbol in a Atmel Studio project and "Goto implementation" or Alt+G to check what is possible. Or look at the actual configuration this stands for in the data sheet, the description of  RXPO and TXPO in the SERCOM USART CTRLA register description.

/Lars
 

 

That is strange, because in the circuit diagram for the SAM D20 Xplained Pro, PA03/PA04 are connected to the CDC UART.

 

I wanted to thank all of you for your responses. I have not yet gotten my UART to work but you have all given me valuable feedback.

 

cheers

Mia

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

mia.dawson wrote:
PA03/PA04 are connected to the CDC UART
That is for the EDBG chip (U400) not the D20 (U300). If you follow those signals back they do connect to the D20 at PA24/PA25.

David (aka frog_jr)