What are the PADs that are in the data sheet?

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

I'm spending a bit of time trying to get a bit familiar with the SAM D series. Since I have a SAM D20 Xplained Pro board on the table, I'm reading the D20 data sheet.

 

I'm looking at the SERCOM module and a term is used/referenced in a lot of places in the data sheet that I can not find any definition of at all: PAD . What is this PAD?

 

As I read the sheet I can "route" (I believe the sheet uses the term "multiplex") the output of e.g. the SERCOM1 to something called PAD[0] and PAD[1]. Are these names some kind of alias for the pins of the package? Or are they in some mysterious way referring to the digital port(s)? How do I know on what actual pins the SERCOM1 signals occur? How do I know which of Rx and Tx goes to PAD[0] and PAD[1] respectively?

 

I'm sure there's some wise thought behind this, but I'm not getting it. What am I missing?

 

 

This topic has a solution.

"He used to carry his guitar in a gunny sack, or sit beneath the tree by the railroad track. Oh the engineers would see him sitting in the shade, Strumming with the rhythm that the drivers made. People passing by, they would stop and say, "Oh, my, what that little country boy could play!" [Chuck Berry]

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

Last Edited: Fri. Oct 27, 2017 - 08:31 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You're right - it's very confusing, and not well explained.

 

IIRC, the "PADs" are what connects to the physical pins. There are various multiplexer settings to route functions such as MOSI, SCK, TX, RX (depending what mode you have the SERCOM in) to the PADs.

 

Not all combinations & permutations are available.

 

EDIT

 

Remember that a SERCOM can be a UART, or an I2C, or an SPI

 

 

Last Edited: Fri. Oct 27, 2017 - 04:50 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

"How do I know which of Rx and Tx goes to PAD[0] and PAD[1]" - you select that by setting RXPO/TXPO/DIPO/DOPO in the CTRLA register.

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

ASF provides #defines like

USART_RX_3_TX_2_XCK_3

 

 

 

 

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

OK, so where does PAD[0] and PAD[1] actually end up? Which physical pins? (Or possibly, which digital I/O signals?)

"He used to carry his guitar in a gunny sack, or sit beneath the tree by the railroad track. Oh the engineers would see him sitting in the shade, Strumming with the rhythm that the drivers made. People passing by, they would stop and say, "Oh, my, what that little country boy could play!" [Chuck Berry]

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

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

I'm doing this as an exercise to get to know the D series in general.

 

I'm using the work of Alex Taradov as a starting point. He uses the part-specific header files from ASF, and then adds a fairly straight-forward layer of macros for digital I/O. He has a demo application that does digital I/O, sets up a timer to generate periodic interrupts and also does SERCOM (UART) communiation. Alex's work is here: https://github.com/ataradov/mcu-... .

Here's the init of the SERCOM module:


static void uart_init(uint32_t baud)
{
  uint64_t br = (uint64_t)65536 * (F_CPU - 16 * baud) / F_CPU;

  HAL_GPIO_UART_TX_out();
  HAL_GPIO_UART_TX_pmuxen(PORT_PMUX_PMUXE_C_Val);
  HAL_GPIO_UART_RX_in();
  HAL_GPIO_UART_RX_pmuxen(PORT_PMUX_PMUXE_C_Val);

  PM->APBCMASK.reg |= PM_APBCMASK_SERCOM3;

  GCLK->CLKCTRL.reg = GCLK_CLKCTRL_ID(SERCOM3_GCLK_ID_CORE) |
      GCLK_CLKCTRL_CLKEN | GCLK_CLKCTRL_GEN(0);

  SERCOM3->USART.CTRLA.reg =
      SERCOM_USART_CTRLA_DORD | SERCOM_USART_CTRLA_MODE_USART_INT_CLK |
      SERCOM_USART_CTRLA_RXPO(3/*PAD3*/) | SERCOM_USART_CTRLA_TXPO/*PAD2*/;

  SERCOM3->USART.CTRLB.reg = SERCOM_USART_CTRLB_RXEN | SERCOM_USART_CTRLB_TXEN |
      SERCOM_USART_CTRLB_CHSIZE(0/*8 bits*/);

  SERCOM3->USART.BAUD.reg = (uint16_t)br;

  SERCOM3->USART.CTRLA.reg |= SERCOM_USART_CTRLA_ENABLE;
}


