My STK500 isnt connecting all of a sudden.?

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

:cry:

Hi. I got a reallt nice STK500 board about 2 weeks ago. I have been learning AVR programming and enjoying it thoroughly. I am using AVR studio 4.18 with winAVR installed. Everything so far has been a success. I have been successfully following the Newbiehack tutorials using an ATmega16 to do the work. All tutorials have ben programmed and have worked. Tonight I was enjoying the 2nd tutorial on ADC when my board decided to stop connecting to the computer. When I click on the connect icon or the programmer icon, the board doesn't connect and avr studio goes back to the connect dialogue. Could someone help me in this matter?
I have been doing everything correctly, I am running the board on 15V from a breadboard prototyping device. When I power up the board, the last program still runs but the stk500 doesnt connect to the computer.. :(
I am distraught at this moment in time...it was all going so well.
Any help would be much appreciated.
Thanks,
Steve.
:(

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

Quote:
I am running the board on 15V from a breadboard prototyping device.
That may get the regulator pretty HOT, even if regulated, worse if not.

Have you accidentally moved the RS232 lead to the com port instead of the control port?
Is the com port used anavailable maybe taken up by something else like a terminal program?

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

Surely, 15V is almost too high. Check the name of linear regulator mounted on your STK500, find the datasheet, and check whether the regulator could be supplied with 15V?
Also, if you doesn't have a real serial port in your PC, so you're using USB-RS232 converter. In this case check the drivers for that one.
I faced to situation when such converter doesn't work properly until I unplug it and, then, plug it back into USB.

Good luck!

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

Hi guys and thanks for the input to my panicked response. I had an idea last night that it might be the ATMega16 chip. Is it possible that the chip was stopping the connection between the STK and the computer? Maybe due to a clock frequency mismatch or something? The tutorial I was following was using an ATmega32 and I was using an ATmega16 thinking that as the pinouts are the same it must be OK. ?

( 10 REM I am a noob.)

I tried plugging and unplugging the USB to serial several times, even turning off the computer.
Anyhow, I thought I'd try taking the ATmega16 out of its socket and connecting another chip (namely the 8515 I recieved with the board.)
The STK connects fine and reads the 8515 with no trouble so it must be the chip no??

Also I've got another power supply for the board. Now you say it the board was getting warm at 15V. I've connected STK up to another breadboard prototyping device:
K&H ETS 5000 Digital Training System. (The UNI doesn't use them any more so I ve got 2 on permanent loan :)
These have variable voltage supplies so I've adjusted for just under 12V (11.88 to be precise)

So could it be the ATMega16 chip?

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

It is unlikely to be the mega16 chip.

Did you have the mega16 in the correct socket? SCKT3100A3

If it was a duff chip, buy a mega324PA or mega1284P. They use the same SCKT3100A3 socket, and have more features.

IMHO, the 8515 is pretty useless as a chip unless you need external RAM.

David.

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

Quote:

Anyhow, I thought I'd try taking the ATmega16 out of its socket and connecting another chip (namely the 8515 I recieved with the board.)
The STK connects fine and reads the 8515 with no trouble so it must be the chip no??

You do know that the ATmega16 and the 8515 go into different sockets on the STK-500, yes?

The ATmega16 goes into the "A" socket while the 8515 goes into the "D" socket.

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

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

Yes yes and yes. The 8515 fits in the SCKT3000D3 socket & the ATmega16 fits in the sckt3100a3 socket. Now something strange. About half an hour ago I re plugged the Atmega16 back into the board ( yes ), tried connecting again and no luck. Then, on a whim, tried connecting whilst holding down the RESET button on the STK500. To my delight, it connected. So then I thought, Hmm if it connects, maybe it will erase too. So I tried erasing it whilst pressing the reset button. The ATMEGA 16 I thought was a burnout is now functioning correctly from what I can see. I have tested it by typing the lights and buttons .asm file into AVRstudio 4 and burning it using the m16 include file. All works fine. :)
So what happened?

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

Any physical damages on the STK-500? The RESET signal is vital to programming. If it does not reach the AVR device in the socket then programming will fail.

Just thinking out loud now. To determine of this is a valid hypothesis, and perhaps ideas on where to look, requires studying of the STK-500 schematics.

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

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

Steve_Scutt wrote:
So what happened?

What a mystique! Do you have another ATmega16? I suppose no.
You could check the RESET signal in the socket on power up using oscilloscope. Try two different cases: switch STK500 on while 'reset' button is pressed, and switch STK500 on while 'reset' button is released.

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

is there anything else connected to the SPI lines of the mega16? if yes then these components might have interfered with programming and thus give a fail.

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

The Code that sparked the problem is:

#include 
#include 
#include 
#include "MRLCD.h"


char adcResult [4];

int main (void)
{
	InitializeMRLcd();
	Send_A_Command (0x0c); // command to LCD to turn crappy cursor off. :)



	// FIND A PRESCALER BETWEEN 5 & 20, THIS IS FOR THE adc CLOCK PRESCALER.
	// IT IS DONE BY DIVIDING CLOCK FREQUENCY BETWEEN mcU CHIPS CLOCK AND CHIPS ADC SOURCE MIN & MAX.
	ADCSRA |= 1<< ADPS2;
	ADMUX  |= 1<< ADLAR;
	ADMUX  |= 1<< REFS0;
	ADCSRA |= 1<< ADIE;
	ADCSRA |= 1<< ADEN;
	
	sei();

	ADCSRA |= 1<< ADSC;
	
	
	while(1)
	{
	}
}
	ISR (ADC_vect)
	{

	uint8_t theLow= ADCL;
	uint16_t tenBitValue = ADCH << 2 | theLow >> 6;
	
	itoa (tenBitValue, adcResult, 10);
	GOTOMrLCDsLocation (0,1);
	Send_A_String (adcResult);
	Send_A_String (" ");

	ADCSRA |= 1<<  ADSC;
}

$ fixed code tags - JS $

The LCD data lines were connected to PORTB (8 bit mode ), the RS RW and EN pins were accomodated by PORTD and PORTA pin1 the ADC.

PORTB is the MEGA16s SPI port and I was having to disconnect the portB 10 pin connector from the board with every upload but I checked all this. I'll try an oscilloscope check!
First I'll have to clear the massive pile of crap off my worktable to make room.
Cheers,
Steve.

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

if you ant to use 10bit ADC, why then use ADLAR=1?
why not use adlar = 0 and then do a rad of ADC then all the shifting as such is done neatly by the compiler and you dont have to worry about it.

Also you do multiple writes to the ADMUX and ADSRA register, you can all combine those in 2 statements.

You also do not know how other bits in those registers are set when you start, so perhaps start with a writing and not an orring of the register.

last but not least, I think you are stuck way to long inside the interrupt routine. updating a display inside an ISR is a bad thing to do, try to move the display part outside the ISR. Your system may have crashed because of a massive stack overflow....

and I see that you used the code button once, not twice, so please edit your post and correct that, then the code will display nice formatted.

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

I will go over the code again.
Remember . I am a beginner :]. I was following the "NewbieHack" series of videos which are really good. I see how I could combine the ADMUX and ADSRA into a couple of lines.I'll go back and review the code and maybe find a more "in depth" tutorial.
Cheers for now.
Steve.

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

Thanks for fixing the code. I'll know next time.
I've rechecked the code. What is the difference between the left and right justification? I can see in the datasheet that it affects the placement of the last two bits but that's all I see. Also, I noticed the SPIEN tick in my fuses box has a red question mark in it (see picture.)

Could someone tell me what this means i.e. is it bad?
Also I tried writing another program provided by a tutorial on ADC. The program demonstrates turning on an LED with a pot once the pots value hits 512 (half the max value.) After uploading, the program worked but the same problem appeared with the board not being detectable unless the reset button was pressed. Could it be anything to do with the SPIEN being questionmarked?

Attachment(s): 

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

Quote:

What is the difference between the left and right justification? I can see in the datasheet that it affects the placement of the last two bits but that's all I see.

No.

With left justification the ten-bit value occupies all of the high byte and the two most significant bits of the low byte. (If you only want eight bits of resolution you can thus bother to only read the high byte).

With right justification the ten-bit value occupies the two least significant bits of the high byte and all eight bits of the low byte. If you want the ten-bit value in a 16-bit integer then you can get that easily with this setup. Some (all?) compilers support reading the two byte registers as one 16-bit register in one go. E.g. In avr-gcc you can do

int theValue = ADC;

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

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

Quote:

What is the difference between the left and right justification? I can see in the datasheet that it affects the placement of the last two bits but that's all I see.

Didja look at the pictures?
Quote:
24.9.3 ADCL and ADCH – The ADC Data Register

...which is where you are sent in the description of the ADLAR bit:
Quote:
• Bit 5 – ADLAR: ADC Left Adjust Result
The ADLAR bit affects the presentation of the ADC conversion result in the ADC Data Register.
Write one to ADLAR to left adjust the result. Otherwise, the result is right adjusted. Changing the ADLAR bit will affect the ADC Data Register immediately, regardless of any ongoing conversions. For a complete description of this bit, see ”ADCL and ADCH – The ADC Data Register” on page 267.

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

OK peeps.

Quote:
When ADCL is read, the ADC Data Register is not updated until ADCH is read. Consequently, if
the result is left adjusted and no more than 8-bit precision is required, it is sufficient to read
ADCH. Otherwise, ADCL must be read first, then ADCH.

So if I only need 8 bit precision I use ADLAR=0, otherwise for 9 10 or 11 bit I use ADLAR=1..

Richtig?

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

Quote:

Richtig?

Wrong. The other way around. (What does "ADLAR" stand for?) What does it give as the definition for ADLAR in the piece I quoted from the datasheet?

BTW, how are you going to get 11 bits out of a 10-bit ADC?

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

When you say that you run from 15V does that mean DC?
The problem is that the power connector go thru a bridge, so 0V on AVR != 0V om PSU, that will sometimes give problems, depending on how the rest is hooked up.

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

Oh,Now I see it, the other way around.

Thank you.
Of course it only goes up to 10Bit also, I should know that. :oops:

Maybe i'll blame it on brain fatigue,sneak off, eat something and come back later. :S

Cheers for now,

Steven.
37.

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

Quote:
the SPIEN tick in my fuses box has a red question mark in it (see picture.)
That's normal. You cannot turn off SPIEN with ISP but only with JTAG or HVPP.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

sparrow2 wrote:
When you say that you run from 15V does that mean DC?
The problem is that the power connector go thru a bridge, so 0V on AVR != 0V om PSU, that will sometimes give problems, depending on how the rest is hooked up.

Here's a picture of the current power supply setup.
Its just under 12V (11.88V) and a good power supply on a very nice Breadboarding Digital Trainer.

Attachment(s): 

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

the problem is not how good the power is or not.
it's how the GND of bread board, stk500 and PC (thru rs232) is connected.
sorry can't see that from the picture.

But is the GND of the 11.98V connected to other things than the stk500 ?

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

Basically, the white wire connects to the +Vdd and the yellow to GND. Nothing else is connected to power. Theres a mish mash of components below but they are from an LFO circuit I was building a while ago...