Beginners Question: How to implement and use ASF modules the right way

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

So that might be a pretty dumb question but I've been stuck there for quite some time and can't figure out, how to properly include certain functionalities to my project.
I just learn to work with Microchip Studios and I had a look at  a few example projects for my board (Xplained Pro WLR089). 
There is a getting started project wich includes uart wich seems to be the library needed to get Serial communication set up. An other example is the simple LED toggle. 
I am stuck at trying to get the Serial communication working on the LED toggle. What I did was to get the SERCOM USART library and the standard serial I/O  (don't know if really needed) via asf Wizard. Noticed that a conf_uart.h was missing so I manually included the one from the other example. 
After including all lines of code that seem to belong to the uart module, I was not able to just use a printf to put something out to the monitor. 

I know you can't tell me where the exact mistake is from the distance but what is the normal way to include such functionalities in an existing project ? I have an existing firmware that I want to edit, the first step for me was to include a way to print something out, but that's already a huge problematic for me. Really new to this stuff so please excuse the missing of some fundamental knowledge.

 

 

edit : project.zip here : https://files.fm/u/v8gkvzqdk

sorry for external link, file was bigger then 10mb.
You will see that there already are some printf statements, thou I can't just upload to the board and see it in the serial monitor.

 
Last Edited: Tue. May 25, 2021 - 01:10 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Do you know about https://start.atmel.com ? That is effectively ASF version 4. You can use it to configure a project to include whatever module support you want.

 

PS just realised this is ARM not AVR - I'll move it to the right ASF forum...

Last Edited: Tue. May 25, 2021 - 01:01 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ZIP up your project directory and attach the ZIP file.

 

This is easy for you.  And it saves us guessing.

 

It is the best way to get an answer for an AS7.0 problem.   (the ZIP is smaller if you clean the project first but it is not essential)

 

David.

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

i had a look at it, but didn't use it because my main goal is to edit the existing program. I know it could be better to start by creating a new one for testing and get some knowledge out of there but I also thought it should be possible to do this manually on an existing project.

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

Thanks! did it. really have no idea what I could leave out to upload so its a little bigger than 10mb what is supported in this forum.

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

You are joking.   I presume that you meant 10MB.   Surely a Blinky + UART is not going to be very big even if you have used ASF.   Especially when ZIPped.

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

Well no, this is the existing firmware, including some unnecessary stuff , although there are printf functions included, but I am not able to see these in the serial monitor. 
the other projects are the example ones for the WLR089 , getting startet project and toggle LED, wich I wanted to combine and failed. 

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

I looked at C:\Users\David Prentice\Documents\Atmel Studio\SAMD21\USART_QUICK_START_DMA1

 

17.0MB on disk when built

5.72MB on disk when clean

1.25MB on disk as a ZIP

 

YMMV.

 

David.

 

Edit.  I have only just seen your 24MB ZIP attached to #1.   Please say when you attach to an earlier message.

Anyway,  I downloaded from your external link.   It unzipped to 84MB !

I opened in AS7.0.   Clean project.   It is now 8.5MB on disk.   (probably 2MB as a ZIP)

 

I would expect this statement to configure stdio streams:

    stdio_serial_init(&cdc_uart_module, CONF_STDIO_USART_MODULE, &usart_conf);

 

I have not got your hardware.   I might try printf() on SMD21 or SAM4S

Last Edited: Tue. May 25, 2021 - 02:26 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

So you tried the getting started example project and it works?

Did you already verify (using the debugger) that the problem is not something before you setup the console and use it? Any of this could be the problem:

    pinInit();
    configure_eeprom();
    
    
    configure_bod();
    delay_init() ;
    delay_ms(5) ;
    Enable_global_interrupt() ;
    sio2host_init() ;
    configure_adc();

If that is ok then the next step is to debug the stdio / usart stuff, comparing with how it looks in the getting started project.

/Lars