Author Topic: Usart  (Read 7773 times)

0 Members and 1 Guest are viewing this topic.

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11259
  • Country: us
    • Personal site
Re: SERCOM USART SAMD10
« Reply #25 on: June 06, 2016, 07:21:24 pm »
I don't understand the question.

If you take my project,  you will have a working good example of sending strings to UART. Add your receive function and you are done.
Alex
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11259
  • Country: us
    • Personal site
Re: SERCOM USART SAMD10
« Reply #26 on: June 06, 2016, 07:29:24 pm »
I would start from trying a real terminal program,  like TeraTerm,  for example.
Alex
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11259
  • Country: us
    • Personal site
Re: SERCOM USART SAMD10
« Reply #27 on: June 06, 2016, 07:42:19 pm »
You can also try to remove "+1" in the line
Code: [Select]
  SERCOM0->USART.BAUD.reg = (uint16_t)br+1;. But I doubt it will help given that characters that are received, received correctly.
Alex
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11259
  • Country: us
    • Personal site
Re: SERCOM USART SAMD10
« Reply #28 on: June 06, 2016, 07:46:12 pm »
And yes, there is a mistake in uart_sync() function, as westfw pointed out on AVRFreaks.

But all those syncs are useless anyway, so I'll remove them altogether.

Edit: Projects on GitHub no longer have syncs. I was not adding them for new projects anyway.
« Last Edit: June 06, 2016, 07:54:48 pm by ataradov »
Alex
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11259
  • Country: us
    • Personal site
Re: SERCOM USART SAMD10
« Reply #29 on: June 06, 2016, 07:48:55 pm »
But if I now want to write about the Tera term A terminal where can I do this TeraTerm software?
This sentence makes no sense, but if you are asking how do you send things using TeraTerm, then just type it into main window.
Alex
 

Offline paul8454Topic starter

  • Contributor
  • Posts: 16
  • Country: fr
Re: SERCOM USART SAMD10
« Reply #30 on: June 06, 2016, 07:56:10 pm »
Why do you define a file startup_samd11? Since basic present. why now it appears in the src files?
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11259
  • Country: us
    • Personal site
Re: SERCOM USART SAMD10
« Reply #31 on: June 06, 2016, 07:57:54 pm »
Because that is startup code required for normal operation. Before main() can be called, MCU needs to be prepared, memories initialized. That's what startup code does.

It is also present in your ASF project, it is just buried real deep, so you don't see it.

irq_handler_reset() is actually the first thing that gets called after reset, not main(). You don't really need to have main() at all.
« Last Edit: June 06, 2016, 07:59:25 pm by ataradov »
Alex
 

Offline paul8454Topic starter

  • Contributor
  • Posts: 16
  • Country: fr
Re: SERCOM USART SAMD10
« Reply #32 on: June 06, 2016, 08:00:57 pm »
it is different from yours. Why?
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11259
  • Country: us
    • Personal site
Re: SERCOM USART SAMD10
« Reply #33 on: June 06, 2016, 08:03:23 pm »
it is different from yours. Why?
Because I wrote my own. It is a part of the program, and all programs are different. There is no reason all startup code must be the same.

You can make your own as well, if you have good enough reason.
Alex
 

Offline paul8454Topic starter

  • Contributor
  • Posts: 16
  • Country: fr
Re: SERCOM USART SAMD10
« Reply #34 on: June 06, 2016, 08:06:03 pm »
If I use the ASF file with the same name in your code that does not work. there are compilation errors. How can it be?
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11259
  • Country: us
    • Personal site
Re: SERCOM USART SAMD10
« Reply #35 on: June 06, 2016, 08:08:07 pm »
I don't understand what you are doing. There may be conflicting variables, for example. Those "compilation errors" will tell you exactly what is wrong.
Alex
 

Offline paul8454Topic starter

  • Contributor
  • Posts: 16
  • Country: fr
Re: SERCOM USART SAMD10
« Reply #36 on: June 06, 2016, 08:10:12 pm »
So later when I would like to integrate your code to mine it will in no possible because the file is not the same?
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11259
  • Country: us
    • Personal site
Re: SERCOM USART SAMD10
« Reply #37 on: June 06, 2016, 08:12:37 pm »
Depends on what you want to integrate. You can take ASF project and put  main.c and hal_gpio.h into that project and it should compile and work.

The only thing you will have to change is the name of the function irq_handler_tc1() to whatever it is called in ASF. Or remove timer code altogether if you don't need it.
Alex
 

Offline paul8454Topic starter

  • Contributor
  • Posts: 16
  • Country: fr
Re: SERCOM USART SAMD10
« Reply #38 on: June 06, 2016, 08:32:53 pm »

Finally, it works perfectly just a question about the file hal_gpio why you put '\ at the end of each line? if I remove it puts me expressions underlined in red?
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11259
  • Country: us
    • Personal site
Re: SERCOM USART SAMD10
« Reply #39 on: June 06, 2016, 08:34:44 pm »
Because that's how macros work in C. "\" is a line continuation character and macros in C have to be defined in a single logical line.

So that single logical line is split into many physical lines using "\" character.
Alex
 

Offline paul8454Topic starter

  • Contributor
  • Posts: 16
  • Country: fr
Re: SERCOM USART SAMD10
« Reply #40 on: June 06, 2016, 08:41:01 pm »

The only error that occurred is:
F_CPU undefined  so I do a "#define" has 8M
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11259
  • Country: us
    • Personal site
Re: SERCOM USART SAMD10
« Reply #41 on: June 06, 2016, 08:42:06 pm »
In my projects it is defined in the project settings, which is the right place for it.
Alex
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11259
  • Country: us
    • Personal site
Re: SERCOM USART SAMD10
« Reply #42 on: June 06, 2016, 08:49:46 pm »
Just in the project settings. Projects -> Properties -> Toolchain -> ARM/GNU C Compiler -> Symbols.
Alex
 
The following users thanked this post: paul8454

Offline paul8454Topic starter

  • Contributor
  • Posts: 16
  • Country: fr
Re: SERCOM USART SAMD10
« Reply #43 on: June 06, 2016, 08:58:18 pm »

Perfect. I understood. However I do not see why the Atmel Studio terminal does work contrary to Tera


Thank you very much
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11259
  • Country: us
    • Personal site
Re: SERCOM USART SAMD10
« Reply #44 on: June 06, 2016, 09:00:35 pm »
Because it is just that bad. AS itself barely works as an IDE, and you are asking that marginal extensions works well.

TeraTerm is used by way more people than AS is, so it is well debugged and known to work fine.
Alex
 

Offline paul8454Topic starter

  • Contributor
  • Posts: 16
  • Country: fr
Re: SERCOM USART SAMD10
« Reply #45 on: June 06, 2016, 09:08:46 pm »
OK THANK YOU
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf