ATMega48 - Programming problem - Page 1
Forum section: electronics / beginners

author: tux75at
author_rank: Newbie
timestamp: November 06, 2017, 08:36:31 pm
content: Hi!I am new to this forum, but was reading a lot and also looking for my problem, but didnt find anything useful.Maybe someone can help me to solve this problem.I made a little board (i etched it myself with soldermask, but these are my first boards, so not best quality but came out very good and should work)It came out pretty good, this little board is the second one, first one was with same chip but different circuit which didnt work also.Because of the problems i made this little board to see if it works without anything else. Purpose of this board was to see if i can program this chip.I made a few attachments, there is a second layer which is ground only with two vias. The 8 MHz crystal is on the bottom side with two 22pF on the left side of the chip.6 Pin ISP header on the bottom right, GND and VCC on the bottom left side of the ISP header. VCC is 5 Volt. (4 IOs which are unused at the moment)I expect Pin 1 to be on the top left where the dot is on the chip. If this is not correct, then of course it wont work.(I produced 4 boards, another one i soldered the chip 180° rotated, same result, so i tested allready another orientation)There might be too much solder on the pins (i was out of smaller solder wire so it was hard to put less there), but i checked it, there are no solder joints and everything looks ok.I used a logic analyser to see if the protocol is working. The pictures are attached also. The 0xAC 0x53 0x00 0x00 to enable programming for ATMega48 are included, just not in the beginning, but later on i see it. At the first or second 0x00 the chip should repeat 0x53 which is not there. Programmer is a version of USBASP and works on a arduino leonardo. ISP connections are same as on the leonardo, but of course different pins as it is also a different package.As far as i know, the 8 MHz are not neccessary at factory fuse settings, but these chips are from china and this could be an issue with fuses, but there is a crystal, so the fuse settings should be ok.Any other reasons why my chip is not responding?Right now i am out of ideas.

author: alank2
author_rank: Super Contributor
timestamp: November 07, 2017, 01:13:35 am
content: As the MISO line is basically grounded and not changing, it would be the first thing I'd look at.Some of the pins look like the solder is bulgy on them. Do you have any flux? A bit of flux would let you even that out quite a bit. You might have a short between pins, that might be worth checking.Good luck!

author: tux75at
author_rank: Newbie
timestamp: November 07, 2017, 04:52:14 am
content: No short between the pins, and i used some flux. Problem is the too big solder wire for this, but i dont have any smaller at home at the moment.But i doulbe check it later.

author: sleemanj
author_rank: Super Contributor
timestamp: November 07, 2017, 06:24:37 am
content: Analyzer trace does not show reset going high - is the 100n cap from reset to gnd shorted maybe.

author: sleemanj
author_rank: Super Contributor
timestamp: November 07, 2017, 06:29:48 am
content: Scratch that, i see the other trace shows it going high.You may want to try slowing down the usbASP's clock rate in case your 48 is running too slow for it due to fuses.It is certainly possinle your chinese-sourced 48 has bad fuses, i once got a load of tiny13s which had thier reset fuse disabled!

author: imidis
author_rank: Frequent Contributor
timestamp: November 07, 2017, 07:31:03 am
content: If you havent set the fuses it's probably shipped to use the internal 8mhz oscillator, you will probably need to change and make sure your icsp is set low enough, I think 16khz or less (going off the top of my head) I can't remember whether it will work properly with an external oscillator hooked up to the oscillator pins, you may have to pull it.If that does not work I would try pulling the capacitor off the reset pin as well.Just my ideas if the pins are ok.

author: tux75at
author_rank: Newbie
timestamp: November 07, 2017, 07:41:14 pm
content: I tried also with slow Jumper active on my programmer and in the beginnen without the cap on the Reset Pin.But the problem with the reset fuse might be worth lokking closer at. I have two boards with the same problem, that would be too much for me for the same random error (short on the same pin, with different layout; cap on reset pin was removed on both; slow programming on both). I real somewhere that it is possible to reset the fuses with 12 Volt circuit. If someone has some links for me ...I will investigate more into this direction and hopefully i can try this on the wecken.Gesendet von meinem E5823 mit Tapatalk

author: sleemanj
author_rank: Super Contributor
timestamp: November 07, 2017, 09:18:16 pm
content: First, buy a 48 (or pin compatible, 88 etc) from a reputable source and try that.For fuse change with reset disabled you need hvpp. Search fusedoctor.

author: alank2
author_rank: Super Contributor
timestamp: November 07, 2017, 09:36:22 pm
content: Are your MISO/MOSI backwards? datasheet shows mosi pin15, miso pin16

author: sleemanj
author_rank: Super Contributor
timestamp: November 07, 2017, 09:57:43 pm
content: Well spotted, definately looks like OP has them swapped.My own Arduino pin numbering diagram for simplicity but shows corrrect positions...

author: tux75at
author_rank: Newbie
timestamp: November 08, 2017, 06:25:40 pm
content: Right, i screwed it up, but only on this board (i tripple checked it and still didnt see it, i think i need some new glasses), the other design is correct and same behavior. I also tried to switch these signals, no answer from the chip.I dont think that the chip is fried, i believe that the MISO pin is driven from the ATMega after the 0xAC 0x53 is received and on the next byte the 0x53 echo comes on MISO.I can use this chip to test the HVPP method and check if it still works.Thanks for finding this error!