start.atmel for ATmega328P displays SPI settings under ADC_0

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

Brand new to this...

Starting new project on AT328P device with only 1 ADC:

 

Create new project->ATmega328P-PU->Drivers->bump ADC from 0 up to 1.

Results look correct ADC(1)

Create New Project->click on the green ADC_0 box and I get:

 

ADC driver for MCP3201

But all of the component settings are for SPI??

 

I have noticed that if I try different part numbers it seems to work correctly.

Also, if I select 3 ADCs, the first to are SPIs, the third is an ADC

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

Just figured it out:

 

Under Component Settings, need to scroll through the driver choices: ADC:Basic, ADC:Init.

 

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

I am gonna catch hell for asking this, but why use ASF for a M328?  The 328 is a pretty straightforward AVR.

 

JIm

If you want a career with a known path - become an undertaker. Dead people don't sue! - Kartman

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB user

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

Jim,

What can you suggest?

I have an existing design that I have developed for PIC18. I use a hardware abstraction layer to separate my functionality from the underlying uC. I have successfully ported it to a TI part, now I would like to target the 328.

I am really just looking at the quickest path to the .c and .h files needed to initialize and drive the ADC, timers, pin IO, etc. and program the part. Seemed like start.atmel was a reasonable place to start, but I am now an AVR person for a grand total of 1 day.

Any suggestions would be appreciated.

Dave

 

 

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

omega_minus wrote:
Seemed like start.atmel was a reasonable place to start,
For the "complex" micros from Atmel: Cortex M (SAMD21, SAM3, SAM4), UC3 and arguably Xmega.

 

But the very simple tiny/mega have virtually nothing in ASF/Start and any code it does have will be cumbersome and bloated.

 

The fact is that tiny and mega peripherals are so simple it takes about 1hour study and 30 minutes of implementation effort to make any one of them work anyway. Not worth getting tied to some bloated baggage for something you could have done in 5 to 10 lines of C.

 

Using a 328 ADc is little more than setting ADEN and the ADPS bits and then setting ADSC to start a conversion, wait for it to return to 0 and then collecting the result from the ADC register. As I say about 5..10 lines of C.

 

The amount of effort you expound to learn the APIs that ASF/Start provide would be better applied to simply learning the raw peripheral from info in the datasheet (and the thousands and thousands of examples of its use to be found on the net).

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

Thanks, makes sense

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

Interesting use of "expound" above - my brain must have been on auto - I meant "expend"

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

No problem,

I see what you mean by "bloated baggage" in what start.atmel generates. I am almost finished trimming it down to a sensible hardware abstraction.

Thanks

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

You can also download the 'free' version of Codevision and use the configurator in that.  The only thing you cannot do with that is set Interrupts but that is easily done afterwards.

 

JIm

If you want a career with a known path - become an undertaker. Dead people don't sue! - Kartman

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB user