Author Topic: Tiny AVR-0 family. Can you please help me on this family?  (Read 1194 times)

0 Members and 1 Guest are viewing this topic.

Offline Moriambar

  • Regular Contributor
  • *
  • Posts: 159
  • Country: it
Tiny AVR-0 family. Can you please help me on this family?
« on: April 20, 2019, 01:04:23 pm »
Hi there,
up until now I was an happy avr enthusiast (meaning that, in the past I easily found out how to program them and succeeded easily). Now I'm seeing these new mcus like the tiny avr 0-series (eg attiny202) and they seem quite interesting.
I'm kinda a beginner regarding this, though, so I'm confused about this:
- Can I use my trusty usbasp to program them, or should I get an expensive pickit or something to do it? I am used to put an icsp header onto the board and then use an usbasp to program my tinys… is this still viable?
- I understand that the arduino IDE is not a feasible editor for these, and I installed MPLAB x on my mac, but I actually don't know where to look for existing libraries, like good ol' wire for arduino/attiny (Via core). Can anybody help me?

Thanks
 

Offline alan.green@gmail.com

  • Supporter
  • ****
  • Posts: 12
  • Country: au
Re: Tiny AVR-0 family. Can you please help me on this family?
« Reply #1 on: April 20, 2019, 09:02:32 pm »
I can confirm that the new 0-series and 1-series ATTinys are cheap, cheerful and fun!

My setup for programming standalone chips is Atmel Studio 7 +  Atmel ICE debugger. I can recommend this to anyone who wants it to "just work". I've had no problems at all with ATTiny404, 1616 and 3217 chips.

For an equivalent setup with MPLAB-X, you could try the PICkit-4 debugger or the MPLab Snap. According to this chart they both offer "beta" support for AVR parts.

Drawbacks of my setup are:
  • Atmel Studio is Windows only. This StackExchange post might be useful for you. (Spoiler: it's hard, do something else instead)
  • The Atmel ICE debugger is relatively expensive. That said, I have saved so much time by being able to step through code and spot my mistakes that I consider it money well spent.

I've also used the ATTiny416 Xplained Nano and it too, "just works" with Atmel Studio.

If you're looking for something less expensive, there are other options you'll need something that works with the UPDI (Unified Program and Debug Interface) protocol. Pyupdi looks useful for programming. There is also this guide to re-purposing the debugger from an xplained kit, and, apparently it can be made to work with UPDI.
« Last Edit: April 20, 2019, 09:31:57 pm by alan.green@gmail.com »
 
The following users thanked this post: Moriambar

Offline Moriambar

  • Regular Contributor
  • *
  • Posts: 159
  • Country: it
Re: Tiny AVR-0 family. Can you please help me on this family?
« Reply #2 on: April 21, 2019, 08:24:33 am »
thanks for your reply. I never used the debugging features, honestly, and although I see the huge advantage of it, I usually do small projects so I don't think I quite need it yet.

I'm used to either program the chip directly (learned using Make: Avr programming book) or via arduino ide.

So what I am trying to do is to replicate the same thing using a different programmer. The problem is that I don't know where to start. Your insightful post has given me some useful pointers, so I thank you again and plan to read it carefully and perhaps come back here later!
 

Offline Simon

  • Global Moderator
  • *****
  • Posts: 13507
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: Tiny AVR-0 family. Can you please help me on this family?
« Reply #3 on: April 21, 2019, 08:53:57 am »
So microchip now own atmel and have now started to support atmel chips in their own MPLAB wich is based I think on beans IDE so it is probably cross platform.

You will be very lucky to find any libraries that work outside of the stuff included with AVR-GCC because they are new and all of the register names are different but not only that. The register setup is now that every register appears as a struct variable so not everything will port directly across.

I just looked at Peter Pleury's Hitachi LCD controller library and while I have not tested it yet I think i was successful in making the few edits required for it to work on the new mega 0-series. Now the problem with peters library was that it used adress offsets for the port registers. You told it the port you were using and by defaul say PORTA was also the address of the PORTA register and the PIN and DDR registers were specified as offsets from PORTA. Obviously on the new series this does not work but I checked the new register address ofsets and put them in so that it should work.

Now I am looking at the adafruit graphical LCD library and it looks like you tell it each and every port name you are using so it should hopefully work but I have only just looked at it.
https://www.simonselectronics.co.uk/shop
Varied stock of test instruments and components including EEVblog gear and Wurth Elektronik Books.
Also, if you want to get ripped off: https://www.ebay.co.uk/usr/simons_electronics?_trksid=p2047675.l2559
 

Offline Simon

  • Global Moderator
  • *****
  • Posts: 13507
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: Tiny AVR-0 family. Can you please help me on this family?
« Reply #4 on: April 21, 2019, 08:58:09 am »
And of course it won't work because it talks serial with the display and all of that will be different.
https://www.simonselectronics.co.uk/shop
Varied stock of test instruments and components including EEVblog gear and Wurth Elektronik Books.
Also, if you want to get ripped off: https://www.ebay.co.uk/usr/simons_electronics?_trksid=p2047675.l2559
 

Offline Moriambar

  • Regular Contributor
  • *
  • Posts: 159
  • Country: it
Re: Tiny AVR-0 family. Can you please help me on this family?
« Reply #5 on: April 21, 2019, 09:00:34 am »
So microchip now own atmel and have now started to support atmel chips in their own MPLAB wich is based I think on beans IDE so it is probably cross platform.

You will be very lucky to find any libraries that work outside of the stuff included with AVR-GCC because they are new and all of the register names are different but not only that. The register setup is now that every register appears as a struct variable so not everything will port directly across.

I would settle for the pin definitions, and a couple of basic library (eg, spi, i2c). But hey, I can still wait and use the old avr stuff, which does less and costs more, but at least I know how to use :)
 

