Attiny1614 datasheet (Microchip), not easy to navigate vs Old Atmel datasheets

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

Im working on a project in which we switched from an Atmega328 to the new Attiny1614-1617 from Microchip.

Even as a novice iv gotten used to the Atmel datasheets with having the the registry open for quick reference and

the way the information is presented. The new AVR's datasheet is just not what iv got known.

I guess it just does not feel *Atmel.

Anything new does have that "Now iv gotta work at learning feeling".

For me its a bummer because the code and product worked fine, minus the cost of parts.

 

What are you thoughts if any on an AVR with Microchip at the helm of the datasheet?

 

~William

Last Edited: Tue. May 22, 2018 - 06:46 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

vertamps wrote:
What are you thoughts if any on an AVR with Microchip at the helm of the datasheet?

The Microchip Way >>must<<be a better style, as they are the surviving corporate entity.

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

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

When I first came upon the AVR (M48) datasheets, I thought wow, Feature List, Pin out, Description, Gen Info, Memories, clock....   all in one datasheet, and each model I looked at were all the same.....

 

Now your knee deep into data sheet just find the pinout!....   Will not be long until there are multiple DS's, a family sheet, and a specific part sheet, oops an errata sheet...    just like PIC's.....

 

 

Jim

 

 

Edit:   not that the Atmel sheets were perfect...  with each sheet duplicating a lot of the same info (with copy/paste errors)...

 

 

 

 

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

My original post is now kind of nonsense after learning about the Attiny1614 chip.

My real issue is that the Attiny1614-17 are Xmega type tiny's which i am completely green to Xmega..

Im reading everything i can and i am SLOW to understand even setting up ports.

 

After 3 days i have this and i know that the pullup resistor syntax is wrong:

(i Know this is not a place for code examples and help, just explaining im a deer in headlights.)


    /* SETUP PORTS */
    // _bm means bit mask(Xmega series).
    PORTA.DIRSET |= PIN6_bm | PIN7_bm; // set pins 4(PA6) and pin 7(PA7) as outputs.(similar to data direction registry in atmega/true attiny series)
    PORTB.DIRSET |= PIN0_bm | PIN1_bm | PIN2_bm | PIN3_bm;// pins 6,7,8,9 as outputs.
    /// PORTA.DIRCLEAR |= PIN6_bm; Sets the PA6 port as an input.
    /* PORTA.OUTSET |= PIN6_bm sets the port pin high.
       PORTa.OUTCLEAR sets the port pin low. */
   /* Equivilent:
    DDRA |= (1<< PA6) | (1<< PA7);
    DDRB |= (1<< PB0) | (PB1)| (1<< PB2) | (1<< PB3);// Port B are all outputs
    */
    /* SETUP PIN pull-ups*/
    PORTA.PIN4CTRL |= PULLUPEN_bm;// (1<<3)???
    PORTA.PIN5CTRL |= PULLUPEN_bm;//

 

~William

Last Edited: Tue. May 22, 2018 - 06:46 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

See Tip #1 for how to properly post source code to the forum

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

vertamps wrote:
// _bm means bit mask(Xmega series).

Not juts XMega - it's quite a common notation.

 

A "mask" is just a pattern in which only the specific bit is set

 

There is often a corresponding definition for the bit number or bit position

 

So (1<<MY_BIT_POSTITION) creates a mask with just the bit in MY_BIT_POSITION set.

 

In the definitions, you will probably see something like:

 

#define MY_BIT_bm (1<<MY_BIT_position)

or

#define MY_BIT_bm (1<<MY_BIT_number)

 

 

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:
A "mask" is just a pattern in which only the specific bit is set

actually, a "mask" can be a multi-bit pattern

 

eg, if a register contains a 3-bit field, the mask for that field would have those 3 bits - and only those 3 bits - set.

 

 

EDIT

 

and the "position" of such a field would be the position of the right-most bit of the field.

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: Tue. May 22, 2018 - 06:54 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The iotn1614.h file shows this code:

