How do I import 3rd party hardware ARM drivers?

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

Dear Atmel Studio Experts,

I am new to Microchip Studio v7.

 

As you know, there is a huge number of high quality "factory made" 3rd party hardware drivers for ARM Cortex MCUs.  So, we can take advantage of these drivers when we develop Atmel ARM projects.

 

My questions are:

  1. What is the most graceful and official way to import these driver files into an Atmel Studio v7 project?
  2. Is it also possible to import these drivers into Atmel Studio Framework v3.5 so they can be shared between different projects?

 

 

Yours faithfully  laugh

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

Depends on how the high quality factory made 3rd party drivers are distributed. I would imagine that the drivers tells you how to integrate them.

:: Morten

 

(yes, I work for Microchip, yes, I do this in my spare time, now stop sending PMs)

 

The postings on this site are my own and do not represent Microchip’s positions, strategies, or opinions.

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

HKPhysicist wrote:
Atmel Studio

Now known as Microchip Studio - since last November: https://www.avrfreaks.net/forum/release-microchip-studio-702542

 

HKPhysicist wrote:
What is the most graceful and official way to import these driver files into an Atmel Studio v7 project?

As Morten said, that would depend entirely on the "drivers" in question - so have you read their documentation? have you consulted their support resources? etc, etc. ...

 

HKPhysicist wrote:
Atmel Studio Framework

You mean ASF? that actually stands for Advanced Software Framework:

 

https://www.microchip.com/en-us/development-tools-tools-and-software/libraries-code-examples-and-more/advanced-software-framework-for-sam-devices

 

As far as ASF is concerned, this "3rd party" software would be no different from any of the software that you write yourself

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

awneil wrote:

HKPhysicist wrote:

What is the most graceful and official way to import these driver files into an Atmel Studio v7 project?

As Morten said, that would depend entirely on the "drivers" in question - so have you read their documentation? have you consulted their support resources? etc, etc. ...

 

Hello awnell,

I am new to Studio. I only need some very basic technique.  My problem is:

 

I try to place 3rd party driver files into Windows file explorer; but I cannot find a way to "include" these extra files into my target project.

 

Can you help?  sad

Last Edited: Wed. Dec 8, 2021 - 05:29 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 

HKPhysicist wrote:
I am new to Studio.

Start here: https://www.microchip.com/en-us/development-tools-tools-and-software/microchip-studio-for-avr-and-sam-devices

 

At the bottom of the page, there's a whole load of 'Getting Started' videos:

 

HKPhysicist wrote:
 I cannot find a way to "include" these extra files into my target project

You still haven't said what type(s) of files they are - source? pre-built binary?

 

Since Microchip Studio is built on MS Visual Studio, the procedure is the same is in VS.

 

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...
Last Edited: Thu. Dec 9, 2021 - 09:48 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

there is a huge number of high quality "factory made" 3rd party hardware drivers for ARM Cortex MCUs.

Really?  I didn't "know" that - can you post a link to the sorts of drivers you are talking about?

 

 

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

westfw wrote:

there is a huge number of high quality "factory made" 3rd party hardware drivers for ARM Cortex MCUs.

Really?  I didn't "know" that - can you post a link to the sorts of drivers you are talking about?

 

 

 

It is my last post here because it promotes Microchip's competitor.  Good Bye.  crying

https://github.com/STMicroelectr...

 

Last Edited: Thu. Dec 9, 2021 - 05:44 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 2


HKPhysicist wrote:
It is my last post here because it promotes Microchip's competitor.


Nah.  That looks like code from ST's MEMS group, which has a bunch of products that don't directly compete with Microchip parts (or at least, not with the microcontrollers that we discuss here.)  It should be fine to discuss that code, IMHO.

 

These look like individual files designed to be added directly to a project, rather than something that needs special handling or building into a separate library.

 

  1. What is the most graceful and official way to import these driver files into an Atmel Studio v7 project? 

I  think:

  1. In the "Solution Explorer", right click and select "add/Existing Item." This will open up a file browser.
  2. Select all the files you want to add (probably just the .c and .h files from the driver directory), using ctrl-click.
  3. The files will be added (copied) to your project.  This is usually desirable; it keeps the source "controlled." in sync with your program.
  4. Put #include "xxxx.h" in your main program.
  5. Implement the stubs as documented in the readme file. (platform_read, platform_write), stuff them in the context data structure.  Any additional context your platform might need gets buried in ctx->handle (a void* ptr, so it can point to anything.)

 

Here's a screen shot, having done these steps with the aid2ih driver.  (whatever that is.)  It compiles (obviously it doesn't work, because I didn't implement platform_read/write.)

 

 

Is it also possible to import these drivers into Atmel Studio Framework v3.5 so they can be shared between different projects? 

I don't think so.  I don't think you can add user code to ASF, and as I said above, these aren't really set up to be "libraries."

 

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

HKPhysicist wrote:
3rd party hardware drivers for ARM Cortex MCUs. 

No, that's not specific to ARM Cortex at all:

ST wrote:
This repository contains examples of low-level platform-independent drivers for STMicroelectronics sensors. Sensor drivers and examples are written in C programming language.

It's just plain C source code - so you add it to your project exactly the same way that you'd add C source files that you'd written yourself

 

You could use it on an AVR, if you wanted.

 

ST further wrote:
The driver is platform-independent, you only need to define the two functions for read and write transactions from the sensor hardware bus (ie. SPI or I²C). 

So, on an  Atmel  Microchip platform, you'd use ASF to create your SPI and/or I2C functions - and all the rest is just plain, platform-agnostic, standard C source.

 

 

 

No, you can't add it to ASF.

 

I guess you could build it into a .a (pre-built binary) library, and have your project link to that - Again, as far as Studio is concerned, that's just the same as linking any other pre-built .a library.

 

westfw wrote:
That looks like code from ST's MEMS group

Yes, it is.

 

which has a bunch of products that don't directly compete with Microchip parts (or at least, not with the microcontrollers that we discuss here.)  It should be fine to discuss that code, IMHO.

Absolutely. 

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...
Last Edited: Fri. Dec 10, 2021 - 09:11 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Good guides.  Thank you.  yeslaugh

 

 

But all those int32_t data type values are too much for PIC 8 bit or AVR 8 bit.  Am I right?  blush

Last Edited: Sat. Dec 11, 2021 - 04:41 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

HKPhysicist wrote:
But all those int32_t data type values are too much for PIC 8 bit or AVR 8 bit.  Am I right?  

Not at all.

 

An int32_t is just 4 bytes; an 8-bit processor can certainly handle 4 bytes - it just has to do them one at a time.

 

AVR-GCC has direct support for int32, 32-bit floats, and even int64: https://gcc.gnu.org/wiki/avr-gcc#Type_Layout

 

It is inherently always going to be the case that generic source code can never be optimised to any specific target. ASF itself illustrates that! surprise

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...
Last Edited: Mon. Dec 13, 2021 - 11:07 AM