Offline Simon

  • Global Moderator
  • *****
  • Posts: 13507
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: Tiny AVR-0 family. Can you please help me on this family?
« Reply #6 on: April 21, 2019, 09:04:07 am »
Well I am at the start and have bumbled around so have decided that as I have nothing certain yet i may as well move in with the new stuff.
https://www.simonselectronics.co.uk/shop
Varied stock of test instruments and components including EEVblog gear and Wurth Elektronik Books.
Also, if you want to get ripped off: https://www.ebay.co.uk/usr/simons_electronics?_trksid=p2047675.l2559
 

Offline Moriambar

  • Regular Contributor
  • *
  • Posts: 159
  • Country: it
Re: Tiny AVR-0 family. Can you please help me on this family?
« Reply #7 on: April 21, 2019, 09:06:12 am »
Well I am at the start and have bumbled around so have decided that as I have nothing certain yet i may as well move in with the new stuff.
Yes I think you're right. I have been tinkering with micros for about 6 years now so the switch is kinda harder for me. I really hope a good book on the new avr will arrive asap as well as arduino support. The latter is definitely a game changer
 

Offline Simon

  • Global Moderator
  • *****
  • Posts: 13507
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: Tiny AVR-0 family. Can you please help me on this family?
« Reply #8 on: April 21, 2019, 09:12:15 am »
Well I am not very experienced in them. I almost gave up on electronics because I could not get my head around it all. Books? forget that, no one writes any.

i started to write my own wiki for the mega 0 series so that I can bring together all of the information that is sometimes spread around the datasheet into one place about each peripheral.

If you know the legacy AVR then the new series are not too hard, it,s just that the register names have changed and you will have to write the low level stuff yourself or modify other libraries.
https://www.simonselectronics.co.uk/shop
Varied stock of test instruments and components including EEVblog gear and Wurth Elektronik Books.
Also, if you want to get ripped off: https://www.ebay.co.uk/usr/simons_electronics?_trksid=p2047675.l2559
 

Offline Moriambar

  • Regular Contributor
  • *
  • Posts: 159
  • Country: it
Re: Tiny AVR-0 family. Can you please help me on this family?
« Reply #9 on: April 21, 2019, 09:16:47 am »
Well I am not very experienced in them. I almost gave up on electronics because I could not get my head around it all. Books? forget that, no one writes any.

