ATMEGA164P Help! Beginner!

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

Hi everyone. I need to know if there's any way that I can develop an ATMEGA164p processor. It is currently on a product with a small board with a USB interface. However, I'm not sure how to be able to connect/read any of the code from the chip at all.

Is there a way I can read/program it on the board it is currently on now or do I need to remove the chip and put it on some sort of special development board? If I need a development board then what kind should I get? Thanks!

Oh and by the way I believe the package type is a 44-TQFP. Thanks everyone!

(I can add pictures of the board if needed)

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

Without seeing it it's not possible to say.
If the ICSP pins/connector are accessible you're golden (assuming the chips not locked).

--greg
Still learning, don't shout at me, educate me.
Starting the fire is easy; the hardest part is learning how to keep the flame!

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

Alright well I'll take a picture of the board in a bit so you can see. I don't think there are any ISP connections on the board.... Maybe it can be programmed via USB and I just don't know what software to use yet?

There are 6 holes aligned side by side labeled "JP3." Any idea what that means?

Last Edited: Sun. Feb 20, 2011 - 07:09 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Get an ohmmeter and ring from each pin on the 6 pin header to the avr. Compare you list to the avr datasheet... if you have a vcc, a gnd, a reset, a sck, a miso and a mosi, you have an ISP connector.

Imagecraft compiler user

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

Read the schematic of your board.

J3 just stands for jack (connector) 3, and is just a board-specific reference, not having a general meaning, other than it being intended for a connector. The schematic gives its meaning.

And by the way, ICSP is fscking Arduino slang (they didn't even get the Atmel abbreviation right and used PIC terminology ...). ISP is the correct Atmel term. You will find it in the datasheet. Compare the datasheet and your board schematic.

Stealing Proteus doesn't make you an engineer.

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

Ok here are the pics of both sides of the board.

(Bigger photos if needed)

http://img.photobucket.com/album...

http://img.photobucket.com/album...

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

Looks like a Sensolutions ISO9141 OBD adapter for VAGcom. You have a TDI VW? The answer to all your problems can be found here: http://www.mcnallyelectronics.co.... Regular readers kindly forgive this blatant self serving ad. Times are hard.

Imagecraft compiler user

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

No, I have a BMW. It's a Bavarian Technic diagnostic cable that can be found here:

http://www.bavariantechnic.com/b...

The ATMEGA164p has a builtin EEPROM. I'm just trying to figure out how to reset/erase the EEPROM since the cable stores VIN numbers and limits you to only 3 VIN numbers. Other cables have a 1 VIN number limitation. I just need to figure out how to access that EEPROM memory and clear it.

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

Do that ohm from the connector to the avr test and report the results. If its a regular ISP connector, you should be able to read and write fuses, flash and eeprom. If the lock bits are set, on flash and not on eeprom, you might be able to clear the eeprom.

Imagecraft compiler user

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

Bob,

Sorry but I'm a true beginner at this programming/AVR stuff. In my line of work the furthest I really get with ICs is copying them and reprogramming them using a universal programmer. So what exactly do you mean by doing the ohm from the connector to the AVR test? What connecte are you speaking of exactly?

Thanks for your help by the way!

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

DL the mega164 datasheet from atmel.com. Set your meter to beep/ohms. Put a probe on pin1 of j3. Touch every pin on the avr. Write down which one beeps. Look up the name of that pin. Repeat above another 5 times. If j3 has miso, mosi, sck, and reset, it is an ISP connector. You can buy an ISP programmer from Atmel for $30. Do you have a boost/egt gauge in your beemer? Take a look at those Mcnally gauges....

Imagecraft compiler user

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

Quote:
And by the way, ICSP is fscking Arduino slang
What!?!?!?!?
Slang? It's an abbreviation, that I for one use! Because I can't be bothered to spell out In Circuit Serial Programming. At work I do ' Write with an Editor and Compile with a Compiler then Package with an Installer', but I stay away from WECCPI because no fsker would know what I was talking about!

I'm tempted to say...
And besides, have you ever tried In System Programming using JTAG over the ICSP interface?
But I'm on shaky ground here because I'm out of my depth, not having used JTAG yet!

And in case we've not cleared this up, on off-topic, yet, Arduino is AVR!

--greg
Still learning, don't shout at me, educate me.
Starting the fire is easy; the hardest part is learning how to keep the flame!

Last Edited: Sun. Feb 20, 2011 - 09:18 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'd like to see an AVR Glossary sticky.... I'll start
ISP In-circuit Serial Programming (Atmel Terminology) 6 pin OR 10 pin header
ICSP In Circuit Serial Programming (Microchip terminology)
JTAG Joint Test Action Group 10 pin header for programming and debug
OCD On Chip Debug
PWM Pulse Width Modulation
IDE Integrated Development Environment (also integrated drive electronics)
etc

Imagecraft compiler user

Last Edited: Sun. Feb 20, 2011 - 10:08 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
I'd like to see an AVR Glossary
Childish... but I like it! It's Sunday night! (Perhaps we should move over to OT rather than thread hijack?)

Oh, and Bob...

JTAG: Joint Test Action Group (JTAG) is the common name for what was later standarized as the IEEE 1149.1 Standard Test Access Port and Boundary-Scan Architecture.

--greg
Still learning, don't shout at me, educate me.
Starting the fire is easy; the hardest part is learning how to keep the flame!

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

The Kids in Bristol are Sharp As A Pistol when they do the Bristol Stomp.

Imagecraft compiler user

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

God, you must be bored tonight Bob! :) :) :)
BTW: My web site is very out of date. I've now finished the .NET to *ix integration using a stand alone SOAP server on the *ix side (with 'c' interfaces to C-ISAM) and completed the message handler from SQL2005 to handle it all :)

