ICE - mega328 - breakpoint in ISR not being hit

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

Hi Guys,  hope everyone is well.

 

I just got my shiny new ICE from Mouser.  Atmel and Digi-Key both seem to be out of stock.  I am running one of my old programs in debug mode on a fresh mega328.  The ICE installed the .elf file fine, so that was good, and I can set breakpoints in main() and called C functions in Amel Studio 6.2 and the breakpoints get hit just like they should, and I can step through the code a step at a time and step into and out of functions just like with a real debugger.

 

However, when I put a breakpoint in an ISR and run the debugger the breakpoint becomes disabled in AS, and if I hover over it I get the message:

 

"The breakpoint will not currently be hit.  Unable to set requested breakpoint on target.  The current selected device is unable to set breakpoints during runtime"

 

That seems to me that says  it is the mega328 that wont support the breakpoint, it being the selected device. 

 

I was reading a thread from earlier this month where a fellow was having trouble putting an overflow breakpoint in a counter ISR.   All the smart guys ran his assembly code in emulators and it all worked fine.  He decided it was his install of Atmel Studio and that was the end of the thread. 

 

So my question is:  is this my problem or can I just not do what I want to do on a mega328 with the debugWIRE debugger and my shiny new ICE?

 

Any help would be appreciated.

 

thanks

  

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

CAn you post the ISR code and/pr a screenshot of the ISR with the disabled breakpoint showing?  I have run into this problem as well and I get around it by setting the breakpoint just before where I want to stop and then single stepping through

 

Jim
 

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

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

Hi Jim,

Thanks so much! 

 

I had the breakpoint on the statement:  char byte;  which is the first statement in the ISR.  When I moved it to the { at the start of the ISR it worked fine, and when I moved it to the second statement in the ISR:  byte = UDR0; it also worked fine.  I should know better than putting a breakpoint on definition statement like that.  I think Visual Studio will move it to the first executable statement.  My mistake.  The documentation says something about not putting breakpoints on double word statements, which is something else again.

 

It looks like you have a new avatar.  Is that what being a moderator is like?  Or from dealing with a multitude of dumb questions?  I should probably change mine.  That cat, Lumpy, passed from cancer about a year ago, but I kind of like seeing him whenever I come here.

 

While I have your attention, should I be using optimization O0 with the debugger?  The debug default seems to be O1.  It appears to work with either.  I read somewhere someone suggested O0.  I've also read not to use O0 for release builds or unpredictable things happen, which I think happened to me once.  I always build with Os.  Do you have an opinion on this business?

 

Thanks again for your help.  It is nice to see you again.

 

mark

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

It looks like you have a new avatar. 

Yeah, more like a self portrait.

 

Is that what being a moderator is like?

Nah, Thats what I look like when I am trying to use an ICE to debug a Mega328 with breakpoints in an ISR wink

 

Or from dealing with a multitude of dumb questions?

No way as I ask many a dumb question myself.

While I have your attention, should I be using optimization O0 with the debugger?  The debug default seems to be O1. 

That is a very good question to which I have no idea.  I have never changed optimizations from whatever Studio sets them to(my ignorance) so I am not qualified to say what is the right answer.  Sorry.

 

Thanks again for your help.  It is nice to see you again.

You're welcome.

 

Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

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

OK, thanks.  I guess I will use O1, as that is what Studio set it to. 

 

mark

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

Don't ever use -O0 

 

Atmel default the "Debug" build to -O1 and the "Release" to -Os

 

These are pretty sensible choices though I guess you might change -Os to -O3 sometimes. 

 

-O1 is a pretty sensible choice for debugging, there'll be some register caching and reordering but it should be possible to see how the C and Asm relate. 

 

The very latest GCC tools have a new optimisation level specifically for debugging: -Og but while the 4.8.1 that comes with AS6 supports this,  Atmel have not yet added the option to the selection droplist. Maybe next time? It remains to be seen how -O1 and -Og differ for AVR. 

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

OK, thanks Mr. Clawson.  I guess that is pretty definitive.  NEVER use -O0!

 

Nice to see you again,

mark

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

Hi Mark,  how's the cats? 

 

As for -O0, it's effectively a test mode to allow the compiler developers to see raw code before optimisation has been applied. Normal users should have no reason to ever use it. 

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

Thanks for asking.  As I mentioned earlier, my avatar, Lumpy, died about a year ago from cancer.  We waited a month and got 2 more from the local Animal Control, where I had been volunteering.  One was a female less than a year old named Simone.  She is sort of the perfect cat, except she doesn't like to be picked up and is shy of strangers.  Other than that she obeys all the rules about not getting on the counters or digging in the garbage.  The other one was a 3 year old male named Yves.  We changed his name to Otis.  He is not the perfect cat.  He is a thug and overweight.  He knows how to prevent us from doing whatever it is we are trying to do, like work or sleep, when he wants food.  He gets up on tables and knocks stuff onto the floor, like pens, pads, mice, books, whatever.  If we feed him he turns into a big soft lovebug.  He likes laps.  I had to get giant storage tubs for litter boxes because he aims sideways when he pees.  The two cats like each other and play tag all through the house, so it is generally all good.

 

I quit volunteering as a cat socializer at Animal Care and Control and SPCA.  It ended up making me too sad.  I had to take one of the cats home because he liked to bite people a little too much and ACC was going to kill him.  I found a place for him so it worked out, but that was sort of my last gasp with cats on a wholesale scale.  Now I just deal with the two I have at home, and that seems to be enough.  They are both indoor cats, which is sort of a drag.  I think they would be happier going outside, but it is so dangerous.  The other day I caught a rat in a box at had to bring it to Animal Control.  It had been poisoned by someone and was moving pretty slow.  The poison of choice is Coumadin, the blood thinner, and the rats die from internal bleeding.  If a cat eats one they get poisoned too.  A friend of mine had to make her indoor/outdoor cat indoor only after having to take him to the at ER twice from eating poisoned rodents.  He almost died both times.

 

I've forgotten.  Do you have cats?

 

mark

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

Last Edited: Mon. Apr 27, 2015 - 09:54 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yours are both beautiful.  It's funny how they like cardboard boxes so much.

 

Here is a not very good picture of my two doing what they like the best.  You will notice the little female, Simone, has a pink studded collar on.  Sometimes Otis thinks he is a real man and grabs her by the back of the neck and starts to mount her, but then forgets why he is doing it and they either play fight for a while or Simone runs off.

 

The white box on the left is an RFID feeder I made.  Simone has an RFID tag on her collar and when she gets close to the coil, which is behind the round piece of styrene on the front, the horizontal door slides left and uncovers a bowl of crunchies.  Otis loves crunchies and for almost a year only ate them.  He wouldn't eat wet food.  Several months ago he had problems urinating and it turned out his urine was too concentrated from not drinking enough water with the dry food and he had crystals developing in his bladder, which aggregate into bigger sharp pointy globs that are painful to pass, and can completely block flow and result in death of the animal within 48 hours.  Crystals are nasty.  So we had to put him on a wet food only so he got enough water in his diet.  Wet food is more than 70% water, about the same as a mouse or a bird.  Cats in the wild don't drink much water and get most of their fluid from the animals they eat.  Crystals are more of a problem with male cats because the urethra is much longer and narrower.  Not so much of a problem with female cats, which is why we let Simone have a few crunchies along with wet food.  She prefers wet food, but if the bowls are empty she can walk up to the feeder and it opens to a bowl of crunchies.  Poor Otis watches this process and tries to do the same thing Simone does to make the door open, but it never does.  Poor Otis.  He loves his crunchies.  He looks so bummed when Simone is eating his favorite food, and the door closes in his face before he can get any after she walks away.

 

I tried taking them out for walks on a harness.  Simone doesn't even like to be picked up, although she loves being petted and scratched, and she went berserk when I put the harness on her, so that was a no go.  Otis didn't mind the harness, and we went outside a couple of times, but he wanted to stay close to the door and smell stuff.  Problems started when he saw the neighbor cat, who gets to run around free outside.  After seeing him, he started spraying over the top of his litter box, and I was having to hose down the garage floor every day until I bought some giant storage bins I now use for litter boxes.  He can almost aim over the top, but not quite, so he just sprays on the inside of the bin, which is much better.  Jackson Galaxy pointed out that indoor cats will often start spraying when they see or smell outdoor cats, and he recommends setting up a sprinkler and a motion detector so the water goes on whenever a cat comes around.  That seems a little extreme to me.  I stopped taking him out on the harness.  He didn't seem to enjoy it that much anyway.

 

Instead, we have a deck on the back of our house that I put netting at an angle pointing inward on the railing so they couldn't jump up in the railing and then jump down to the ground one story down.  It has been working, and they have given up trying to bite through the netting or get over it.  I don't like to say this too loud around them, but if they just jumped up and grabbed the netting they could pull it down or climb right up it, but it is sort of loose and floppy and they have decided to give up trying to get out.  They get to be outside and seem to enjoy it, so I think it is worth them seeing the neighbor cat once in a while.  At least Otis cant smell the neighbors spray like he could outside on the harness.  I really wish the harness thing had worked with them, but I hear you have to start them on it when they are kittens and teach them to actually go for walks instead of smelling everything within a 10 meter radius of the door.  There is a person I see periodically in our neighborhood who takes his cat on walks down in the business area with lots of people around, and the cat behaves just like a dog on a leash.  It is pretty cute.  It sounds like yours actually go for walks with you.  That's pretty cool.  When I lived in the country we had a couple outdoor cats that would go with us when we went for walks outside.  It was nice. 

 

We tried growing kitty grass (sweet barley) but they were uninterested.  Simone eats the houseplants, but we had to move a couple of them outside because they were on the list of plants poisonous to cats.  Otis just eats food - lots of it.

 

Take care,

mark 

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

The white box on the left is an RFID feeder I made.  Simone has an RFID tag on her collar and when she gets close to the coil, which is behind the round piece of styrene on the front, the horizontal door slides left and uncovers a bowl of crunchies. 

Wow clever use of technology to benefit the cats! I keep thinking I should develop some kind of cooled/timed feeder to cater for them if we're away for more than a day but the worry would always be that while I could probably get the control system right the actual mechanical bits could go very wrong and we'd end up with starving kitties.

Several months ago he had problems urinating and it turned out his urine was too concentrated from not drinking enough water with the dry food and he had crystals developing in his bladder,

Our last cat, Mac, died of kidney disease. When we read about it afterwards we realised how big a problem dried cat food can be and how vital it is for them to have water. To help him towards the end we got a cat fountain for Mac but that was only once the disease became apparent. For the current cats we've had fountains for them since birth. Biggles is the only one of the tow who eats the dried food but he's also the only one of the two that is happy using the fountain (a lot!) so it kind of balances out. For most of their diet I actually make my own cat food by grinding up chickens in a mincer and when I make it I add a lot of water so it's very "sloppy" and that gives Amelia all the liquid she needs. She has recently taken to drinking from a running cold tap in the bath too though - I don't want to really encourage this though as she can't rely on it when we're not there. They also eat a lot of roasted chicken breasts and, again, that's got quite a high moisture content.

I tried taking them out for walks on a harness.

The harness thing only really works for ours because they were brought up on it and it's all they've ever known. We took them home at 3 months and then for the next 3 months they had to stay indoors until they were (a) fixed and (b) complete courses of vaccinations. So by the time they had got to 6 months they were desparate to get out into the wild world they'd only watched through a window. So putting on the walking jackets and clipping on leads didn't phase them at all and they were raring to go. Now they are so used to it, it's just like owning pet dogs. The trigger word in our house is simply the word "out" (not "walkies" as it might be for a dog). If you just say "anyone want to go OUT?" they go bonkers, run around the house then we all meet at the back door where they patiently wait to have their jackets put on. If we're late calling "out" they let us know about it in the most unmissable terms possible.

I put netting at an angle pointing inward on the railing

We've thought about "cat proofing" our garden like that - the angled net seems to be the standard way. That way they could go outside for more than 1..2 hours a day but at the moment we need to do something about our garden fence (gales ate it!) before we would have a completely secure enclosure.

 

To be honest I think they prefer leads/harnesses/walks as it's more fun with 2 cats and 2 humans out together than just the cats alone.

 

BTW for harnesses/jackets we use something like the ones shown here:

 

http://www.mynwoodcatjackets.co....

 

Not those exactly but something like it from a supplier in Scotland.

 

It's not just a thin collar or not even just a thin collar and a simple strap around the body but a real "jacket" held by velcro that is very wide both around the neck and the upper part of the body. As it "spreads the load" the cats don't seem to mind as they might with a thin collar that dug into the neck or something.

 

Oh and I think it helped that our first foray outside was in about 8 inches of snow - they loved jumping around in the "white stuff" they didn't really understand!

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

I tried a fountain when the crystal problem happened, but neither of them would use it, so I just have a water bowl neither of them seem to use either.  I am thinking I am going to cut back on the amount of dry food I put in the feeder for Simone.  She used to eat very little dry when given the chance, but now I think she likes to use the feeder to drive her brother crazy.  I've noticed she is peeing less than she used to and I am starting to worry about it.  I don't want to damage her kidneys.

 

Do you grind up the guts and bones of the chicken too when you make food?  I think just plain chicken meat is not a balanced diet for them.

 

Quote:
To be honest I think they prefer leads/harnesses/walks as it's more fun with 2 cats and 2 humans out together than just the cats alone.

 

I suspect you are right about that.  It is more fun.  Ours spend more time on the "catio" if we are out there with them.  They still get to hunt a little.  Simone especially.  Yesterday she caught a big fly.  She knocked it out of the air a couple of times and then ran inside with it in her mouth and proceeded to play with it on the floor in the hallway.  By that time it wasn't flying so well, but it was pretty good at lying on its back and buzzing, which was enough to entertain Simone.  I caught it and put it outside.  I didn't want her to eat it, which she would have, because I didn't know if it just got done feasting on some diseased dead thing.  I was pretty impressed that she could catch a fly.  She would be a bird killer for sure if we let her out alone.

 

Our previous cat, Lumpy, went outside by himself.  I made an RFID cat door for him so when he got close to it a stepper motor would pull the door up for him to go out.  (I was into RFID for a while.  I made my own boards from an EM4095 chip and some capacitors, and nice coils I bought from a place in Australia.  It was an interesting project reading the output from the EM4095 with a mega128 and figuring out the Manchester code to read the chip number.  It took me months.)  I think the quality of life is better for a free roaming cat, but it is too dangerous in the city with cars and people poisoning rodents.  Plus they kill a lot of birdies.  I read an estimate that in the US feral and outdoor cats kill 3 billion birds a year.  We were lucky with Lumpy that he stayed out of the street and never got poisoned.  Toward the end of his life he would go out and mark his much reduced territory around the back of our house and then spend the rest of his day indoors.  I had retired, so we spent most of the day together.  We had him 8 years before he decided to become a lap cat, so toward the end he was in my lap much of the day.  He was a great cat.  I miss him still.

 

You used to be able to preview a post to see what it looks like.  Is that no longer an option?  I don't see a button for it in this interface

Last Edited: Mon. Apr 27, 2015 - 06:40 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

never mind.  They wont let me delete.

Last Edited: Mon. Apr 27, 2015 - 08:43 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Sorry for the weird post.  I was trying something and the interface wouldn't let me and I couldn't delete it.

 

Your cats are so beautiful.  Ours are standard American Shorthair.  One black.  One grey.  I wish I had better pictures of them.  My wife has all the pictures.  I'm not much of a photographer.  Black cats are really hard to photograph.  All you get is an outline.

 

 

 

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

 

All these photos are conCATenated

 

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

 

or CATcontented.