ATMega 48A Programing

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

Hi guys

 

We have this one issue with the AVR Microcontroller ATMega48A that i cant figure out why is this happening so we have more sets of Microcontrollers one 1705 and one is 1504 and then few others our customer claims and i could test it that the one chips with 1705 can by programmed at 2MHz and that the other ones cant what is not absolutely true cause i found few of 1504 that can be programmed at 2MHz but there are lot of then that cant be Programmed at that speed at least not every time because i found a way but its kinda unstable, so to make it short when i want to program the Microcontroller i set everything tool device interface i put voltage on the board and hold my programming tool on to the pins where the IC will get his stuff and i press apply the Studio set my clock on 8kHz so i make it on 2MHz the the 1705 IC are working like there would be no tomorrow but the 1504 dont i just get a message that its unable to enter programming mode so o we was thinking hmm maybe its some cheap stuff from some questionable Chinese supplier ( we bought it from our local supplier, small firm but they claim its original ) so we bought another set of this chips from another supplier just to by sure and they are looking totally different from what we have i mean the markings so i soldered few on a board and well well well they dont want to by disturbed with any 2MHz frequencies, so yea shit what can be bad so i try few times something different and i found a way that i can use to program this chips with 2MHz its goes like this: i will set everything tool device interface but i make a difference i dont supply voltage and i dont hold my tool on the programming pins i press Apply it set my ISP clock to 2MHz i hold the tool on pins give it 3V and now it works i can read the device signature and i can program it only there is one thing the programming is slow like a snail normally it takes 5 seconds when its slow it takes 30 seconds.

This topic has a solution.

Last Edited: Wed. Dec 4, 2019 - 01:37 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Why is your description going on & on & on?  You don't even mention what programmer you are using!

Anyhow, other devices on you ISP lines (DACs, radios modules, etc), resistors, caps, LEDs, etc can load things down.  Are all of your ISP lines used ONLY for programming?  This is not a requirement, but could offer some explanation.

 

If the chip is factory set to use the internal 8MHz clock & the div 8 is enabled (typical factory setting), then you can ISP program at 8 MHz/8/4=250 KHz, maximum (typical).

 

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

Last Edited: Tue. Dec 3, 2019 - 08:07 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I think my brain just exploded reading that. How can the average person extract any fact out of that one sentence?

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

Kartman wrote:

I think my brain just exploded reading that. How can the average person extract any fact out of that one sentence?

 

Nice to know you just have to read im not responsible when you cant read it what should i type you something like this: duh dont work And when you cant help then dont write 

 

avrcandies wrote:

Why is your description going on & on & on?  You don't even mention what programmer you are using!

Anyhow, other devices on you ISP lines (DACs, radios modules, etc), resistors, caps, LEDs, etc can load things down.  Are all of your ISP lines used ONLY for programming?  This is not a requirement, but could offer some explanation.

 

If the chip is factory set to use the internal 8MHz clock & the div 8 is enabled (typical factory setting), then you can ISP program at 8 MHz/8/4=250 KHz, maximum (typical).

 

 

you cant make it shorter cause this whole problem is strange to me and i done a lot have not rly slept for few days so sorry blush, take your morning coffe laugh . We are using the Atmel-ICE mostly, i figured out that something like resistors caps etc could do that, so we connected the IC directly and the failure was still same. Our customer complains that it does not even work properly so no idea

Last Edited: Tue. Dec 3, 2019 - 09:38 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You cannot reliably program a chip with a 2MHz ISP clock. Set it to 250kHz.

#1 This forum helps those that help themselves

#2 All grounds are not created equal

#3 How have you proved that your chip is running at xxMHz?

#4 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand." - Heater's ex-boss

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

Well I read it too and I can't make head nor tail of it either!

 

Presumably these 1705 and 1504 you are talking about are manufacturing date codes are they (I assume May 2017 and April 2015 perhaps??)

 

Terms such as " the other ones cant" is almost totally useless as a fault report. It's a bit like me saying "my car won't start - what's wrong with it?". If I told you that I turn the key but there's no sound from the engine you'd have a better guess that it's probaly an electrical fault etc. etc.

 

I do wonder why you are trying to program chips at 2MHz anyway. Most AVRs (inc mega48) arrive with their clocks set to 1MHz default so, because of the 1/4 speed ISP requirement this means that ISP is not expected to work at anything over 250kHz. To be able to program them at 2MHz their clocks would need to be at least 8MHz but to achieve that you would need to have at least one slower ISp session first to change the CKDIV8 fuse - that step must be done at 250kHz.

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

you were so busy lost in your lack of sleep, you missed my comment:

 

If the chip is factory set to use the internal 8 MHz clock & the div 8 is enabled (typical factory setting), then you can ISP program at 8 MHz/8/4=250 KHz, maximum (typical).

 

I look forward to reading your first novel.

 

Our customer complains that it does not even work properly so no idea

Please give him a detailed report of what you discover to fix it.

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

Last Edited: Tue. Dec 3, 2019 - 10:03 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:

Well I read it too and I can't make head nor tail of it either!

 

Presumably these 1705 and 1504 you are talking about are manufacturing date codes are they (I assume May 2017 and April 2015 perhaps??)

 

Terms such as " the other ones cant" is almost totally useless as a fault report. It's a bit like me saying "my car won't start - what's wrong with it?". If I told you that I turn the key but there's no sound from the engine you'd have a better guess that it's probaly an electrical fault etc. etc.

 

I do wonder why you are trying to program chips at 2MHz anyway. Most AVRs (inc mega48) arrive with their clocks set to 1MHz default so, because of the 1/4 speed ISP requirement this means that ISP is not expected to work at anything over 250kHz. To be able to program them at 2MHz their clocks would need to be at least 8MHz but to achieve that you would need to have at least one slower ISp session first to change the CKDIV8 fuse - that step must be done at 250kHz.

 

i dont know either what actualy wrong with it cause we have always programmed it with 125kHz but our customer was claiming he could do it with 2Mhz and now he cant and softwear does not work properly and we should find out why etc. Ah yes the 1705 and 1504 i also presume its production code i was thinking im on avrfreaks forum and everybody knows haha

 

avrcandies wrote:

you were so busy lost in your lack of sleep, you missed my comment:

 

If the chip is factory set to use the internal 8 MHz clock & the div 8 is enabled (typical factory setting), then you can ISP program at 8 MHz/8/4=250 KHz, maximum (typical).

 

I look forward to reading your first novel.

 

Our customer complains that it does not even work properly so no idea

Please give him a detailed report of what you discover to fix it.

 

trust me the stupid things our customers are complaining about i could write few novels, like i said i was also kinda confused i know that the internal clock is 1MHz but like i said our customer said he could do it before with 2Mhz and now he cant and the softwear does not work now properly so we should figure it out, we did not design the board or software

Last Edited: Tue. Dec 3, 2019 - 10:51 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Wotan2666 wrote:

...i know that the internal clock is 1MHz but like i said our customer said he could do it before with 2Mhz and now he cant and the softwear does not work now properly so we should figure it out, we did not design the board or software

 

OK.

 

So the datasheet for the chip clearly says that the SPI clock frequency must be no faster than 1/4 of the CPU clock. The chip defaults to running on the internal 8MHz oscillator with the div8 fuse set so that the chip is running at 1Mhz which means you cannot program it at greater than 250kHz. End of story. However...

 

If you turn off the div8 fuse, when running with a 250kHz programming clock, so that the chip is now running at 8MHz then you can, in theory, change your programming speed to 2MHz. But that requires that your programming software supports two-step two-speed programming. And that fuses are programmed first. I say 'in theory' because connections become a lot more critical at 2MHz and reliability goes down.

 

It is now up to you to do some more investigation.

#1 This forum helps those that help themselves

#2 All grounds are not created equal

#3 How have you proved that your chip is running at xxMHz?

#4 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand." - Heater's ex-boss

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

Wotan2666 wrote:
but our customer was claiming he could do it with 2Mhz
Then I respectfully suggest he was talking out of his ass.

 

Sure, he might be able " re-work" some devices at 2MHz. So if he'd had a 250kHz programming session during which the fuses set the chip to run at 8MHz+ then later on the same chip could be programmed at 2MHz. But he cannot have been programming "virgin" chips at 2MHz. Even if you tried to force a "fast" (8..20MHz) clock into the XTAL1 pin it would still be ignored on a truly virgin chip that has CKSEL set for "intRC". So the chip will have needed at least one 250kHz session to either change CKSEL or to clear CKDIV8 or both.

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

Guys thank you a lot you helped me to steer my attention the right way it were the fuses our customer forgot us to tell to set them or they did not know that either im not sure, i have asked them yesterday what was the actual problem they had with their devices they were saying they are slow should turn off after 300ms but now they did it in like 5seconds so i put my self 1 + 1 and found out they forgot to tell us we have to set the fuses. Jesus.... would kill them if i could angel so thank all of you guys for reading through my Novel

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

Thanks for the feedback; if the issue's now resolved, see Tip #5.

 

Letting customers program chips never sounds like a Good Idea ...

 

surprise

 

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...