*stamps foot*

--greg
Still learning, don't shout at me, educate me.
Starting the fire is easy; the hardest part is learning how to keep the flame!

Last Edited: Sun. Feb 20, 2011 - 09:30 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Perhaps the OP can explain further how this thread is not about hacking a commercial product to by-pass its designed parameters. From what I've read above, it would seem that if you want to interface to multiple vehicles then you purchase multiple devices, (or possible purchase a "universal" interface).

JC

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

Greg... Its still daylight. Watching the Daytona 500 live on TV.

Imagecraft compiler user

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

Quote:

OCD On Chip Debug

OCD Obsessive-Compulsive Disorder

Bob--if newbies don't seem to read anything else, what makes you think they are going to keep the glossary handy.

BTW, might as well add every common I/O bit name? (e.g. "ADEN").

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

gregsmithcts wrote:
Quote:
And by the way, ICSP is fscking Arduino slang
What!?!?!?!?
Slang?
Yep. Context matters.

By the way, I am no longer supposed to call it baby-talk, but if you prefere that: ICSP is Microchip terminology and Arduino baby-talk. There you have it.

Stealing Proteus doesn't make you an engineer.

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

bobgardner wrote:
DL the mega164 datasheet from atmel.com. Set your meter to beep/ohms. Put a probe on pin1 of j3. Touch every pin on the avr. Write down which one beeps. Look up the name of that pin. Repeat above another 5 times. If j3 has miso, mosi, sck, and reset, it is an ISP connector. You can buy an ISP programmer from Atmel for $30. Do you have a boost/egt gauge in your beemer? Take a look at those Mcnally gauges....

Alright I'll check it out but if I'm not wrong, isn't the 6-pin ISP connector setup in a 3x2 arrangement? As you can see in the pictures, the JP3 area has 6 pinholes side by side. If it is indeed an ISP programmable board then I guess I would have to wire the connectors separately from the pinholes to the connector then correct?

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

I'll betcha a beer that pin1 on the ISP is pin1 on J3. I'll build you a 6x1 to 3x2 adapter. How much is it worth to ya?

Imagecraft compiler user

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

Bob,

Alright so I just traced the 6 pinholes. I'm guessing it's a JTAG... Here are the atmega164p pin descriptions for the corresponding pinholes:

-AVCC
-PC5
-PC4
-PC3
-PC2
-Ground

So I guess I would need some sort of JTAG programmer now?

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

