Problem with Atmel Studio 6.2 compiler for AT90CAN128

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

Dear All,

I have installed ATS6.2 to compile a project for AT90CAN128. It seems the compiler does not support this IC properly. I have really strange problems.

When I insert the following instruction in the code, the code is compiled without any problem, but the IC stops functioning and my USART1 COM port disconnects:

TCCR0A = 0x05; //ON

What is the problem with this command?

Regards,

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

imanjohn wrote:
the IC stops functioning

No, I'd be pretty certain it continues to function - even if it isn't doing quite what you wanted!

Have you used the debugger to see what, exactly, it is doing :?:

Quote:
TCCR0A = 0x05; //ON

What is the problem with this command?

Have you looked to see how TCCR0A is actually being defined... :?:

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello awneil,
Thanks for comments.

I attach the C file to this email. You may want to compile it with ATS6.2, but apparently it is not possible to debug. Because ATS6.2 does not support AT90CAN128. I tried to check disassembler result, but even that was not possible through common methods.

If you be able to program the IC, you will face the problem I mentioned above.

The other compiler problem is: When you turn a flag ON inside an ISR, and implement a LOOP conditioned on that flag in the MAIN sector of the code, the compiler translates the return address(exit from loop address) to PC+0x0000 which is an infinite loop. I checked it on ATmega128. For example TIME_OUT_OVF flag in the attached code will face such a problem.

Best Regards,
imanjohn

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

You are confusing names of an IDE (AS) with the compiler(GCC).

Quote:
and my USART1 COM port disconnects

Show us stepping through disassembler (printscreen of the session) near offending line.
jrjzr

No RSTDISBL, no fun!

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

Hello Brutte,

Actually, I did not understand what you mean by:

Brutte wrote:
You are confusing names of an IDE (AS) with the compiler(GCC).

Disassembler:

Brutte wrote:
Show us stepping through disassembler (printscreen of the session) near offending line.

It is not possible to debug my code for AT90CAN128. Because ATS6.2 does not support AT90CAN128. I tried to check disassembler result, but even that was not possible through common method.
If you know how to check the disassembler for AT90CAN128, please let me know.

By the way, I have attached the C code to this message. Would you please check it?

Best Regards,
imanjohn

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

Surely it's just the simulator not the debugger that does not have support? Atmel don't simulate the complexity of CAN or USB.

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

clawson wrote:
Surely it's just the simulator not the debugger that does not have support? Atmel don't simulate the complexity of CAN or USB.

Hello,

Thanks for information.

I have attached the error message. Please let me know how I can get rid of this debug problem.

I don't know how I have selected the simulator option, because when I start a new project for 90CAN, the box is empty and I receive another error message. The second picture attached, shows the error message.

Regards,
imanjohn

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

AS6 does not support simulating for AT90CAN128. If you do not have any AS6-compatible programmer or debugger attached to your computer then do not select any tool at all. If you do have an AS6-compatible programmer or debugger connected then it should show up in the Tool drop-down menu, and you should be able to select it.

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

JohanEkdahl wrote:
AS6 does not support simulating for AT90CAN128. If you do not have any AS6-compatible programmer or debugger attached to your computer then do not select any tool at all. If you do have an AS6-compatible programmer or debugger connected then it should show up in the Tool drop-down menu, and you should be able to select it.

Hello,
I do not need the simulator. I just need to debug my code. It does not let the debugger work, unless you choose a TOOL. Unfortunately the TOOL box for AT90CAN is empty and ATS6.2 continues showing the error message I have attached above.

Thanks,
imanjohn

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

Quote:
It is not possible to debug my code for AT90CAN128. Because ATS6.2 does not support AT90CAN128

So use the tool that does support AT90CAN128.
AS 4?

No RSTDISBL, no fun!

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

Quote:

I do not need the simulator. I just need to debug my code. It does not let the debugger work, unless you choose a TOOL. Unfortunately the TOOL box for AT90CAN is empty and ATS6.2 continues showing the error message I have attached above.

What debugger do you have, and is it connected to the computer when you start Atmel Studio?

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

JohanEkdahl wrote:

What debugger do you have, and is it connected to the computer when you start Atmel Studio?

Hello,