[Sorry, no proper code markup. The code editor is borken for me here in "community". Works OK in avrfreaks, though...]

 

From other parts of Alex code I can deduce that the Tx is on pin 24 and RX is on pin 25, but can't make sense of how the part I've marked in bold actually maps to those physical pins.

 

EDIT: Well, I have realized that talking about pin numbers are not that meaningful since the BGA package does not do pin numbering in the "classical" sense. It's rows of A..H and columns of 1..8 for the D20J.

 

If Alex's pin numbers refer to the QFN/TQFP packages then pin 24 and 25 are digital I/Os PB11 and PB12. Going to the BGA this would be E5 and F5.

 

I still don't see any hints as to how the PAD[n] stuff map to any of this..

"He used to carry his guitar in a gunny sack, or sit beneath the tree by the railroad track. Oh the engineers would see him sitting in the shade, Strumming with the rhythm that the drivers made. People passing by, they would stop and say, "Oh, my, what that little country boy could play!" [Chuck Berry]

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

Last Edited: Fri. Oct 27, 2017 - 05:27 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I think I ended up looking at the ASF examples for the XPro boards, and working backwards from them.

 

I also find that the Code editor is completely and utterly broken here - as opposed to just dodgy on AVRFreaks.

 

edit

the text formatting when composing is also broken here, though not on 'freaks.

And Chrome says, "This page is trying to load scripts from unauthenticated sources" here, though not on 'freaks.

Last Edited: Fri. Oct 27, 2017 - 05:34 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Mapping between the SERCOM pads and the actual pins is defined in a table at the top of the "I/O Multiplexing and Considerations" section. In the Taradov's example that would be inside "HAL_GPIO_UART_TX_pmuxen(PORT_PMUX_PMUXE_C_Val)", I assume.

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

A new search of the data sheet, after your input above, reveled this [section 24.5.1 I/O lines, p 370]:

From USART Block Diagram one can see that the SERCOM has four internal pads, PAD[3:0]. The
signals from I2C, SPI and USART are routed through these SERCOM pads via a multiplexer.

So, the structure is something like the below (talking in USART terms, and only bothering with Tx and Rx):

 

+--------------------+           +-----------+

|                    | Rx signal |           | 

|                    +-----------+           | 

|                    |           |           +----------o  PAD[0]

|    S E R C O M     |           |   M U X   |     .         .

|                    |           |           |     .         .

|                    | Tx signal |           +----------o  PAD[3] 

|                    +-----------+           |

|                    |           |           |

+--------------------+           +-----------+

 

and the MUX can "route" Tx and Rx to PAD[0] .. PAD[3].

 

So far, so good.

 

What is still not clear is where those PAD[0] to PAD[3] end up going.

 

(I'll do a fourth dig in the sheet..)

"He used to carry his guitar in a gunny sack, or sit beneath the tree by the railroad track. Oh the engineers would see him sitting in the shade, Strumming with the rhythm that the drivers made. People passing by, they would stop and say, "Oh, my, what that little country boy could play!" [Chuck Berry]

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

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

Oh, I see you both posted while I was busy with the ASCII graphics.. ;-)

 

I'll check out what you wrote. Thanks!

"He used to carry his guitar in a gunny sack, or sit beneath the tree by the railroad track. Oh the engineers would see him sitting in the shade, Strumming with the rhythm that the drivers made. People passing by, they would stop and say, "Oh, my, what that little country boy could play!" [Chuck Berry]

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

@ezharkov: So, let's see if I got this right then..

Alex uses SERCOM3.

 

In the table "PORT Function Multiplexing" (section 7.1 Multiplexed Signals, pp27..), entering through the column "SERCOM" (not "SERCOM ALT"!), locating SERCOM3/PAD[n] entries and going left to the "I/O pin" column: SERCOM3/PAD[0..3] maps to I/O pins PA22..PA25.

 

Alex does

 

  SERCOM3->USART.CTRLA.reg =
      SERCOM_USART_CTRLA_DORD | SERCOM_USART_CTRLA_MODE_USART_INT_CLK |
      SERCOM_USART_CTRLA_RXPO(3/*PAD3*/) | SERCOM_USART_CTRLA_TXPO/*PAD2*/;

 

so he sets the MUX to route Rx to PAD[3] and Tx to PAD[2]. Going back to the table in the data sheet those two certainly map to PA24 and PA25.

 

It makes sense now. Thank you!

 

EDIT: I will mark this post of mine as the solution since I've been explicit here about how it works and where it's documented. Still, I'd like to note that  it was the comment by ezharkov above that finally opened my eyes.

"He used to carry his guitar in a gunny sack, or sit beneath the tree by the railroad track. Oh the engineers would see him sitting in the shade, Strumming with the rhythm that the drivers made. People passing by, they would stop and say, "Oh, my, what that little country boy could play!" [Chuck Berry]

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

Last Edited: Fri. Oct 27, 2017 - 08:31 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

I was just relying on the example codes to figure out the functionality of sercom pins.
This post seems to bring more of an idea like how things works. yes

Thanks & Regards,

Hari

Silly beans are always silly
:)

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

ezharkov wrote:
Mapping between the SERCOM pads and the actual pins is defined in a table at the top of the "I/O Multiplexing and Considerations" section.
 

JohanEkdahl wrote:
it was the comment by ezharkov above that finally opened my eyes
 

Yes, that table is the key.

 

When working with the SAMD, that's a table to print out and have stuck on your wall.

 

EDIT

 

I made an Excel  version - attached.

 

It's a shame that Atmel (like most other manufacturers) don't provide this information in an easily machine-accessible format.

frown

 

Attachment(s): 

Last Edited: Sat. Oct 28, 2017 - 10:53 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Let me add that figure 22-1 PORT Block Diagram on p 321 is illustrative. I would have liked for that figure to be in the vicinity of table 7-1 PORT Function Multiplexing which is on pages 27-29. It's much more an illustration of how peripherals are multiplexed "onto" the digital I/O pins than an illustration of digital I/O per se.

 

I guess part of my woes is just the experience of getting comfortable with a different organization, philosophy, layout and "mindset" of data sheets as compared to the 8-bit AVR sheets. Still I hope that what has been going on in this thread might help others.

 

BTW, the scheme of-course repeats itself for other "digital peripherals", e.g. timers. And from figure 22-1 it seems that the scheme does not hold for analog peripherals - though I still haven't looked into the ADCs and DAC, so I might be wrong here.

 

@awneil: Thanks for the spreadsheet! (Interesting to see your selection of SAM Ds in that.. D20, D21 and R21. That bears a scaring resemblance to my "plan of attack".. ;-)

"He used to carry his guitar in a gunny sack, or sit beneath the tree by the railroad track. Oh the engineers would see him sitting in the shade, Strumming with the rhythm that the drivers made. People passing by, they would stop and say, "Oh, my, what that little country boy could play!" [Chuck Berry]

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

Last Edited: Sat. Oct 28, 2017 - 06:41 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I made an Excel  version

I've been doing google doc versions of the pinouts for most new processors I think about using.

It's really nice to be able to sort on the different columns ("Arduino X pinNo./Chip Pinno/ GPIO Port, etc.)

And of course entering all that data helps a lot with getting a "feel" for what is available...

And: shareable!

 

https://drive.google.com/drive/u...

https://docs.google.com/spreadsh...

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

JohanEkdahl wrote:
D20, D21 and R21.

That was largely based on the order of availability of chips & dev kits ...

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

westfw wrote:
It's really nice to be able to sort on the different columns

The most useful feature I find is VLOOKUP - for easy cross-reference from one table to another ...

 

Does the google thing support that?