Help with connecting the ATMEL AVR Mega128 ATMEGA128 microcontroller to my laptop.

Thread Starter

eagle32

Joined Feb 18, 2011
30
Hello everyone,
I need helps with connecting the microcontroller to my laptop.

I've just ordered an ATMEL AVR Mega128 ATMEGA128 development board and it is on the way to my home. I wanted to connect the development board to my laptop through the usb cable. At the moment i've got a USB to RS232 Serial 9Pin MALE Cable Adapter which i think i can plug in the usb cable to the laptop side and the RS232 male plug into the development board which has the RS232 serial port as well.

The development board i've ordered is this: http://cgi.ebay.com.au/ws/eBayISAPI.dll?ViewItem&item=260692595717&ssPageName=STRK:MEWAX:IT

And the USB to RS232 adapter i've got is this: http://cgi.ebay.com.au/USB-RS232-Se..._Accessories_Wires_Cables&hash=item4aa8856f6e.


So my questions is:

Will this USB to RS232 adapter be able for me to connect, program and debuging to the development board?

Or should i order a USB to JTAG adapter Programmer Debugger?
like this one from ebay: http://cgi.ebay.com.au/ws/eBayISAPI.dll?ViewItem&item=160480909339&ssPageName=STRK:MEWAX:IT


Thanks in advance!
 

eblc1388

Joined Nov 28, 2008
1,542
The usual programming methods for AVR are via ISP, JTAG and high voltage parallel programming. Therefore, without a proper bootloader inside the Mega128, there is no chance that you can program the board via USB<->RS232 converter via one of the board's two serial usarts.

You would definitely need either ISP or JTAG to do the programming.

The USB-JTAG shown in your link looks promising.
 

Thread Starter

eagle32

Joined Feb 18, 2011
30
Alright, i see so if the mega128 doesn't have the bootloader i cannot program the board via the USB<->RS232 converter. But if i use the RS232 cable by itself will it works well on the MEga to the PC or the Mega still required the bootloader?

I'll definitely get a USB-JTAG to do programming. Im looking forward to do it, thanks eblc1388.
 

eblc1388

Joined Nov 28, 2008
1,542
but if i use the RS232 cable by itself will it works well on the MEga to the PC or the Mega still required the bootloader?
The serial port(usart) on the development board itself will only work to transmit/receive data if the programmer(you) write codes for it to do so. It is like any other I/O ports.

It has nothing to do with the bootloader, although the bootloader will make use of the serial port to communicate with the PC.
 

Thread Starter

eagle32

Joined Feb 18, 2011
30
Hi, just an update for this thread.

The USB -JTAG adapter it arrived to my door, so Iive installed the USB driver from the AVR Studio.exe file. Then i

connected the adapter to to the AVR board and to my laptop then there's a window popup indicates "Found New

Hardware Wizard", so i've clicked next to conntinue but the new window came up indicates "cannot find necessary

software".

I have aslo opened AVR Studio 4.18 and go >select>platform:JTAG ICE >Port: Auto>then clicked connect. There's a

window poped up saying: "The OCD JTAG adapter was detected, but there is no target power.Apply power to the

target application or device and click retry. Click cancel to retry other port".

I've tried all the ports from Com1 to Com9 and it still didnt work.
Note that the development board is also connected to the power supply as well

I've also tried connected to the platform JTAGICE mk||and did the same thing but the thing still didnt work.

Please help me with these probs, the LEDS lights up when i connected the Jtag to the board so im sure there's a way

to get it work.
Here's some pictures i've taken to make sure i've done the right step. Please take a look.
Thanks
 

Attachments

eblc1388

Joined Nov 28, 2008
1,542
It appears to me the AVR Studio has detected the USB JTAG but the Jtag does not report back the information of the target board voltage.

The first thing to check is to power up the proto borad, unplug the JTAG cable from the board and measure the pin voltage on the target board. It should shows the same voltage as that of the MCU.

 

Attachments

Thread Starter

eagle32

Joined Feb 18, 2011
30
Hi eblc,
i've checked the voltage on the pin to ground, it is 3.8 volt. Where my variable power supply is putting out 6vdc. Where can i find the voltage of the mcu? Sory im not really good at these technical things. Could you please check for me on the schematic diagram see if anything i can check.
 

Attachments

eblc1388

Joined Nov 28, 2008
1,542
You should get +5V, as the mega128 is powered from +5V on the board via a 7805. There is also a polarity diode at the input side of the 7805 to prevent reverse polarity connection.

Your variable power supply should output +9V or more in order to power the board properly.

In addition, there is a power switch on the board right behind the USB "B" type connector, to the left of the two rows of switches, for powering up the whole board using external supply. You would need to switch it ON.

Do this and measure again. Good luck.
 

Thread Starter

eagle32

Joined Feb 18, 2011
30
I did switched it on with the switch and with the Jtag connected as well. You can see that on the top right corner there's a power port connected this port it says (6-12V). So you think should i increase the voltage of the transformer to 12volt to bost up the voltage drop?
 

eblc1388

Joined Nov 28, 2008
1,542
I did switched it on with the switch and with the Jtag connected as well. You can see that on the top right corner there's a power port connected this port it says (6-12V). So you think should i increase the voltage of the transformer to 12volt to bost up the voltage drop?
Yes, go ahead. The on board 7805 will regulate the voltage down to +5V, without any problem.

You should get +5V, or else there is some problem with the board.

If the onboard LEDs only come on when you plug in the JTAG cable connector, then something is not quite right. You are powering the board via the power from the JTAG instead of the 7805 regulator on board.
 

Thread Starter

eagle32

Joined Feb 18, 2011
30
Ok, i've got the good news is when in injcreased the power supply to 12v, the pin on the jtag port now is exactly 5v.
But as you've mentioned about the jtag when i pluged into the board, the leds came on. So this means... i might damaged the board somehow? From what i know, before i got the jtag adapter, i used the usb cable to power up the board and the 3 leds came on the the 7segments display came on and it is inscrementing the numbers.

Do you think there's something wrong or it just how it is?
 

eblc1388

Joined Nov 28, 2008
1,542
What happens if you power the board from USB, without 12V external power and no JTAG connection?

If the board works the same as before, then its good.

I don't know why the LEDs come on as they are connected to PORTC and is not related to JTAG port.
 

Thread Starter

eagle32

Joined Feb 18, 2011
30
If i power the board from the usb without jtag and external power supply. It is 4.3 v on that pin. And yes the board works same as when i bought it before that jtag came in.

I think maybe the board has been programed before i bought it. I've contacted the seller about the jtag usb driver and he has sent me some files to install but the files it did not work, i could not open it on both my pc and laptop. Im just wondering if there's a driver i can install it on the pc before it can communicate with the AVR?
btw do you know which platform should i choose because there's a JTAG ICE and a JTAGICE mk||.
 

eblc1388

Joined Nov 28, 2008
1,542
If i power the board from the usb without jtag and external power supply. It is 4.3 v on that pin. And yes the board works same as when i bought it before that jtag came in.
The board is OK then. 4.3V sounds reasonable when powered from the USB.

I think maybe the board has been programed before i bought it.
If the 7-segment LEDs showing numbers and counting up, sure you have program code inside the M128.

I've contacted the seller about the jtag usb driver and he has sent me some files to install but the files it did not work, i could not open it on both my pc and laptop. Im just wondering if there's a driver i can install it on the pc before it can communicate with the AVR?
btw do you know which platform should i choose because there's a JTAG ICE and a JTAGICE mk||.
These are the questions that only the seller can answer. Remember what you have bought is a clone that are supposed to disguise itself to the AVR studio as the geniune device.

In some cases it works immediately but in other cases drivers installation is needed.

Keep pressing the seller for answers and procedures/instructions on how to get the JTAG clone working in AVR Studio. They should have at least some information on how to achieve that like what options to select in AVRStudio.

Now you are getting +5V from the pin on the proto board, what does AVR Studio displays if you try to connect to the JTAG via the AVR Studio menu?
 

Thread Starter

eagle32

Joined Feb 18, 2011
30
Oh now i see, so there's clone versions for the JTAG as well, i've contacted the seller and he show me to download the driver PL2303 for here: http://www.prolific.com.tw/eng/downloads.asp?id=31

I've installed it and when i plug in the Jtag, there's a little window pop up on the bottom right of the screen indicates that 'The hardware is installed and is ready to use'. Which is a good indication, then when i open up the AVR studio and try to connect to the board, i just dont know which Platform on the connection menu is the right one to choose, so i checked on both of them.
The Platform JTAG ICE>PORT: Auto. The studio still display same message as shown on the picture. It displays: 'The OCD JTAG adapter was detected, but there is no target power.Apply power to the target application or device and click retry. Click cancel to retry other port'.


Now im just not sure if the driver is doing anything or maybe i just gota try the other platforms, but i've tried both of them already.
 

eblc1388

Joined Nov 28, 2008
1,542
'The OCD JTAG adapter was detected, but there is no target power.Apply power to the target application or device and click retry. Click cancel to retry other port'.
Open the "Device Manager" on your PC and looks into the USB controller sections. The name of the JTAG device will be listed.

If the pin on the board has +5V and you still getting this message in AVR Studio, then the JTAG could be faulty, or the connecting cable be faulty.

Detach the cable from JTAG unit and board. Measure the continuity of all the cable wires from end to end. You can plug in paper clips or small size wire at the holes on each end and then check with your meter.

If the continuity is good, then you should let the seller know of the problem and ask for a replacement, or refer him to this thread.
 

Thread Starter

eagle32

Joined Feb 18, 2011
30
Thanks for the great tips, i've learned alots from you today.

Yup i've opened up device manager but could not find any jtag device, but i've just updated the drive the one that is in

high lighted. But could you pls confirm for me that i am correct on by looking at the photo.

I've check the continuity of the cables and those pins in each hole, they're all fine.

I've contacted the seller and he said he'll find new driver for me tomorow if i cannot solve. So i'll wait until tomorow

and lets see.

Thanks
 

Attachments

eblc1388

Joined Nov 28, 2008
1,542
The USB driver can be seen working in the image you have posted above and is emulating a serial port to communicate with the JTAG MCU inside the unit via the serial interface. So AVR Studio can now connect to this JTAG using serial port. In your case, the port number is COM4.

I then took out my JTAG(serial port interface) and connected it to one of my boards. I left the board un-powered to see what happens.

When I connect to JTAG, I got the same error message as you have got previously. See below.






I then power up my board and press "Retry". I then I have connection. Hope this helps.

 

Attachments

Thread Starter

eagle32

Joined Feb 18, 2011
30
I've tried all those steps but it didnt work.

I notice that the Baud Rate on the AVR is set at 115200, i then go to computer management> USB-Serial Comm Port>right click and choose properties>Port settings, the Bits per second display 9600. I then changed it to 115200 and click ok, restart my comp, open up AVr , choose com port 4, keep baudrate at 115200, clicked connect.

But still the same error massage came up.
Yeah i notice that when i unplug the Jtag from my laptop and plug it in another usb port, in Computer managment window it refresh itself, it then shown Comm Port(COM5). So that means the computer is recognized something changes.
I repeated the whole steps again on that port but still same error message came up.
Pls take a look at the pic
 

Attachments

eblc1388

Joined Nov 28, 2008
1,542
You would need to contact the seller who sold you the proto board for answer of the following question:

I cannot connect to the board via JTAG. Is the JTAG configuration fuse inside the M128 enabled when the board is delivered?

Although the JTAG unit can program an AVR, the requirement is that the JTAG configuration fuse in the M128 be enabled. Atmel ships the chip with JTAG fuse enabled but it can become disabled when the board came to you. You should confirm this with the seller.

This bring us to the question of reading the fuse and programming the M128. The Jtag can do all that, provided the Jtag fuse has been enabled and it can connect to the chip. If the JTAG fuse is disabled, then you cannot connect to the AVR to do anything.

AVR Studio might intrepret this situation as "no target voltage error" or it maybe not. I don't know.

You would need just another tool, like every other AVR hobbyist, the AVRISP to program the AVR, almost any AVR. It is much simplier that a Jtag but it cannot do debugging. Besides downloading the program code to the AVR, AVRISP can also read and set all fuses inside the AVR chip, including the Jtag fuse. See if you can buy one from the seller. It should come with USB connection, just like the JTAG unit.
 
Top