atmel studio GCC debugging erro

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

I am using atmel studio 6. Built in debugger is using avr simulator. I am trying to use the usart communication of atmega16 with pc. But when I run the code using 12MHz external crystal frequency in proteus and observing the output of using virtual terminal; it is sending only garbage values and proteus showing rx-frame error. When I try to debug the code in atmel studio it shows all defined variables as undefined variables. Also it shows an error that is syntax error: parsing stopped at #define. Does any body know the solution of this problem. I also attached the picture of debugging erro. Plz kindly share ur thoughts.

Attachment(s): 

This topic has a solution.
Last Edited: Wed. Nov 1, 2017 - 07:11 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Maybe the variables are local variables in other function(s)? Show us the code.

The error message for #define is correct - you can only watch expressions in the watch window and #define is not an expression.

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

Also, if interrupts are involved, make sure that variables shared between the interrupt and code space outside of the interrupt are declared as volatile.

 

Jim

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

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

Thanks ka7ehkMarekJ71. I don't know how to share variables between interrupts or little bit know but couldn't grasp the point. Plz can you elaborate. It is simple code for serial transmission; I attached it below, kindly have a look.

Attachment(s): 

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

It helps if you embed your image - instead of just attaching it - so that we can see it in context.

 

Instructions here: http://www.avrfreaks.net/comment... - also instructions for including source code in a post.

 

Like this:

 

So the above corresponds to this point in your code:

 

//--- Glodal Delecaration ---//

char tx_data;

//--- Main Program ---//

int main(void)
{
	volatile unsigned int temp = 9600;
	usart_init();                       //--- Usart initializing
	usart_msg("INITIALIZING USART");    //--- Send a set of String
	usart_tx(0x0d);                     //--- Cmd to jump to next line
	while(1)
	{

 

Clearly, at that point:

  • there is no variable called 'c' in scope
  • there is no variable called 'serialWritePos' in scope
  • there is no variable called 'TX_BUFFER_SIZE' in scope

 

(in fact, there is nothing called 'serialWritePos' or  'TX_BUFFER_SIZE' anywhere in the code you posted)

 

Which is why you are getting errors saying that all of these are "Unknown"

 

As MarekJ71 pointed out, the things in the 'Name' column have to be the names of 'C' variables in your program, and #define cannot possibly be the name of a 'C' variable - can it?

 

At this point, 'volatile' sharing variables between interrupt and "main" code has nothing at all to do with the errors you have shown.

 

Last Edited: Tue. Oct 31, 2017 - 08:10 AM
This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Your code looks remarkably similar to this: http://www.avrfreaks.net/comment...

 

SO this comment applies: http://www.avrfreaks.net/comment...