i started to write my own wiki for the mega 0 series so that I can bring together all of the information that is sometimes spread around the datasheet into one place about each peripheral.

If you know the legacy AVR then the new series are not too hard, it,s just that the register names have changed and you will have to write the low level stuff yourself or modify other libraries.

Well it's a bit more than that, namely:
  • find a suitable programmer or modify one (the tip given above is very helpful) because a 3$ usbasp does not work anymore
  • understand where to find the pin defines (or write one)
  • understand which toolchain is necessary and how to install it onto my mac
  • then all that you said

What I'm saying is: I'd be happy if all I had to do was writing the libraries or modify the existing ones: I currently have more or less no clue on how to blink a led on an attiny 202
 

Offline Simon

  • Global Moderator
  • *****
  • Posts: 13507
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: Tiny AVR-0 family. Can you please help me on this family?
« Reply #10 on: April 21, 2019, 09:29:21 am »
Read the series manual, that explains the pins/ports. Ther are actually better named that they use to be. You can of course come up with your own nmemonics that define the code. Bcause they use truct variables it is easier now because the struct variable is x.y so you can mix definitions oy x and y to get the x.y register name.

You want to use the Atmel ICE to program the devices and if you can get MPLAB for mac that is all you need.
https://www.simonselectronics.co.uk/shop
Varied stock of test instruments and components including EEVblog gear and Wurth Elektronik Books.
Also, if you want to get ripped off: https://www.ebay.co.uk/usr/simons_electronics?_trksid=p2047675.l2559
 

Offline alan.green@gmail.com

  • Supporter
  • ****
  • Posts: 12
  • Country: au
Re: Tiny AVR-0 family. Can you please help me on this family?
« Reply #11 on: April 21, 2019, 10:07:14 am »
What I'm saying is: I'd be happy if all I had to do was writing the libraries or modify the existing ones: I currently have more or less no clue on how to blink a led on an attiny 202

Regarding libraries, you can download Microchip's l

Check out start.atmel.com - it provides you with startup code and libraries for all the modern AVR chips, including the ATTiny202.

To blink an led:
  • Go to start.atmel.com
  • Click on Create Project
  • Select ATTiny202 from the list of parts
  • On the Pin Mux page, select a pin (say PA3), name it LED and set it to be a digital output
  • Click on "Export Project", make sure MPLAB X is selected and export
  • Import into MPLAB X

You'll then have libraries which let you blink the IDE with something like this code:

Code: [Select]
while (1) {
  _delay_ms(500);
  LED_toggle_level();
}

All the code for the libraries is available in the IDE, so you examine it to see exactly how LED_toggle_level() manipulates the registers.

If you select an i2c peripheral, it will generate i2c drivers, too. These drivers are a bit more sophisticated than Arduino's wire library, but are well documented (see the doxygen directory) and easy enough to work with.

I was surprised to find that MPLAB claims to support the Atmel ICE that already own - will definitely be trying it out.
 
The following users thanked this post: edavid, Moriambar

Offline Simon

  • Global Moderator
  • *****
  • Posts: 13507
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: Tiny AVR-0 family. Can you please help me on this family?
« Reply #12 on: April 21, 2019, 10:12:27 am »
The problem I have with the atmel start is that you set stuff up and then what? so i setup a PWM output, how do i actually tell the pin to produce a cetain PWM duty? where are the instructions for driving these libraries?
https://www.simonselectronics.co.uk/shop
Varied stock of test instruments and components including EEVblog gear and Wurth Elektronik Books.
Also, if you want to get ripped off: https://www.ebay.co.uk/usr/simons_electronics?_trksid=p2047675.l2559
 

Offline Moriambar

  • Regular Contributor
  • *
  • Posts: 159
  • Country: it
Re: Tiny AVR-0 family. Can you please help me on this family?
« Reply #13 on: April 21, 2019, 10:20:38 am »
What I'm saying is: I'd be happy if all I had to do was writing the libraries or modify the existing ones: I currently have more or less no clue on how to blink a led on an attiny 202

