Replacing ATtiny84A with ATtiny841

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

Dear Friends,

I had written a long program using ATtiny84(A). Due to non-availability of the IC and introduction of a better alternative ATtiny841 I tried to change the def84 to def841 and compiled. But the new program behaved differently, specially the PortA Bit 6 and 7 and the reset pin (Pin disabled in programmer). Am I missing something or some definition change ? May be some other register relating to new Debugging feature is interfering. Compiler didn't raise any error. Kindly suggest.

This topic has a solution.

We are badly destroying nature and humanity. Let us accept the responsibility and act unitedly.

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

I just googled "attiny84 migration" because Atmel generally produce application notes about how to migrate from EOL chips and the results pointed to a note about migrating from ATtin84 to ATtiny84A instead:

 

http://www.atmel.com/Images/doc8...

 

So why don't you just use ATtiny84A ?

 

Having said that if I just look at the ATtiny84 page on atmel.com I find this:

 

http://www.atmel.com/devices/att...

 

That seems to show you can still easily order ATtiny84 devices anyway.

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

Dear Clawson,

Thanks for the reply. Surprisingly new IC 841 is far cheaper (1:2) and far better and far more available. And new features relating to debugging and added interface options keep it a way ahead. One is always tempted for a better one. I will study the link and get back to you.

We are badly destroying nature and humanity. Let us accept the responsibility and act unitedly.

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

Well this document refers to tiny84A and not tiny841. Kindly revert back if you find any details.

We are badly destroying nature and humanity. Let us accept the responsibility and act unitedly.

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

Well if you really want to go with the 841 it's a case of reading both datsheets side by side to see how they differ, especially anything related to the operation of A6/A7.

 

Might be an idea to show your code too?

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

Both datasheets are totally different. Can't be read side by side. Will take long time. I am looking for someone who already has any experience.

We are badly destroying nature and humanity. Let us accept the responsibility and act unitedly.

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

Then go down your code and check the HW parts you use, and check if they work the same way. (and named the same!)

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

Ok I just had quick look at the two datasheets, and could see that  there are no OC0B pin on a 841 (looking at the pin layout), but the text have this: , "...or to generate a waveform output on the OC0B pin."

do anyone know if it's the same pin. (are there a better datasheet for the 841? the one I found was 05/14) 

 

edit 

ok I get it it has a mux, so that mean that you will need to make some init code for the 841 to use the same pin

Last Edited: Thu. May 21, 2015 - 12:55 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Most of the alternate pin functions remain neutral if unaddressed. I need to break the code in parts to look at the point of change. The problem is that Bit6 is floating almost in mid level which can not be explained in any hardware configurations. I still need to go in further in depth before I can comment on the issue with any confirmed problem. Meanwhile guys kindly keep searching. I bet you will not regret the time spent on this chip.
 

We are badly destroying nature and humanity. Let us accept the responsibility and act unitedly.

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

... Bit6 is floating...

???  Re-reading, you mean  PA6?

 

Do I read it that you are using RSTDISBL to get all the pins?  [How do you do your programming, then?)

 

Nothing jumps out at me about e.g. alternate pin functions.  Post the smallest complete test program that exhibits the symptoms.  Tell what you have connected to the affected pin(s).  Tell how you are testing, what you expect, and what you get.

 

 

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

Dear Theusch, I am using a parallel programer T51Prog2, which uses all the IC pins for programing. They use a different technique by applying high voltage at the reset pin in a specific sequence. Of-course no serial programer can reprogram the chip after RSTDSBL flag programmed.

 

Anyway, the real problem is that the same program runs fine on tiny84A.

 

The alternate pin function means, if I use the pin for any other function other than simple digital In-out like interface or pwm or capture, there I need to program the specific registers. But if I don't disturb the registers, most of them reset to no-operation in default position. I mean  no pwm, no interface, or no interrupt etc will be activated. So how come this pin PORTA6 floats. All the hardware is same, I am using this pin as simple digital-out function.

ldi  Temp,0B01111111

out DDRA,Temp

out PORTA,DATA1   ;Data1 holds the data.

Well let me comment I am still not very sure as what is happening as even my RST pin is not accepting the input although configured as INPUT. I think I need some extra register to be configured.
 

We are badly destroying nature and humanity. Let us accept the responsibility and act unitedly.

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

My crystal ball is very dusty.  Let's see this complete program.  Let's see what is connected to all pins of your AVR.  And so on; all the basic stuff.

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

The data sheet for the Tiny841 shows RxD0 on pins 5 and 11, along with TxD0 on pins 6 and 12.  Since I have never seen any an AVR device 'share' a function like TX/RX between two pins, I'm forced to assume that the data sheet could be wrong.  And if the data sheet is wrong so glaringly in one place, is it wrong in other places as well?  I don't know, maybe Atmel has first-year EE-student summer interns, with English as their third or fourth language, checking their data sheets before publishing them.

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

That is ok it has a remap bit U0MAP
 

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

Simonetta wrote:

The data sheet for the Tiny841 shows RxD0 on pins 5 and 11, along with TxD0 on pins 6 and 12.  Since I have never seen any an AVR device 'share' a function like TX/RX between two pins, I'm forced to assume that the data sheet could be wrong.

Why don't you actually read the datasheet? It's explained there. (Hint: search for REMAP).

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

or just read my answer!

 

One thing I find odd is that a 16 MHz can't run 16 MHz from a external source, can that be true ?   

This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I found the answer. The RAM in Tiny84A is mapped to 0x0060 and in Tiny841 it is mapped to 0x100. The IC works just fine. Secondly I have no doubts about the working of ATMEL, so let us not blame the manufacturer. They have taken care of everything. It is up to us to find it in the right perspective. I will suggest to all to shift to this IC (Tiny841). Thanks to all he participants.

We are badly destroying nature and humanity. Let us accept the responsibility and act unitedly.

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

I (We) don't blame Atmel for making bad chips, but the documentation are in general very very bad (to many cut and paste errors etc., so it's for a good reason nobody here trust the datasheet.)

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

sparrow2 wrote:

One thing I find odd is that a 16 MHz can't run 16 MHz from a external source, can that be true ?   

You mean table 25-4? It's probably another copy 'n' paste error from the tiny20/40 datasheet.

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

yes I think you hit the nail.

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

I found the answer. The RAM in Tiny84A is mapped to 0x0060 and in Tiny841 it is mapped to 0x100.

???  But in the first post you said that you re-built for the new processor.  did your compiler not adjust properly?  Or did you app have some hard-coded addresses, or low-level routines that used hard addresses?

 

But the code snippets presented are in assembler, so that is no "compile" involved?

 

Gee, I wish I would have asked, more than once, for code posting and a complete test program. [that >>IS<< the reason I ask--because it is useful.  Without it we were playing 20 questions.  Sheesh.]

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

Dear Theusch, You are right. My code is in assembly language and addresses are hard coded. The code is too long. What I asked was that "what are the basic differences in the two ICs". Almost all the code written for Tiny84 works for Tiny841 except the RAM addresses. Sorry for not putting it rightly. If additional features are not used, this IC is the direct replacement for the old one.

We are badly destroying nature and humanity. Let us accept the responsibility and act unitedly.

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

There is no reason for ASM to use hard-coded addresses.    Atmel provides all the details of the SFRs,   interrupt vectors,  RAM addressing, ... in the specific header file.

 

I suggest that you edit your original Tiny84 code to use the appropriate symbols and macros from its header file.    Test it thoroughly.

Then a subsequent 'port' to a tiny841 should work seamlessly.

 

David.

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

I  think what you might be missing is the idea of the auto-incrementing .org in .dseg 

 

With that you don't have to access RAM locations by absolute addresses but by symbolic name so that when you rebuild for a different CPU all that differs is the base. 

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

There are good reasons to use absolute addressing of RAM, but I guess that having 2 clean pages on 841 are better, so the problem is just that you need to know. 

 

but to make it clear what do you mean by this :

The code is too long.

?

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

Dear Sparrow2, Actually I had developed this program 4 years back, later modified it 10 times. So I tried not to disturb the basic design. The long code means, discussing and putting a code of 8000 lines on the discussion table is rather complex operation. Now I am working on Atmel Studio 6.2 using C++, so these problems are now obsolete in new programs. Any way, my problem is solved but certainly as a new user of this discussion group, I am sure any new problem will be addressed fast.
 

We are badly destroying nature and humanity. Let us accept the responsibility and act unitedly.

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

Your new project might be C++,   but one day you will need to maintain this Tiny84A/841 project.

 

I suggest that you edit it to use the header file symbols properly.    Then lfe will be better in the future.

 

Yes,  I agree that you do not want to paste 8000 lines in a message.    This is the sort of grep/edit job that you do yourself.

Personally,  I am happier to use a SED script to automate editing.    It is less prone to typos and human error.

 

You can always attach a ZIP file that contains your complete project.    Copy-paste is only suitable for "smallish" code.

 

David.

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

Yes,  I agree that you do not want to paste 8000 lines in a message.

 I certainly won't disagree.  However, (as I seem fond of saying) a small complete test program that demonstrates the symptoms is a sanity check for the poster as well as an aid for readers here.

 

As this is a significant app, and effort is apparently justified for the current initiative, then it has value to construct a new test program skeleton from scratch if needed.  Add "modules" from the original app until it "fails".

 

I stand by my ranting.  Twenty-questions is rarely fun.

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.

Last Edited: Sat. May 23, 2015 - 05:46 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Dear Theusch, Actually I never anticipated that the culprit is outside the coding. I thought I am missing or changing some definition. It was hard to know, where the trouble is, or which section of the coding is mis-interpreting. Changing memory map is something, Atmel should have told in some document, or float another document "Migration from Tiny84 to Tiny841". I took each part individually but found no mistake. Actually it never ran where as I was trying to find a Pin.
 

We are badly destroying nature and humanity. Let us accept the responsibility and act unitedly.