/* PORT.PIN0CTRL  bit masks and bit positions */
#define PORT_ISC_gm  0x07  /* Input/Sense Configuration group mask. */
#define PORT_ISC_gp  0  /* Input/Sense Configuration group position. */
#define PORT_ISC0_bm  (1<<0)  /* Input/Sense Configuration bit 0 mask. */
#define PORT_ISC0_bp  0  /* Input/Sense Configuration bit 0 position. */
#define PORT_ISC1_bm  (1<<1)  /* Input/Sense Configuration bit 1 mask. */
#define PORT_ISC1_bp  1  /* Input/Sense Configuration bit 1 position. */
#define PORT_ISC2_bm  (1<<2)  /* Input/Sense Configuration bit 2 mask. */
#define PORT_ISC2_bp  2  /* Input/Sense Configuration bit 2 position. */
#define PORT_PULLUPEN_bm  0x08  /* Pullup enable bit mask. */
#define PORT_PULLUPEN_bp  3  /* Pullup enable bit position. */
#define PORT_INVEN_bm  0x80  /* Inverted I/O Enable bit mask. */
#define PORT_INVEN_bp  7  /* Inverted I/O Enable bit position. */

/* PORT.PIN1CTRL  bit masks and bit positions */
/* PORT_ISC  is already defined. */
/* PORT_PULLUPEN  is already defined. */
/* PORT_INVEN  is already defined. */

/* PORT.PIN2CTRL  bit masks and bit positions */
/* PORT_ISC  is already defined. */
/* PORT_PULLUPEN  is already defined. */
/* PORT_INVEN  is already defined. */

In the data sheet for the Attiny1614 is has a single PULLUPEN bit in the 'Pin n Control" registry.

In regular Xmega's they have the OPC:Output and Pull configuration Bits.

This was my hurdle in understanding as i could only find Xmega code examples to help navigate (Xtiny1614 correct name now for this chip?).

Iv never seen written why PORT is in the syntax, could have missed it.

AVR1000:Getting started writing C-code for Xmega has been my intro.

The only reason i looked for the header file was do to another avrfreak post somewhere.

 

*Edit: Could i have just done this to set the pull up as well? PORTA.PIN4CTRL |= (1<<3);//

 

~William

Last Edited: Tue. May 22, 2018 - 08:44 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

i Know this is not a place for code examples

The "beginners guide" to Xmega for those coming from tiny/mega is basically:

DDRx  -> PORTx.DIR
PINx  -> PORTx.IN
PORTx -> PORTx.OUT

If you stick to those you can just program the things like tiny/mega. Sure there are xxSET, xxxCLR, xxxTGL options and other goodies but it's all really just icing on the cake.

Last Edited: Tue. May 22, 2018 - 08:38 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

vertamps wrote:
The iotn1614.h file shows this code:

So note how everything goes in pairs - with a mask and a postition:

/* PORT.PIN0CTRL  bit masks and bit positions */
#define PORT_ISC_gm  0x07       /* Input/Sense Configuration group mask.     */
#define PORT_ISC_gp  0          /* Input/Sense Configuration group position. */

#define PORT_ISC0_bm  (1<<0)    /* Input/Sense Configuration bit 0 mask.     */
#define PORT_ISC0_bp  0         /* Input/Sense Configuration bit 0 position. */

#define PORT_ISC1_bm  (1<<1)    /* Input/Sense Configuration bit 1 mask.     */
#define PORT_ISC1_bp  1         /* Input/Sense Configuration bit 1 position. */

#define PORT_ISC2_bm  (1<<2)    /* Input/Sense Configuration bit 2 mask.     */
#define PORT_ISC2_bp  2         /* Input/Sense Configuration bit 2 position. */

#define PORT_PULLUPEN_bm  0x08  /* Pullup enable bit mask.     */
#define PORT_PULLUPEN_bp  3     /* Pullup enable bit position. */