I do not use any specific debugger. I have my PCB including AT90CAN128. I just want to debug and trace my code like I do for any other C code in Visual Studio for example. No simulation is required, because I already have my PCB developed.

Regards,
imanjohn

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

Quote:

I don't know how I have selected the simulator option, because when I start a new project for 90CAN, the box is empty and I receive another error message. The second picture attached, shows the error message.

I would be interested in known how you got that to happen... No simulator support for the can devices.

Quote:

What debugger do you have, and is it connected to the computer when you start Atmel Studio?

To chime in, for studio to show a tool, you need to have a tool. List here: http://www.atmel.com/webdoc/atme...

Quote:
I do not use any specific debugger.

How do you want to debug without a debugger and without a simulator?

:: Morten

 

(yes, I work for Microchip, yes, I do this in my spare time, now stop sending PMs)

 

The postings on this site are my own and do not represent Microchip’s positions, strategies, or opinions.

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

Quote:

I do not use any specific debugger. I have my PCB including AT90CAN128. I just want to debug and trace my code like I do for any other C code in Visual Studio for example.

There are two options for "debug and trace my code like [...] in Visual Studio":

1) The code executed on the actual AVR chip. In order for this to be possible you need a special piece of hardware that attaches the AVR to Atmel Studio for debugging purposes. This piece of hardware is called a debugger. No, a programmer will not do it.

2) The code is executed in a simulated AVR on your PC. This can be useful at a lot of times, but has the obvious drawback that it does not interface to the world as a real AVR does. Not all AVR models are supported by Atmel Studio.

Since 2) is not supported for AT90SCAN128 and you do not have a debugger as in 1) the net result is this: You can not debug and trace your code at all.

Period.

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]

Last Edited: Sun. Aug 24, 2014 - 01:56 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

meolsen wrote:
I would be interested in known how you got that to happen... No simulator support for the can devices.

I guess I switched between several ICs after I started the project and maybe the box contains useless data copied when I changed the IC type.

meolsen wrote:
How do you want to debug without a debugger and without a simulator?

I am new to Atmel Studio and I thought it already includes a default debugger.

Thanks,
imanjohn

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

Quote:

I am new to Atmel Studio and I thought it already includes a default debugger.

A debugger in this context is a piece of hardware. Atmel Studio is a piece of software.

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

Just to be clear. You need to buy a box of electronics (a debugger) to sit between your PC and your CAN128. it's a bit like the ISP programmer you probably already own but it does JTAG debugging as well. You could use

JTAGICE (Studio 4 only)
JTAGICEMKII
JTAGICE3
Atmel-ICE
Dragon
Atmel One!

These days the Atmel-ICE is probably the preferred option.

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

imanjohn wrote:
I am new to Atmel Studio and I thought it already includes a default debugger.
But this is not specific to Atmel Studio, or even Atmel!

It is the same for any debugger from any tool vendor for any chip from any manufacturer :!:

So, when you say you're "new to Atmel Studio", I take it that must mean you're new to the world of embedded microcontrollers in general?

In which case, you need to take a step back to learn the basic skills & tools of the trade.

https://www.avrfreaks.net/index.p...

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:
You need to buy a box of electronics (a debugger) to sit between your PC and your CAN128.

Also known as a "debug adaptor" or "debug interface" or similar.

Quite often (though incorrectly) known as an "ICE" (In-Circuit Emulator)

http://8052.com/forumchat/read/1...

This article (from way back in 2004) explains, compares & contrasts microcontroller debugging strategies including ROM Monitors, true ICE, and on-chip Debug (eg, JTAG):

http://i.cmpnet.com/embedded/eur...

Edit:

More on what is an emulator - and the difference from on-chip debug:

http://e2e.ti.com/support/microc...

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I do many of my porjects with the AT90CANxxx family.

Before the latest 6.x generation of AStudio, i was able to simulate the AT90CAN including the CAN mnailbox (no real hardware)

This does not work with AS6.2!

But you can always debug the device using one of the

JTAGICE mkII, JTAGICE 2 or AVR dragon, but only on real hardware!
Of course you can read also the CAN-part of the device, fire messages and so on

I program like a man:
COPY CON: > firmware.hex