ATtiny417 / ATtiny814 / ATtiny816 / ATtiny817

Go To Last Post
412 posts / 0 new

Pages

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

Ultimately you can write programs for any model of AVR using Eclipse but note that if you are using "plugins" that "know" the AVR models and perhaps allow you to select them from a drop list then those may not yet have been updated for newer models (so you may have to find some way to over-ride what they are selecting - presumably the input value for -mmcu= ?

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

AT_TRUCK wrote:
Is it possible to program attiny817 / 1616 via eclipse?

No, you will need an Atmel-ICE to program it.....  devil

 

 

 

 

 

 

 

Click Link: Get Free Stock: Retire early! PM for strategy

share.robinhood.com/jamesc3274
get $5 free gold/silver https://www.onegold.com/join/713...

 

 

 

 

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

Microchip Technology Inc

Microchip Technology

Press Release

Increase System Performance in Closed-loop Control Applications with New PIC® and AVR® MCUs

Chandler, Arizona

May 31, 2018

https://www.microchip.com/pressreleasepage/optimize-closed-loop-control-applications-with-new-PIC-and-AVR-MCUs

...

Offered in a compact 3 x 3 mm 20-pin QFN package, the new ATtiny1607 family is optimized for space-constrained closed-loop control systems such as handheld power tools and remote controls. In addition to the integrated high-speed Analog-to-Digital Converter (ADC) that provides faster conversion of analog signals resulting in deterministic system response, the devices provide improved oscillator accuracy, allowing designers to reduce external components and save costs.

...

 

Pricing and Availability

The PIC18 Q10 and ATtiny1607 are available today for sampling and in volume production. 

... and pricing for the ATtiny1607 family starts at $0.56 each in 10,000-unit quantities.

...

via https://plus.google.com/+MicrochipTech/posts/PCvM6yQN3y1

 

http://new.microchipdirect.com/product/search/all/ATtiny1607

 

"Dare to be naïve." - Buckminster Fuller

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

This is getting confusing. Let me compare the tiny AVR-0 and tiny AVR-1 side by side:

 

 

So the "zeroes" are stripped down versions of the "ones"...

edit: but do they have an ADC? I don't see it here, but it's in the datasheet.

Last Edited: Thu. May 31, 2018 - 10:30 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 

So the "zeroes" are stripped down versions of the "ones"...

Or maybe ONEs that had some flash or RAM problems and they become ZEROS? laugh

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

Where is the ADC in the Tiny1607 comparison in post # 355 but mentioned in the press release of post # 354?

 

Ross McKenzie ValuSoft Melbourne Australia

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

I copied that from Microchip's site, I think they forgot the ADC but it exists. At least it's in the datasheet.

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

I have designed a Offline Autoprogramer can support UPDI interface to program ATTINY816/817......with updi interface.

https://www.avrfreaks.net/forum/...

if you interest this, please contact me.

 

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

Microchip Technology Inc

Microchip

Product Change Notification - SYST-08NSCT658 - 11 Jun 2018 - Data Sheet - ATtiny416/ATtiny417/ATtiny816/ATtiny817 Automotive Data Sheet

http://www.microchip.com/mymicrochip/NotificationDetails.aspx?pcn=SYST-08NSCT658

...

Attachment(s):

ATtiny416/ATtiny417/ATtiny816/ATtiny817 Automotive Data Sheet

...

Microchip Technology Inc

Microchip

Product Change Notification - SYST-08FCQV798 - 11 Jun 2018 - Data Sheet - ATtiny1616/1617 Automotive Data Sheet

http://www.microchip.com/mymicrochip/NotificationDetails.aspx?pcn=SYST-08FCQV798

...

Attachment(s):

ATtiny1616/1617 Automotive Data Sheet

...

 

"Dare to be naïve." - Buckminster Fuller

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

Speed Grade corrected to: 0-8 MHz @ 2.7V – 5.5V

That's a bit depressing (used to be 0-10MHz in that voltage range, and 20MHz (now 16) f0r 4.5-5V.)

Chips/processes are not supposed to get slower...

 

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

westfw wrote:

Speed Grade corrected to: 0-8 MHz @ 2.7V – 5.5V

That's a bit depressing (used to be 0-10MHz in that voltage range, and 20MHz (now 16) f0r 4.5-5V.)

Chips/processes are not supposed to get slower...

 

Ideally, yes, they get faster ... ;)

 

I see they also did this  Removed the Data retention: 20 years at 85°C

 

I guess it comes down to yields... ?

 

 

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

remember that "normal" tiny1616 still is 20MHz

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

They say it's a documentation change only, the product is the same. I guess things just get tough @ 125 ºC and they just can't risk guaranteeing operation above 8 MHz.

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

El Tangas wrote:
So the "zeroes" are stripped down versions of the "ones"...

Microchip Technology Inc

Microchip Technology

Application Notes

AN2636 Migration Between tinyAVR® 1-Series and tinyAVR 0-Series

http://www.microchip.com//wwwAppNotes/AppNotes.aspx?appnote=en604871 

peripheral types not in tinyAVR 0-series :

  • DAC
  • PTC
  • TCD

reduced peripherals in tinyAVR 0-series :

  • AC - low power only, 16KB have one AC instead of three
  • EVSYS - channel count is halved
  • TWI - no alternate pins
  • CLKCTRL - no crystal oscillator (tinyAVR 0-series have 20MHZ internal RC, 32KHz internal RC, and EXTCLK)

 


https://www.microchip.com/wwwproducts/en/ATTINY1617

https://www.microchip.com/wwwproducts/en/ATTINY1607

 

"Dare to be naïve." - Buckminster Fuller

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

"Dare to be naïve." - Buckminster Fuller

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

#365

And for some parts less RAM 

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

El Tangas wrote:

# ATtiny3216
    signature = 0x1E 0x95 0x21;
# ATtiny3217
    signature = 0x1E 0x95 0x22;

Microchip Technology Inc

Microchip Technology

Press Release

Increase Functionality in Sensor Nodes with New 8-bit tinyAVR® MCUs

ATtiny3217 and ATtiny3216 join Microchip’s tinyAVR family with largest memory in the series

Chandler, Arizona

June 28, 2018

https://www.microchip.com/pressreleasepage/increase-functionality-in-sensor-nodes-with-tinyavr-mcus

...

Ideal for sensor applications including capacitive touch interfaces, the ATtiny3217 and ATtiny3216 bring the benefit of two Analog-to-Digital Converters (ADCs) that enable systems to implement touch control simultaneously with other analog measurements. One ADC can be used with the Peripheral Touch Controller (PTC) for touch signal acquisition, while the second one monitors other inputs such as thermistors and pressure sensors, or both ADCs can be used for faster sampling of different types of sensors. Additional benefits of the ATtiny3217 and ATtiny3216 MCUs include:

[EVSYS, POR + BOD + VLM + WWDT, 5V and 125C, 32KB flash]

...

 

Development Tools

...

For evaluation purposes, the ATtiny3217 Xplained Pro evaluation kit is also available.

[http://www.microchip.com/developmenttools/ProductDetails/ATTINY3217-XPRO]

 

Pricing and Availability

The ATtiny3217 and ATtiny3216 are available now for sampling and in volume production starting at $0.68 each in 10,000-unit quantities. The ATtiny3217 Xplained Pro evaluation kit (ATTINY3217-XPRO) is available now for $38 each.

 

...

via https://plus.google.com/+MicrochipTech/posts/Hp5ZvA4t8rM

 


http://new.microchipdirect.com/product/search/all/ATtiny3217

http://new.microchipdirect.com/product/search/all/ATtiny3216

 

"Dare to be naïve." - Buckminster Fuller

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

"Dare to be naïve." - Buckminster Fuller

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

New arrivals at Mouser though not yet in stock :

https://www.mouser.com/new/microchip/microchip-attiny204-mcu/ (ETA 31-Aug-18)

https://www.mouser.com/new/microchip/microchip-attiny404-mcu/ (ETA 31-Aug-18)

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
# ATtiny412
    signature = 0x1E 0x92 0x23;

new arrival at Mouser :

https://www.mouser.com/new/microchip/microchip-attiny412-mcu/

 

"Dare to be naïve." - Buckminster Fuller

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

tiny1607 and tiny807 are new arrivals at Mouser :

https://www.mouser.com/new/microchip/microchip-attiny1607-mcu/

https://www.mouser.com/new/microchip/microchip-attiny807-mcu/ (ETA 10-Sep'18 and 18-Oct'18)

 

Edit : ETA

 

"Dare to be naïve." - Buckminster Fuller

Last Edited: Mon. Jul 23, 2018 - 08:40 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

"Dare to be naïve." - Buckminster Fuller

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

Microchip Technology Inc

Microchip Technology

Product Change Notification - SYST-20GTSK052 - 23 Aug 2018 - Data Sheet - ATtiny3217/ATtiny1617 Data Sheet

http://www.microchip.com/mymicrochip/NotificationDetails.aspx?pcn=SYST-20GTSK052

...

 

Description of Change
These errata were removed from ATtiny3217 die revision C:

• ADC: Pending event stuck when disabling ADC

• All for CCL, RTC, and USART

 

...

 

Attachment(s):

ATtiny3217/ATtiny1617 Data Sheet

 

...

likewise for tiny3216 and tiny1616 :

http://www.microchip.com/mymicrochip/NotificationDetails.aspx?pcn=SYST-20YBIS927

 

"Dare to be naïve." - Buckminster Fuller

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

The ATtiny3217 Xplained Pro evaluation kit (ATTINY3217-XPRO) is available now for $38 each.

https://www.mouser.com/new/microchip/microchip-attiny3217-kit/

 

"Dare to be naïve." - Buckminster Fuller

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

Mouser has ordered tiny3216 (both temperature ranges) with an ETA of 14-Jan'19.

https://www.mouser.com/new/microchip/microchip-attiny3216-mcu/

https://www.microchip.com/wwwproducts/en/ATTINY3216

 

"Dare to be naïve." - Buckminster Fuller

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

Microchip Thailand will be the second assembly site for some tinyAVR 0 and 1-series.

Product Change Notification - LIAL-30BVKD482 - 17 Sep 2018 - CCB 3321 and 3321.001 Final Notice: Qualification of MTAI as an additional assembly site for selected Atmel products of the 59.91k wafer technology available in 20L VQFN package.

http://www.microchip.com/mymicrochip/NotificationDetails.aspx?pcn=LIAL-30BVKD482

 

"Dare to be naïve." - Buckminster Fuller

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

"Dare to be naïve." - Buckminster Fuller

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

"Dare to be naïve." - Buckminster Fuller

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

tinyAVR 0-series in CodeVisionAVR : 

CodeVisionAVR V3 Revision History

...

 

V3.34 Commercial Release

     

...

  • Compiler
  •  

...

  • Added support for the ATtiny202/204/402/404/406/412/804/806/807/1604/1606/1607 AVR8X chips

...

 

  • CodeWizardAVR
  • Added support for the AVR8X ATtiny202/204/402/404/406/412/804/806/807/1604/1606/1607 AVR8X chips
  • Added code generation for the ADC of the AVR8X chips

...

 

"Dare to be naïve." - Buckminster Fuller

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

I've published schematics , PCB and FWs for mEDBG based DIY debugger: https://www.avrfreaks.net/forum/xplained-yourself-diy-updi-ispdw-tpi-swd-debugger-supported-atmel-studio
Unlike Xplained series it supports all MCUs with corresponding protocol. It can be roprogrammed to UPDI ,ISP, TPI, SWD. Maybe it will help somebody.

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

"Dare to be naïve." - Buckminster Fuller

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

"Dare to be naïve." - Buckminster Fuller

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

gchapman wrote:

Forthcoming

ATtiny1607 Curiosity Nano Evaluation Kit

I love these new Curiosity Nano boards. They should release also ATtiny3217 Curiosity Nano!

extronic.pl

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

"Dare to be naïve." - Buckminster Fuller

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

tinyAVR 2-series :

ATTINY1624 - 8-bit Microcontrollers

ATTINY1626 - 8-bit Microcontrollers

ATTINY1627 - 8-bit Microcontrollers

 

edit :

The new 12-bit ADC offers true differential measuring capabilities with optional  hardware accumulation of up to 1024 samples, which effectively gives resolution up to 17-bits accuracy. With sampling rates up to 625 ksps in accumulation mode  and 294 ksps in single conversion mode the analog data is available very rapidly. The Programmable Gain Amplifier (PGA) for the ADC can amplify single-ended and differential analog inputs to make it possible to measure even small amplitude signals efficiently. 

 

"Dare to be naïve." - Buckminster Fuller

Last Edited: Sat. Jun 29, 2019 - 02:13 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 2

gchapman wrote:

tinyAVR 2-series :

ATTINY1624 - 8-bit Microcontrollers

ATTINY1626 - 8-bit Microcontrollers

ATTINY1627 - 8-bit Microcontrollers

 

edit :

The new 12-bit ADC offers true differential measuring capabilities with optional  hardware accumulation of up to 1024 samples, which effectively gives resolution up to 17-bits accuracy. With sampling rates up to 625 ksps in accumulation mode  and 294 ksps in single conversion mode the analog data is available very rapidly. The Programmable Gain Amplifier (PGA) for the ADC can amplify single-ended and differential analog inputs to make it possible to measure even small amplitude signals efficiently. 

 

 

1x 16-bit Real Time Counter (RTC) with Periodic Interrupt Controller (PIT)  <----interesting!

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

gchapman

Do you know if it is planned to add at least one DMA channel to new AVRs? Maybe to ATmega 1-series or something? 

extronic.pl

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

I highly doubt it - all these recent AVR releases appear to be various forms of "stripped down Xmega" (hence the generic term "XTiny") I'm pretty sure the very kind of thing they are going to strip are things like DMA. If you need DMA why not select a full size Xmega?

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

extronic wrote:
Do you know if it is planned to add at least one DMA channel to new AVRs?
Don't know though the engineers at Microchip do know (and very likely won't answer your question)

Approx equal split between AVR XMEGA and some of the PIC18F range on DMA.

IIRC, there are two threads here that contain XMEGA "wish" lists; there's a request for more than 4 DMA channels.

extronic wrote:
Maybe to ATmega 1-series or something?
Am guessing that megaAVR 1-series will be follow-on to USB megaAVR (mega32U4, mega32U2, etc)

Guesses on megaAVR 1-series features :

  • megaAVR 0-series UART (FBRG, auto-baud)
  • updated USB device controller
  • 12-bit ADC with an accumulator
  • etc

(Johnny Carson playing Carnac the Magnificent)

 


MAPS - MCUs & MPUs page

 

"Dare to be naïve." - Buckminster Fuller

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

near future arrivals

ATtiny1604 8-bit Microcontroller - Microchip Technology | Mouser (ETA 5-Aug'19, 125C on 22-Aug'19)

ATtiny1606 8-bit Microcontroller - Microchip Technology | Mouser (105C QFN-20 ETA 22-Nov'19, 105C SO-20 ETA 12-Jul'19, 125C SO-20 ETA 15-Jul'19)

 

"Dare to be naïve." - Buckminster Fuller

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

https://www.avrfreaks.net/forum/how-do-you-connect-32khz-crystal-attiny212412#comment-2723756 by sbennett

Today Microchip released 13 ATtiny data sheets and data sheet document revisions, including the ATtiny212/412 Data Sheet.

...

 

Product Change Notification - SYST-04QHAI697 - 05 Jul 2019 - Data Sheet - ATtiny202/402 Data Sheet

Product Change Notification - SYST-04AXGZ449 - 05 Jul 2019 - Data Sheet - ATtiny204/404 Data Sheet

 

Product Change Notification - SYST-04KONP200 - 05 Jul 2019 - Data Sheet - ATtiny212/412 Data Sheet

Product Change Notification - SYST-04LNPV937 - 05 Jul 2019 - Data Sheet - ATtiny214/414/814 Data Sheet

 

Product Change Notification - SYST-04FWAX704 - 05 Jul 2019 - Data Sheet - ATtiny406 Data Sheet

 

Product Change Notification - SYST-04FEGA974 - 05 Jul 2019 - Data Sheet - ATtiny416/816 Data Sheet

Product Change Notification - SYST-04BCKD834 - 05 Jul 2019 - Data Sheet - ATtiny417/817 Data Sheet

 

Product Change Notification - SYST-04KTVA695 - 05 Jul 2019 - Data Sheet - ATtiny804/1604 Data Sheet Document Revision

Product Change Notification - SYST-04CBMJ571 - 05 Jul 2019 - Data Sheet - ATtiny806/1606 Data Sheet Document Revision

Product Change Notification - SYST-04LRXG431 - 05 Jul 2019 - Data Sheet - ATtiny807/1607 Data Sheet Document Revision

 

Product Change Notification - SYST-04OBUV515 - 05 Jul 2019 - Data Sheet - ATtiny1614 Data Sheet Document Revision

Product Change Notification - SYST-04TVFI245 - 05 Jul 2019 - Data Sheet - ATtiny1616/3216 Data Sheet Document Revision

Product Change Notification - SYST-04LDVR120 - 05 Jul 2019 - Data Sheet - ATtiny1617/3217 Data Sheet Document Revision

 

"Dare to be naïve." - Buckminster Fuller

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

Product Change Notification - LIAL-22KDWM778 - 23 Jul 2019 - CCB 3789 Initial Notice: Qualification of MMT as an additional assembly site for selected Atmel products of the 59.91k wafer technology available in 14L SOIC (.150in) package.

...

 

Affected CPNs:

ATTINY1614-SSF

ATTINY1614-SSFR

ATTINY1614-SSN

ATTINY1614-SSNR

ATTINY204-SSF

ATTINY204-SSFR

ATTINY204-SSN

ATTINY204-SSNR

ATTINY214-SSF

ATTINY214-SSFR

ATTINY214-SSN

ATTINY214-SSNR

ATTINY404-SSF

ATTINY404-SSFR

ATTINY404-SSN

ATTINY404-SSNR

ATTINY414-SSF

ATTINY414-SSFR

ATTINY414-SSN

ATTINY414-SSNR

ATTINY814-SSF

ATTINY814-SSFR

ATTINY814-SSN

ATTINY814-SSNR

 

...

 

Estimated Qualification Completion Date:
September 2019

 

...

MMT - Microchip Technology Thailand

 

"Dare to be naïve." - Buckminster Fuller

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

gchapman wrote:

Product Change Notification - LIAL-22KDWM778 - 23 Jul 2019 - CCB 3789 Initial Notice: Qualification of MMT as an additional assembly site for selected Atmel products of the 59.91k wafer technology available in 14L SOIC (.150in) package.

...

 

Affected CPNs:

ATTINY1614-SSF

ATTINY1614-SSFR

ATTINY1614-SSN

ATTINY1614-SSNR

ATTINY204-SSF

ATTINY204-SSFR

ATTINY204-SSN

ATTINY204-SSNR

ATTINY214-SSF

ATTINY214-SSFR

ATTINY214-SSN

ATTINY214-SSNR

ATTINY404-SSF

ATTINY404-SSFR

ATTINY404-SSN

ATTINY404-SSNR

ATTINY414-SSF

ATTINY414-SSFR

ATTINY414-SSN

ATTINY414-SSNR

ATTINY814-SSF

ATTINY814-SSFR

ATTINY814-SSN

ATTINY814-SSNR

 

...

 

Estimated Qualification Completion Date:
September 2019

 

...

MMT - Microchip Technology Thailand

 

 

So basically 80% of the tiny 0 & 1 series, excluding tiny212...which i find it weird ?

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

parts with '2-SS' are SOIC-8

 

"Dare to be naïve." - Buckminster Fuller

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

gchapman wrote:

parts with '2-SS' are SOIC-8

 

Ah yeah, true...I overread this.

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

"Dare to be naïve." - Buckminster Fuller

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

Hmmph.  the Mega0, tiny0, and tiny1 USARTs are NOT the same as XMega USARTS :-(

(The Mega0/etc have 16bit, separate RXdata/TXdata registers.  The XMegas have a single 8bit DATA register.)

 

Does anyone have any bright ideas on how to translate a "modern" UART designation (UART0, pinmux 0) into the port/bit that I have to set to be an output before it will work?  It'll be annoying writing code that can work on any UART pins if I have to specify all of those separately!  (alternately, given pin/port values, derive the UART and pinmux settings, I guess.)

 

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

westfw wrote:

Hmmph.  the Mega0, tiny0, and tiny1 USARTs are NOT the same as XMega USARTS :-(

(The Mega0/etc have 16bit, separate RXdata/TXdata registers.  The XMegas have a single 8bit DATA register.)

 

Does anyone have any bright ideas on how to translate a "modern" UART designation (UART0, pinmux 0) into the port/bit that I have to set to be an output before it will work?  It'll be annoying writing code that can work on any UART pins if I have to specify all of those separately!  (alternately, given pin/port values, derive the UART and pinmux settings, I guess.)

 

 

You are right, it would be less mess if UART peripheral takes control over IO pins. 

 

I have solved it this way but I'm not really happy with this code

 

// Initialize UART as configured in uart_config.h
void Uart_Init() {

	// Config UART0
	#if UART0_USE
		Uart__InitPinsForUsart0();
		Uart__InitUsartPeripheral(&USART0, &UART0_ProgBuf, uint16_t((F_CPU * 4) / (UART0_BAUD)));
	#endif

	// Config UART1
	#if UART1_USE
		Uart__InitPinsForUsart1();
		Uart__InitUsartPeripheral(&USART1, &UART1_ProgBuf, uint16_t((F_CPU * 4) / (UART1_BAUD)));
	#endif

	// Config UART2
	#if UART2_USE
		Uart__InitPinsForUsart2();
		Uart__InitUsartPeripheral(&USART2, &UART2_ProgBuf, uint16_t((F_CPU * 4) / (UART2_BAUD)));
	#endif

	// Config UART3
	#if UART3_USE
		Uart__InitPinsForUsart3();
		Uart__InitUsartPeripheral(&USART3, &UART3_ProgBuf, uint16_t((F_CPU * 4) / (UART3_BAUD)));
	#endif

	// Interrupt for system console
	CPUINT.CTRLA	|=	CPUINT_LVL0RR_bm;									// Algorytm round-robin dla przerwań o tym samym priorytecie
	CPUINT.LVL1VEC	=	UART_CONSOLE_INT;									// Jeśli wrzucamy coś do bufora UART w przerwaniu,
															// to przerwanie opróżnienia bufora musi mieć większy priortet,
															// bo inaczej w przypadku przepełnienia bufora procesor się zawiesi
}

 

Example of UART2 RX/TX pins config. Each UART instance has separate function for this (sic!)

// Configuration of TX pin which has to be set as output and set high
// Portmux config, if specified in uart_config.h
#if UART2_USE
static void Uart__InitPinsForUsart2(void) {

	// Config for ATmegaXX08/XX09 - standard port location
	#if UART2_PORTF_01 && (HW_CPU_ATmegaXX08_28pin || HW_CPU_ATmegaXX08_32pin || HW_CPU_ATmegaXX09)
		PORTMUX.USARTROUTEA		&= ~PORTMUX_USART2_gm;
		PORTF.PIN1CTRL			 =	PORT_PULLUPEN_bm;						// Pin Rx enable pull-up
		PORTF.PIN0CTRL			 =	PORT_PULLUPEN_bm |						// Pin Tx enable pull-up
							PORT_ISC_INPUT_DISABLE_gc;					// Pin Tx disable input buffer
		VPORTF.OUT			|=	PIN0_bm;							// Pin Tx as output
		VPORTF.DIR			|=	PIN0_bm;							// Pin Tx as input
	#endif

	// Config for ATmegaXX08/XX09 - alternate port location
	#if UART2_PORTF_45 && (HW_CPU_ATmegaXX09)
		PORTMUX.USARTROUTEA		|=	PORTMUX_USART2_ALT1_gc;
		PORTF.PIN5CTRL			 =	PORT_PULLUPEN_bm;						// Pin Rx enable pull-up
		PORTF.PIN4CTRL			 =	PORT_PULLUPEN_bm |						// Pin Tx enable pull-up
							PORT_ISC_INPUT_DISABLE_gc;					// Pin Tx disable input buffer
		VPORTF.OUT			|=	PIN4_bm;							// Pin Tx as output
		VPORTF.DIR			|=	PIN4_bm;							// Pin Tx as input
	#endif
}
#endif

 

Configuration of USART peripheral 

 

// Initialization of UART peripheral (this is called only by Uart_Init());
// - Port    -	Pointer to the USART peripheral
// - Buffer  -  Pointer to ring buffer separate for each USART instancje
// - Baud    -  Baudrate calculated by preprocessor, this value is directly written to  USARTx.BAUD
static void Uart__InitUsartPeripheral(USART_t * Port, UART_Buffer_t * Buffer, uint16_t Baud) {

	Port->BAUD			=	Baud;		    							// Baud rate

	Port->CTRLA			=	USART_RXCIE_bm |							// Receive Complete Interrupt Enable
					      //USART_TXCIE_bm |							// Transmit Complete Interrupt Enable
					      //USART_DREIE_bm |							// Data Register Empty Interrupt Enable
					      //USART_RXSIE_bm |							// Receiver Start Frame Interrupt Enable
					      //USART_LBME_bm |								// Loop-back Mode Enable
					      //USART_ABEIE_bm |							// Auto-baud Error Interrupt Enable
						USART_RS485_OFF_gc;							// RS485 Mode

	Port->CTRLB			=	USART_RXEN_bm |								// Receiver Enable
						USART_TXEN_bm |								// Transmitter Enable
						USART_SFDEN_bm |							// Start Frame Detection Enable
					      //USART_ODME_bm |								// Open Drain Mode Enable
						USART_RXMODE_NORMAL_gc ;						// Receiver Mode
					      //USART_MPCM_bp;								// Multi-Processor Communication Mode

	Port->CTRLC			=	USART_CMODE_ASYNCHRONOUS_gc |						// USART Communication Mode
						USART_PMODE_DISABLED_gc |						// Parity Mode
						USART_SBMODE_1BIT_gc |							// Stop Bit Mode
						USART_CHSIZE_8BIT_gc ;							// Character Size

	#if UART_DEBUG_RUN
		Port->DBGCTRL	        =	USART_DBGRUN_bm;							// Run when breakpoint
	#endif	

	// Clear ring-buffer
	memset(Buffer, 0, sizeof(UART_Buffer_t));
}

 

extronic.pl

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

>Does anyone have any bright ideas on how to translate a "modern" UART designation (UART0, pinmux 0) into the port/bit that I have to set to be an output before it will work?

 

https://github.com/cv007/ATmega4809CuriosityNano/blob/master/usart-test.cpp

 

The Usart template parameter chooses the uart number and pin set to use (and how big a buffer you want). The Port.hpp file has all the peripheral pin groupings along with other needed info such as peripheral base address, portmux setting, irq vectors. Once the Usart has that info (in the form of the template parameter), it has all it needs to know to setup pins, set interrupts, which usart to use, etc.

 

Easy peasy :)

Last Edited: Thu. Aug 1, 2019 - 11:35 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The Port.hpp file has all the peripheral pin groupings along with other needed info such as peripheral base address, portmux setting, irq vectors.

 Interesting use of C++ features beyond my ken, and interesting program style.

 

But where did the pin info for uarts COME from?

It doesn't look like any info on pads makes it into the .h files, although I guess the .atdf files have"

        <module id="I2108" name="USART">
          <instance name="USART0">
            <register-group address-space="data" name="USART0" name-in-module="USART" offset="0x0800"/>
            <signals>
              <signal field="PORTMUX.CTRLB.USART0" function="USART0_ALT" group="RXD" pad="PA2"/>
              <signal field="PORTMUX.CTRLB.USART0" function="USART0" group="RXD" pad="PB3"/>
              <signal field="PORTMUX.CTRLB.USART0" function="USART0_ALT" group="TXD" pad="PA1"/>
              <signal field="PORTMUX.CTRLB.USART0" function="USART0" group="TXD" pad="PB2"/>
              <signal field="PORTMUX.CTRLB.USART0" function="USART0_ALT" group="XCK" pad="PA3"/>
              <signal field="PORTMUX.CTRLB.USART0" function="USART0" group="XCK" pad="PB1"/>
              <signal field="PORTMUX.CTRLB.USART0" function="USART0_ALT" group="XDIR" pad="PA4"/>
              <signal field="PORTMUX.CTRLB.USART0" function="USART0" group="XDIR" pad="PB0"/>
            </signals>
          </instance>
        </module>

 

Does a build normally have any access to the .atdf files?  I guess they're in the Atmel Pack directories, but they don't seem to make it into a typical non-AS gcc installation...

 

Pages