#define PORT_INVEN_bm  0x80     /* Inverted I/O Enable bit mask.     */
#define PORT_INVEN_bp  7        /* Inverted I/O Enable bit position. */

 

 

Just a shame that they don't actually use the position definitions in creating the mask definitions.

 

(but that's probably because this is auto-generated - not manually created)

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

You can read the include files and learn most details from there. For example, for the tiny1617: https://git.omegav.no/avrkurs/at...

These files must also be somewhere in the development environment path.

 

Start here:

/*
==========================================================================
IO Module Instances. Mapped to memory.
==========================================================================
*/

#define VPORTA              (*(VPORT_t *) 0x0000) /* Virtual Ports */
#define VPORTB              (*(VPORT_t *) 0x0004) /* Virtual Ports */
#define VPORTC              (*(VPORT_t *) 0x0008) /* Virtual Ports */
#define RSTCTRL           (*(RSTCTRL_t *) 0x0040) /* Reset controller */
#define SLPCTRL           (*(SLPCTRL_t *) 0x0050) /* Sleep Controller */
#define CLKCTRL           (*(CLKCTRL_t *) 0x0060) /* Clock controller */
#define BOD                   (*(BOD_t *) 0x0080) /* Bod interface */
#define VREF                 (*(VREF_t *) 0x00A0) /* Voltage reference */
#define WDT                   (*(WDT_t *) 0x0100) /* Watch-Dog Timer */
#define CPUINT             (*(CPUINT_t *) 0x0110) /* Interrupt Controller */
#define CRCSCAN           (*(CRCSCAN_t *) 0x0120) /* CRCSCAN */
#define RTC                   (*(RTC_t *) 0x0140) /* Real-Time Counter */
#define EVSYS               (*(EVSYS_t *) 0x0180) /* Event System */
#define CCL                   (*(CCL_t *) 0x01C0) /* Configurable Custom Logic */
#define PORTMUX           (*(PORTMUX_t *) 0x0200) /* Port Multiplexer */
#define PORTA                (*(PORT_t *) 0x0400) /* I/O Ports */
#define PORTB                (*(PORT_t *) 0x0420) /* I/O Ports */
#define PORTC                (*(PORT_t *) 0x0440) /* I/O Ports */
#define ADC0                  (*(ADC_t *) 0x0600) /* Analog to Digital Converter */
#define ADC1                  (*(ADC_t *) 0x0640) /* Analog to Digital Converter */
#define AC0                    (*(AC_t *) 0x0680) /* Analog Comparator */
#define AC1                    (*(AC_t *) 0x0688) /* Analog Comparator */
#define AC2                    (*(AC_t *) 0x0690) /* Analog Comparator */
#define DAC0                  (*(DAC_t *) 0x06A0) /* Digital to Analog Converter */
#define DAC1                  (*(DAC_t *) 0x06A8) /* Digital to Analog Converter */
#define DAC2                  (*(DAC_t *) 0x06B0) /* Digital to Analog Converter */
#define USART0              (*(USART_t *) 0x0800) /* Universal Synchronous and Asynchronous Receiver and Transmitter */
#define TWI0                  (*(TWI_t *) 0x0810) /* Two-Wire Interface */
#define SPI0                  (*(SPI_t *) 0x0820) /* Serial Peripheral Interface */
#define TCA0                  (*(TCA_t *) 0x0A00) /* 16-bit Timer/Counter Type A */
#define TCB0                  (*(TCB_t *) 0x0A40) /* 16-bit Timer Type B */
#define TCB1                  (*(TCB_t *) 0x0A50) /* 16-bit Timer Type B */
#define TCD0                  (*(TCD_t *) 0x0A80) /* Timer Counter D */
#define SYSCFG             (*(SYSCFG_t *) 0x0F00) /* System Configuration Registers */
#define NVMCTRL           (*(NVMCTRL_t *) 0x1000) /* Non-volatile Memory Controller */
#define SIGROW             (*(SIGROW_t *) 0x1100) /* Signature row */
#define FUSE                 (*(FUSE_t *) 0x1280) /* Fuses */
#define LOCKBIT           (*(LOCKBIT_t *) 0x128A) /* Lockbit */
#define USERROW           (*(USERROW_t *) 0x1300) /* User Row */

 

Then you can go through the various structures definitions, for example, PORT_t:

/* I/O Ports */
typedef struct PORT_struct
{
    register8_t DIR;  /* Data Direction */
    register8_t DIRSET;  /* Data Direction Set */
    register8_t DIRCLR;  /* Data Direction Clear */
    register8_t DIRTGL;  /* Data Direction Toggle */
    register8_t OUT;  /* Output Value */
    register8_t OUTSET;  /* Output Value Set */
    register8_t OUTCLR;  /* Output Value Clear */
    register8_t OUTTGL;  /* Output Value Toggle */
    register8_t IN;  /* Input Value */
    register8_t INTFLAGS;  /* Interrupt Flags */
    register8_t reserved_0x0A;
    register8_t reserved_0x0B;
    register8_t reserved_0x0C;
    register8_t reserved_0x0D;
    register8_t reserved_0x0E;
    register8_t reserved_0x0F;
    register8_t PIN0CTRL;  /* Pin 0 Control */
    register8_t PIN1CTRL;  /* Pin 1 Control */
    register8_t PIN2CTRL;  /* Pin 2 Control */
    register8_t PIN3CTRL;  /* Pin 3 Control */
    register8_t PIN4CTRL;  /* Pin 4 Control */
    register8_t PIN5CTRL;  /* Pin 5 Control */
    register8_t PIN6CTRL;  /* Pin 6 Control */
    register8_t PIN7CTRL;  /* Pin 7 Control */
    register8_t reserved_0x18;
    register8_t reserved_0x19;
    register8_t reserved_0x1A;
    register8_t reserved_0x1B;
    register8_t reserved_0x1C;
    register8_t reserved_0x1D;
    register8_t reserved_0x1E;
    register8_t reserved_0x1F;
} PORT_t;

 

So, the main difference is that structures are #define'd instead of individual registers, although those are there too if you prefer:

/* PORT (PORTA) - I/O Ports */
#define PORTA_DIR  _SFR_MEM8(0x0400)
#define PORTA_DIRSET  _SFR_MEM8(0x0401)
#define PORTA_DIRCLR  _SFR_MEM8(0x0402)
#define PORTA_DIRTGL  _SFR_MEM8(0x0403)
#define PORTA_OUT  _SFR_MEM8(0x0404)
#define PORTA_OUTSET  _SFR_MEM8(0x0405)
#define PORTA_OUTCLR  _SFR_MEM8(0x0406)
#define PORTA_OUTTGL  _SFR_MEM8(0x0407)
#define PORTA_IN  _SFR_MEM8(0x0408)
#define PORTA_INTFLAGS  _SFR_MEM8(0x0409)
#define PORTA_PIN0CTRL  _SFR_MEM8(0x0410)
#define PORTA_PIN1CTRL  _SFR_MEM8(0x0411)
#define PORTA_PIN2CTRL  _SFR_MEM8(0x0412)
#define PORTA_PIN3CTRL  _SFR_MEM8(0x0413)
#define PORTA_PIN4CTRL  _SFR_MEM8(0x0414)
#define PORTA_PIN5CTRL  _SFR_MEM8(0x0415)
#define PORTA_PIN6CTRL  _SFR_MEM8(0x0416)
#define PORTA_PIN7CTRL  _SFR_MEM8(0x0417)

 

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

As I remember 

#define VPORTA              (*(VPORT_t *) 0x0000) /* Virtual Ports */
#define VPORTB              (*(VPORT_t *) 0x0004) /* Virtual Ports */
#define VPORTC              (*(VPORT_t *) 0x0008) /* Virtual Ports */

On the tiny's they work (and are placed) like a "normal" AVR. 

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

sparrow2 wrote:
they work (and are placed) like a "normal" AVR.
The details...