Atmel Start functions documentation.

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

Ok, I'm new to using Atmel START - Studio 7, ATSAME21Nprocessor (the SAMC21N Xplained dev. board). Where is the documentation for the various hal, hpl, and hri functions that START generates for its drivers? They're not in the ASF4 manual, the START User Guide doesn't link to any references, and there's no documentation as to how to use them.

 

For instance, to pick one at random:

hri_dsu_c21n.h
 

/**
 * \file
 *
 * \brief SAM NVMCTRL
 *
 * Copyright (C) 2017 Atmel Corporation. All rights reserved.
 *
 * \asf_license_start
 *
 * \page License
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * 1. Redistributions of source code must retain the above copyright notice,
 *    this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright notice,
 *    this list of conditions and the following disclaimer in the documentation
 *    and/or other materials provided with the distribution.
 *
 * 3. The name of Atmel may not be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *
 * 4. This software may only be redistributed and used in connection with an
 *    Atmel microcontroller product.
 *
 * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
 * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 *
 * \asf_license_stop
 */

#ifdef _SAMC21_NVMCTRL_COMPONENT_
#ifndef _HRI_NVMCTRL_C21N_H_INCLUDED_
#define _HRI_NVMCTRL_C21N_H_INCLUDED_

#ifdef __cplusplus
extern "C" {
#endif

#include <stdbool.h>
#include <hal_atomic.h>

#if defined(ENABLE_NVMCTRL_CRITICAL_SECTIONS)
#define NVMCTRL_CRITICAL_SECTION_ENTER() CRITICAL_SECTION_ENTER()
#define NVMCTRL_CRITICAL_SECTION_LEAVE() CRITICAL_SECTION_LEAVE()
#else
#define NVMCTRL_CRITICAL_SECTION_ENTER()
#define NVMCTRL_CRITICAL_SECTION_LEAVE()
#endif

typedef uint16_t hri_nvmctrl_ctrla_reg_t;
typedef uint16_t hri_nvmctrl_lock_reg_t;
typedef uint16_t hri_nvmctrl_status_reg_t;
typedef uint32_t hri_nvmctrl_addr_reg_t;
typedef uint32_t hri_nvmctrl_ctrlb_reg_t;
typedef uint32_t hri_nvmctrl_param_reg_t;
typedef uint32_t hri_nvmctrl_pbldata0_reg_t;
typedef uint32_t hri_nvmctrl_pbldata1_reg_t;
typedef uint8_t  hri_nvmctrl_intenset_reg_t;
typedef uint8_t  hri_nvmctrl_intflag_reg_t;

static inline bool hri_nvmctrl_get_INTFLAG_READY_bit(const void *const hw)
{
	return (((Nvmctrl *)hw)->INTFLAG.reg & NVMCTRL_INTFLAG_READY) >> NVMCTRL_INTFLAG_READY_Pos;
}

static inline void hri_nvmctrl_clear_INTFLAG_READY_bit(const void *const hw)
{
	((Nvmctrl *)hw)->INTFLAG.reg = NVMCTRL_INTFLAG_READY;
}
....

 

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

What does your mchip FE say? 

This site only has unpaid volunteers answering questions....

 

 

Jim

 

 

Click Link: Get Free Stock: Retire early!

share.robinhood.com/jamesc3274

 

 

 

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

If you were lucky the sources would be accompanied by headers that were littered with Doxygen.
.
Sadly not all software is like this.
.
However certainly the ASF manual had the look of Doxygen about it so I assume the same may be true for Start?

Last Edited: Wed. Mar 21, 2018 - 04:20 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

EDIT: After reading pblase's OP again the answer I gave below does not at all answer his question but I will leave this post as is and answer his question in my next post below.

 

 

In AS7 under Projects click on Re-Configure Atmel Start Project, the Start configurator window opens.  Clicking on User guide will take you to the ASF4 API Reference Manual.  You will find User guide in every component as well but it only gives a summary of the device itself.  Enjoy!

 

Link to a pdf of the ASF4 API Reference Manual.

 

"I may make you feel but I can't make you think" - Jethro Tull - Thick As A Brick

"void transmigratus(void) {transmigratus();} // recursio infinitus" - larryvc

"It's much more practical to rely on the processing powers of the real debugger, i.e. the one between the keyboard and chair." - JW wek3

"When you arise in the morning think of what a privilege it is to be alive: to breathe, to think, to enjoy, to love." -  Marcus Aurelius

Last Edited: Thu. Mar 22, 2018 - 12:08 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Unfortunately the Start ASF4 API ​is just that, an api ​to help access the lower level functions that support the upper level documented functions of the ASF4 API​.

 

It appears that Microchip does not think there is a need for us to need to know what those lower level functions do as they assume you will only be using the ASF4 API​ functions anyway.  Thus no documentation is provided for them. frown 

 

However, by following the code in those lower level functions it is pretty easy to figure out what they do.  Many of us have used this method to extract the underlying code and use it directly in our programs bypassing the Start ASF4 API altogether.

"I may make you feel but I can't make you think" - Jethro Tull - Thick As A Brick

"void transmigratus(void) {transmigratus();} // recursio infinitus" - larryvc

"It's much more practical to rely on the processing powers of the real debugger, i.e. the one between the keyboard and chair." - JW wek3

"When you arise in the morning think of what a privilege it is to be alive: to breathe, to think, to enjoy, to love." -  Marcus Aurelius

Last Edited: Wed. Mar 21, 2018 - 10:59 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:
If you were lucky the sources would be accompanied by headers that were littered with Doxygen. . Sadly not all software is like this. . However certainly the ASF manual had the look of Doxygen about it so I assume the same may be true for Start?

Some headers are "littered" with Doxygen some are not.  Study of the code seems like the course of action in this case.

"I may make you feel but I can't make you think" - Jethro Tull - Thick As A Brick

"void transmigratus(void) {transmigratus();} // recursio infinitus" - larryvc

"It's much more practical to rely on the processing powers of the real debugger, i.e. the one between the keyboard and chair." - JW wek3

"When you arise in the morning think of what a privilege it is to be alive: to breathe, to think, to enjoy, to love." -  Marcus Aurelius

Last Edited: Wed. Mar 21, 2018 - 11:16 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It was pretty much the same with previous-generation ASF 

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...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks much.

I finally realized that this ASF4 is what START is using (although it doesn't say so very obviously). 

I will note that none of the GPIO functions are documented, such as gpio_set_pin_level(). I found the appropriate examples, but no documentation anywhere. Might you know where to find something on these?

 

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

pblase wrote:
I will note that none of the GPIO functions are documented, such as gpio_set_pin_level(). I found the appropriate examples, but no documentation anywhere. Might you know where to find something on these?

Folder hal->include->hal_gpio.h.  In each of the include folders I look for the hal, hpl, and hri, peripheral name that I am interested in and then peruse those files to find and see what the functions do.  No easy path given by Microchip.

 

Moral of the story, search and you shall find.

"I may make you feel but I can't make you think" - Jethro Tull - Thick As A Brick

"void transmigratus(void) {transmigratus();} // recursio infinitus" - larryvc

"It's much more practical to rely on the processing powers of the real debugger, i.e. the one between the keyboard and chair." - JW wek3

"When you arise in the morning think of what a privilege it is to be alive: to breathe, to think, to enjoy, to love." -  Marcus Aurelius