Regarding libraries, you can download Microchip's l

Check out start.atmel.com - it provides you with startup code and libraries for all the modern AVR chips, including the ATTiny202.

To blink an led:
  • Go to start.atmel.com
  • Click on Create Project
  • Select ATTiny202 from the list of parts
  • On the Pin Mux page, select a pin (say PA3), name it LED and set it to be a digital output
  • Click on "Export Project", make sure MPLAB X is selected and export
  • Import into MPLAB X

You'll then have libraries which let you blink the IDE with something like this code:

Code: [Select]
while (1) {
  _delay_ms(500);
  LED_toggle_level();
}

All the code for the libraries is available in the IDE, so you examine it to see exactly how LED_toggle_level() manipulates the registers.

If you select an i2c peripheral, it will generate i2c drivers, too. These drivers are a bit more sophisticated than Arduino's wire library, but are well documented (see the doxygen directory) and easy enough to work with.

I was surprised to find that MPLAB claims to support the Atmel ICE that already own - will definitely be trying it out.
Thanks, I'll have to try. First I'll have to make a compatible UPDI programmer (I know it's possible) looking online.
 

Offline Simon

  • Global Moderator
  • *****
  • Posts: 13507
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: Tiny AVR-0 family. Can you please help me on this family?
« Reply #14 on: April 21, 2019, 10:23:46 am »
Just buy the atmel ICE
https://www.simonselectronics.co.uk/shop
Varied stock of test instruments and components including EEVblog gear and Wurth Elektronik Books.
Also, if you want to get ripped off: https://www.ebay.co.uk/usr/simons_electronics?_trksid=p2047675.l2559
 

Offline Moriambar

  • Regular Contributor
  • *
  • Posts: 159
  • Country: it
Re: Tiny AVR-0 family. Can you please help me on this family?
« Reply #15 on: April 21, 2019, 10:24:36 am »
Just buy the atmel ICE
just about 120€ over my budget, sorry
 

Offline Simon

  • Global Moderator
  • *****
  • Posts: 13507
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: Tiny AVR-0 family. Can you please help me on this family?
« Reply #16 on: April 21, 2019, 10:26:22 am »
well for free you get nothing. You spend time making a programmer that will be a project in itself or actually do the job you want to do.
https://www.simonselectronics.co.uk/shop
Varied stock of test instruments and components including EEVblog gear and Wurth Elektronik Books.
Also, if you want to get ripped off: https://www.ebay.co.uk/usr/simons_electronics?_trksid=p2047675.l2559
 

Offline Moriambar

  • Regular Contributor
  • *
  • Posts: 159
  • Country: it
Re: Tiny AVR-0 family. Can you please help me on this family?
« Reply #17 on: April 21, 2019, 10:28:09 am »
well for free you get nothing. You spend time making a programmer that will be a project in itself or actually do the job you want to do.
But time does not come out of my bank account, while money does. I do this as an hobby, not professionally, and I have all the time I need, but not the money, do I'd rather spend some time than a lot of money
 

Offline Simon

  • Global Moderator
  • *****
  • Posts: 13507
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: Tiny AVR-0 family. Can you please help me on this family?
« Reply #18 on: April 21, 2019, 10:30:13 am »
Fair enough.
https://www.simonselectronics.co.uk/shop
Varied stock of test instruments and components including EEVblog gear and Wurth Elektronik Books.
Also, if you want to get ripped off: https://www.ebay.co.uk/usr/simons_electronics?_trksid=p2047675.l2559
 
The following users thanked this post: Moriambar

Offline Simon

  • Global Moderator
  • *****
  • Posts: 13507
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: Tiny AVR-0 family. Can you please help me on this family?
« Reply #19 on: April 21, 2019, 10:50:07 am »
And the problem with atmel start is that it is broken, from the pwm_basic.dox file in the documentation section of the prject I just setup that only has the PWM output enabled:

Code: [Select]
/*------------------------------------------------------------------------*/ /**
\addtogroup doc_driver_pwm_basic PWM Basic Drivers

\brief Driver for basic PWM functionality.

The PWM Basic driver provides basic PWM functionality.
The driver has the following features:
- Initializing the hardware implementing the PWM as specified by the user in START
- Supports the number of PWM channels provided by the underlying hardware
- Enable and disable output of PWM channels on I/O pins
- Setting duty cycle for each of the PWM channels
- Load TOP value for the PWM, to specify resolution
- Register ISR callback routine to be called on counter overflow

The application can change the period or duty cycle when the PWM is running.
Functions are provided to configure these two parameters.
Note these are raw register values and the parameter duty_cycle means
the period of first half during one cycle, which should not be larger than
total period value.

The user can hookup a callback to the Overflow ISR, specifying any actions to be
performed by the ISR. To generate code for including a callback handler,
tick the "Include harness for IRQ on overflow"- box in START. START allows the
user to specify the rate R at which to call the ISR callback function. The
callback function is called every R'th ISR execution. If R==0, the callback is
not called by the ISR.

The PWM basic driver uses the same bit width as the Timer or PWM hardware
the driver uses, typically 8 or 16 bits. The data types used in internal
variables and parametyers to functions reflect this bit width.

\section doc_driver_pwm_basic_functional Functional Description

The PWM Basic driver is built on top of a hardware resource providing
PWM functionality. This includes a counter counting from BOTTOM to TOP
(or vice versa), and a compare register per channel. Everytime the value
of the counter matches the value of the compare register, a signal is sent
to an output pin waveform generator, generating an appropriate waveform
on the I/O pin mapped to that PWM channel. The functions
<component_name>_enable_output_chN and <component_name>_disable_output_chN
enables or disables PWM output in the I/O pin mapped
to PWM channel N. When output is enabled, the I/O pin output value is
controlled by the PWM module. When the PWM output is disabled, the I/O pin value
is not controlled by the PWM module, but by other modules or used as
generic I/O pin.

The <component_name>__load_counter() function loads the counter in the Timer
module with the specified value. The <component_name>__load_top() function
loads the TOP value (sometimes called PERIOD) register with the specified
value. For each of the PWM channels 0 to N, a function
<component_name>_load_duty_cycle_chN() loads the duty cycle register of that
PWM channel with the value specified.

The <component_name>_register_callback()-function allows the application to
hookup a callback function to the overflow ISR.


\section doc_driver_pwm_basic_hardware Hardware Dependencies

The PWM Basic driver needs Timer or PWM hardware to be available on the device.
When the user has selected a device and added a PWM component,
the Driver field in the Component Settings pane in START will
let the user select which timer driver to use, select *Drivers:PWM:Basic*
to use the PWM Basic driver.

The Configuration Pane in START will display options that are
dependent on the hardware used to implement the PWM driver.
For example, an option may allow changing the clock prescaling used
to drive the underlying timer hardware.

Different Timer or PWM hardware offer a choice of different PWM modes, such as:
- Single slope
- Dual slope (Phase Correct)
- Dual slope (Phase and Frequency Correct)
The choice of PWM mode is not visible to the PWM Basic driver other than for
initialization of the hardware. The user must make sure that a suitable mode
is chosen when selecting a configuration in START.

In some underlying hardware, the PWM channels are numbered differently from 0 to N.
Frequently, timers with PWM support provides two PWM channels named A and B, where:
- Hardware channel A is mapped to PWM Basic channel 0
- Hardware channel B is mapped to PWM Basic channel 1

In some underlying hardware, some of the PWM modes does not allow the TOP value to be
changed, instead it is fixed at a value such as 0xff, 0x1ff or 0x3ff. For such hardware,
the function <component_name>_load_top() does nothing.

Some underlying hardware have both a buffered and unbuffered version of the Period
and the Compare registers. For these hardwares, the PWM Basic driver writes to
the *buffered* Period and Compare registers in the
<component_name>_load_duty_cycle_ch<n>() and <component_name>_load_period() functions.


\section doc_driver_pwm_basic_software Software Dependencies

The PWM Basic may be configured to use use the interrupt functionality
of the underlying timer or PWM hardware. Make sure that global interrupts
are enabled (using sei()) and that the Interrupt Controller, if
present, is configured so that the Overflow interrupt is serviced
correctly.

\section doc_driver_adc_basic_code Code example

\code
 #include <atmel_start.h>

volatile bool isr_executed = false;
volatile adc_result_t measurement;
volatile uint8_t measurement_normalized;

void adc_handler_cb(void){
measurement = ADC_0_get_conversion_result();
measurement_normalized = measurement>>(ADC_0_get_resolution()-8);
isr_executed = true;
}


int main(void)
{
/* Initializes MCU, drivers and middleware */
atmel_start_init();

// Test polled mode

// Get conversion from ADC CH0
measurement = ADC_0_get_conversion(0);

// Get 8 MSB of conversion result
measurement_normalized = measurement>>(ADC_0_get_resolution()-8);

// Test IRQ mode

sei();

ADC_0_register_callback(adc_handler_cb);

// Start conversion from ADC CH0
ADC_0_start_conversion(0);

// Wait for ISR to be execued
while (!isr_executed);

while (1);
}
\endcode



