How to select I/O mux for SERCOM/USART in Atmel Start

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

I am trying to evaluate Atmel Start (comparing it with coding "on the bare metal").

I am at the beginning of my experiences with the SAM D series, and a complete noob when it comes to Atmel Start.

My first test is to generate a project using an SERCOM/USART. After a bit of tinkering it seems to me that the I/O multiplexing chosen by the Atmel Start "code generator" is SERCOM-ALT. E.g. for SERCOM0 the auto-chosen I/O pins are (Rx/Tx) PA05/PA04.

 

Can I change the port multiplexing to SERCOM (rather than SERCOM-ALT)? How?

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"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. Nov 17, 2017 - 05:21 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

SERCOM0 is not available as "SERCOM" on PA05/PA04 (only on PA08/PA09)

Why would you care whether it thinks you need SERCOMALT?  To change to PA9/8, hit the "settings" gear by USART_0 and change RX/TX  under SIGNALS to PA09/PA08
 

I am trying to evaluate Atmel Start (comparing it with coding "on the bare metal").

I can't imagine anyone with 8bit microcontroller experience coming out with a favorable opinion of START :-(
100+ files and 2.7M of source, much of which seems (to me) to do more to obfuscate than "abstract."  I mean:

static inline hri_sercomspi_data_reg_t hri_sercomspi_read_DATA_reg(const void *const hw)
{
    return ((Sercom *)hw)->SPI.DATA.reg;
}

For every freaking register in every possible mode of the SERCOM...  They've got to be kidding. :-(

 

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

westfw wrote:
For every freaking register in every possible mode of the SERCOM...  They've got to be kidding. :-(

westfw is right! Just make a new C project and include sam.h in your source(s)

Look at the chapter "I/O Multiplexing and Considerations" for the possible pin assignments and multiplexer settings, then the PAD assignments in the SERCOM chapter. Then initialise it - complicated... If really necessary I could provide you with some sample code for interrupt operation of a SERCOM

Jerry

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

westfw wrote:
Why would you care whether it thinks you need SERCOMALT? 
 

I start up a new project, add a UART and what I get is this:

I assume that the initial choices there are valid ones, and thus the deduction that those settings will result in code that will use SERCOM-ALT.


I confessed right from the start that I'm a total noob re Start. I am trying to understand how this thing works.

 

Now, when I poke around in the form above I can select just about any portpin for e.g. the Rx. It seems everything is possible, yet the data sheet for the D20 seems to be very clear that its not.

 

Looking at the dropdown contents all choices but PA09 are gray, as in "not selectable" or "invalid", but I can select any of them just file. 

 

Next, if I select e.g. PA6 then the contents of the dropdown looks like this:

 

Notice that PA5, which is a possibility given muxing with SERCOM-ALT, is gray. That should be a valid choice, yes?

 

I am trying to understand this UI but it makes no sense to me at  all. I am not (pimarily ;-) ranting. I am trying to ask an honest question about how to this thing works.

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"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 letting ASF/Start go for now. It's simply a behemoth requiring more time to wrestle down than I'm prepared to spend. Pity. I was hoping it could help with usable code snippets etc...

 

Aside: The problem with my SERCOM/USART stiff on the bare metal is solved. Somewhere I had mixed up SERCOM0 and SERCOM1 and similar slips. As so often, in the process of cutting the code down to the minimum that I could present in a query here I spotted the mistake. Give a man a fishing rod...

 

Aside 2: SERCOM/USART lesson learned: For the Tx signal, do the setting of the I/O pin to output as the last thing after all other USART initialization stuff. I had garbage characters at startup/reset, so it should be pretty obvious but still took me a while to realize... [rolls eyes, facepalms in front of mirror]

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"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]