Quote:
How much is it worth to ya?
Not very much! As Bob is intimating here, the layout of the pins is 'unimportant'. It's the signal that they carry that is. Indeed, the 'standards' are 3x2 = 6 and 5x2 = 10. But 1x6 still equals 6 :)

--greg
Still learning, don't shout at me, educate me.
Starting the fire is easy; the hardest part is learning how to keep the flame!

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

SaMirakle...

Would you like us to look up the signals that are carried by those port pins from the datasheet for you, or, are you happy to translate them yourself?

--greg
Still learning, don't shout at me, educate me.
Starting the fire is easy; the hardest part is learning how to keep the flame!

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

I had to look at the datasheet myself. An Atmel Dragon should work... it does JTAG programming. $50

Imagecraft compiler user

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

Greg...

Well I'm looking at the datasheet right now. I can only assume those pinholes are for a JTAG =/

What do I do from here?

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

Quote:
What do I do from here?
What Bob said :) Assuming you and he both agree that those pins are indeed those needed for JTAG! I've not looked at the datasheet, and have no intention to either ;)

--greg
Still learning, don't shout at me, educate me.
Starting the fire is easy; the hardest part is learning how to keep the flame!

Last Edited: Sun. Feb 20, 2011 - 10:54 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Oops sorry, didn't see Bob's post :)

Alright Atmel Dragon... hmm

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

I should be able to program the atmega164p while it's on it's current board or do I need to desolder it from the cable?

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

That depends. Try it first. To be more specific... If 'other' signals are 'driving' those lines whilst power is applied, you would need to do some 'jiggery-pokerry' to make it work.

Quote:
Atmel Dragon... hmm
Well worth the money!

--greg
Still learning, don't shout at me, educate me.
Starting the fire is easy; the hardest part is learning how to keep the flame!

Last Edited: Sun. Feb 20, 2011 - 11:42 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Alright I'll order one today :) Oh and what software do I use for the Dragon?

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

AVRstudio from Atmel

Imagecraft compiler user

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

Or Avrdude from 'Open Source' I mean the GNU AVR toolchain of course.

And finally, welcome to many sleepless nights of 'Why doesn't it work?' Heh ;)

--greg
Still learning, don't shout at me, educate me.
Starting the fire is easy; the hardest part is learning how to keep the flame!

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

Hehe. Thanks a bunch guys! I'll keep you posted if I have anymore troubles. I ordered the AVR Dragon from a local company. Should be getting it hopefully on Tuesday :) Hurray!

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

The DRAGON (roar) should be coming in the mail today. I'm going to try to connect to the atmega164p on the diagnostic cable sometime in the afternoon. I'll let you guys know if I have any issues :)

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

Please READ the manual before you plug it in :)

--greg
Still learning, don't shout at me, educate me.
Starting the fire is easy; the hardest part is learning how to keep the flame!

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

The AVR Dragon manual? I'm looking through it right now. I see where all the pins are except the VCC (voltage). It says "The target needs to be powered through a
dedicated powersupply. (or by powering it using the VCC connector (5.0V max 300mA)"

So I guess that means I should keep it plugged into the USB port then for power?

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

SaMirakle wrote:
So I guess that means I should keep it plugged into the USB port then for power?

You're catching on quick :)

you can review a few tutorials on how to use a dragon. the google machine works good for finding those things. not to be confused with the goggle machine- but who knows what that is...

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

Haha I got it :) Well. I'm about to give this a shot. I have all 6 of the wires hooked up. I'm sure I have all of the wires connected right but the voltage and ground are what I'm worried about.

Here goes nothing :)

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

Quote:
Here goes nothing
Well, actually it's about 50 quid if you get it badly wrong :)

Just to be very clear...

Computer==>USB==>Dragon==>ISP/JTAG==>Target Board.

You CAN power the target board from the VCC connector on the Dragon along with a GND pin. OR power the target separately but NOT both at the same time.

--greg
Still learning, don't shout at me, educate me.
Starting the fire is easy; the hardest part is learning how to keep the flame!

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

Alright so now it seems like I'm having issues connecting it to AVR Studio =/

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

gregsmithcts wrote:
Quote:
Here goes nothing
Well, actually it's about 50 quid if you get it badly wrong :)

Just to be very clear...

Computer==>USB==>Dragon==>ISP/JTAG==>Target Board.

You CAN power the target board from the VCC connector on the Dragon along with a GND pin. OR power the target separately but NOT both at the same time.

Greg,

Ok right now I have the 4 main wires connected to the target board. I disconnected the power and ground because those are confusing me. I have 6 pins on the target board (for JTAG) and on the Dragon I have the 10-pin JTAG interface and directly next to that I have the "VCC/GND" connector.

I also have the target board's USB cable unplugged. How do I go about powering this correctly? Do I need to connect power from the JTAG pins or the VCC/GND pins (on the Dragon)?

Thanks!

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

Nevermind! Got it working :) Now time to figure out how to access the EEPROM, etc. Thanks for all your help Greg!

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

Question:

Alright so I've successfully connected to my target atmega164p. However, AVR Studio only allowed me to read the EEPROM and Flash memory. Is there any way I can decode the information on the entire chip into some sort of programmable code (e.g., C or C++) so that I can make changes?

I've searched the flash and EEPROM hex files with no luck in finding any traces of the VIN number being stored on there (searched in the ASCII coding).

Any help is greatly appreciated :) Thanks!

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

SaMirakle wrote:
Is there any way I can decode the information on the entire chip into some sort of programmable code (e.g., C or C++) so that I can make changes?
The answer to that is pretty much no way.

SaMirakle wrote:
I've searched the flash and EEPROM hex files with no luck in finding any traces of the VIN number being stored on there (searched in the ASCII coding
Do you think that the designers of this thing you're trying to crack would put the VIN numbers in plain text in the memory so any Tom, Dick or Harry could come along to a forum, ask some questions, hook into the chip and find/change them?

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

If I can refer you back to your first post...

Quote:
I need to know if there's any way that I can develop an ATMEGA164p processor.

You now have the tools to be able to do this. i.e. develop your own code.
If your intention was to reverse engineer the entire board in order to make 'minor' adjustments to it's security settings or disassemble it's program for 'other' reasons, then we would have probably said, 'Not very likely!'
But in order to 'run' your own programs on the AVR, you should be able to erase the entire chip now, and reload it with your own software.
I'm sorry if I misunderstood what you actually wanted to do.

--greg
Still learning, don't shout at me, educate me.
Starting the fire is easy; the hardest part is learning how to keep the flame!

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

MartinM57 wrote:
SaMirakle wrote:
Is there any way I can decode the information on the entire chip into some sort of programmable code (e.g., C or C++) so that I can make changes?
The answer to that is pretty much no way.

SaMirakle wrote:
I've searched the flash and EEPROM hex files with no luck in finding any traces of the VIN number being stored on there (searched in the ASCII coding
Do you think that the designers of this thing you're trying to crack would put the VIN numbers in plain text in the memory so any Tom, Dick or Harry could come along to a forum, ask some questions, hook into the chip and find/change them?

Yes :)

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

gregsmithcts wrote:
If I can refer you back to your first post...
Quote:
I need to know if there's any way that I can develop an ATMEGA164p processor.

You now have the tools to be able to do this. i.e. develop your own code.
If your intention was to reverse engineer the entire board in order to make 'minor' adjustments to it's security settings or disassemble it's program for 'other' reasons, then we would have probably said, 'Not very likely!'
But in order to 'run' your own programs on the AVR, you should be able to erase the entire chip now, and reload it with your own software.
I'm sorry if I misunderstood what you actually wanted to do.

That's okay :) I guess I'll just have to go about the copying and pasting the chip route then.

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

...but if the lock bits are set on the processor, anything you read from flash memory will be gibberish. Copy that to another processor (if that's what you mean by copy/paste) then it will not work at all.

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

Just to note that you'll know whether it was locked or not if the .hex file contains 00 00 01 01 02 02 03 03 etc.

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

Hmm. I'll take another look at the .hex files again tommorrow. I'll post an update tomorrow afternoon.

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

new here too... i have the AVR Dragon in front of me and would like to learn how to do the same thing to the BT cable!
how are you making out?

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

It looks like the 7 pin connector shown in the board photo does not have the pins soldered.

I'll believe corporations
are people when Texas executes one.