*/



So tell me, am I seeing things or is the PWM documentation mixed up with the ADC documentation? If this is the level of competence they have with the atmel start thing I'd rather spend the time writing my own code rather than trying to fathom out someone elses particularly considering that hey can change that code at any time and i would have to do my research again.
https://www.simonselectronics.co.uk/shop
Varied stock of test instruments and components including EEVblog gear and Wurth Elektronik Books.
Also, if you want to get ripped off: https://www.ebay.co.uk/usr/simons_electronics?_trksid=p2047675.l2559
 

Offline alan.green@gmail.com

  • Supporter
  • ****
  • Posts: 12
  • Country: au
Re: Tiny AVR-0 family. Can you please help me on this family?
« Reply #20 on: April 21, 2019, 09:15:34 pm »

Thanks, I'll have to try. First I'll have to make a compatible UPDI programmer (I know it's possible) looking online.


pyupdi uses a USB-TTL Serial adapter as the programmer and a python program to drive it. The USB-TTL Serial adapters costs $2, and you probably already have one.

jtag2updi uses an Arduino as a programmer, driven by avrdude. I'm not sure why this is a better solution than pyupdi.

Also, maybe the 15USD MPLAB Snap fits your budget. See this forum post
 

Offline alan.green@gmail.com

  • Supporter
  • ****
  • Posts: 12
  • Country: au
Re: Tiny AVR-0 family. Can you please help me on this family?
« Reply #21 on: April 21, 2019, 09:37:09 pm »
And the problem with atmel start is that it is broken, from the pwm_basic.dox file in the documentation section of the prject I just setup that only has the PWM output enabled:

Code: [Select]
   ...

So tell me, am I seeing things or is the PWM documentation mixed up with the ADC documentation? If this is the level of competence they have with the atmel start thing I'd rather spend the time writing my own code rather than trying to fathom out someone elses particularly considering that hey can change that code at any time and i would have to do my research again.

You're right! That's clearly the ADC example tacked onto the end of the PWM documentation. I'd report a bug, but I'm not sure how to do that. I'm sure I'll see more issues like this, now that I'm looking for them.

All that said, using Atmel START has got me a long way, quickly. Most things just work, and for the things that don't, or for where START is too high-level, I have been able read the generated code along with the datasheet, and work out what it ought to be doing for myself.
 
The following users thanked this post: Moriambar

Offline Moriambar

  • Regular Contributor
  • *
  • Posts: 159
  • Country: it
Re: Tiny AVR-0 family. Can you please help me on this family?
« Reply #22 on: April 21, 2019, 09:38:18 pm »

Thanks, I'll have to try. First I'll have to make a compatible UPDI programmer (I know it's possible) looking online.


pyupdi uses a USB-TTL Serial adapter as the programmer and a python program to drive it. The USB-TTL Serial adapters costs $2, and you probably already have one.

jtag2updi uses an Arduino as a programmer, driven by avrdude. I'm not sure why this is a better solution than pyupdi.

Also, maybe the 15USD MPLAB Snap fits your budget. See this forum post
great, I definitely have an usb-ttl serial adapter, that I use to program the pro-mini clones. Thanks, I'll try that
 

Offline Simon

  • Global Moderator
  • *****
  • Posts: 13507
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: Tiny AVR-0 family. Can you please help me on this family?
« Reply #23 on: April 21, 2019, 09:40:24 pm »
Um. I just wanted to produce a PWM signal but I can't. Atmel start will not tell me how to talk to the PWM, it tells me instead to use the ADC. I want nothing to do with it. I have the same problem with ARM stuff like STM cube, gives you a load of code but does not tell you how to use it, so might as well write my own.
https://www.simonselectronics.co.uk/shop
Varied stock of test instruments and components including EEVblog gear and Wurth Elektronik Books.
Also, if you want to get ripped off: https://www.ebay.co.uk/usr/simons_electronics?_trksid=p2047675.l2559
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 2973
  • Country: us
Re: Tiny AVR-0 family. Can you please help me on this family?
« Reply #24 on: April 21, 2019, 10:30:54 pm »

Quote
find a suitable programmer or modify one (the tip given above is very helpful) because a 3$ usbasp does not work anymore
Your best bet for programming is probably the jtag2updi (runs on a $3 Arduino clone) that alan.green mentioned.There is also the https://www.microchip.com/DevelopmentTools/ProductDetails/PartNO/ATTINY416-XNANOboard, which is quite cheap (this has the top-of-the-line Tiny-1 chip, and a built-in debugger, so in theory it is useful for writing and understanding tiny1/tiny0 peripheral code.  The on-board debugger/programmer may be usable to debug/program external chips as well; I'm not sure.)

Quote
   understand which toolchain is necessary and how to install it onto my mac
The underlying CPU architecture has not changed much, and in fact is similar to some of the smaller Xmega chips.  So the free toolchain of choice is still avr-gcc, which you can download for mac ("Darwin") from http://distribute.atmel.no/tools/opensource/Atmel-AVR-GNU-Toolchain/3.6.1/ This does not include make or an IDE; just CLI compilers.
In theory, MPLAB (which is cross-platform) will support these chips, and the MPLAB SNAP programmer will program them.
AVR support in MPLAB is a bit new and buggy, though.
Also in theory, you can use the CLI compilers with standard IDEs like Eclipse, XCode, PlatformIO, etc.


Quote
  understand where to find the pin defines (or write one)
Microchip is distibuting new chip support in the form of "packs", which you can download from [url=http://packs.download.atmel.com/]http://packs.download.atmel.com/[/url]Atmel Studio (and MPLAB?) is set up to install and use these semi-automatically; they're a bit annoying to deal with if you're using one of the CLI toolchains.  I wrote some rough instructions here: [url=https://www.avrfreaks.net/comment/2526416#comment-2526416]https://www.avrfreaks.net/comment/2526416#comment-2526416[/url]Note that the pin defines for these new chips are now structure based (like XMega and ARM), rather than the old AVR-style "every register gets it's own #define"  So you end up using code like:
Code: [Select]
   x = PORTB.in;// instead of   x = PINB;
Quote
   then [libraries and etc]
You have avr-libc, but in general that doesn't support peripherals.In theory the tiny0/tiny1 series is supported by Atmel Start but people have about the same respect for Start-produced code that they have for most vendor produced libraries.  I haven't looked at the actual code much; I stopped looking when a trivial project (with USART and I2C added, for example) resulted in "project" with a diffuse and incomprehensible directory structure with over 100 files...
Various people are looking at creating Arduino Cores for these devices; surely they ought to replace ATtiny13 (which is more expensive, has less memory, and fewer peripherals), and probably most of the ATtiny85 (ditto) projects.  Your guess is as good as mine when those cores will be "mature" enough for general use (and/or whether they'll pass Atmel Start.)
 
The following users thanked this post: Moriambar


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf