20

This is quite an opinionated topic. I can speak for myself (AVR, ARM, MSP430). Difference 1 (most significant) is in the peripherals. Each of the MCU has similar UART, SPI, timers etc. - just register names and bits are different. Most of the time it was the main issue I had to deal with when moving code between chips. Solution: write your drivers with a ...


14

You arrive to the point where the value of i is o. i >= 0 is true. You try to decrement with i--. Perhaps, you are expecting a negative number. But i is unsigned, so you get 255. It keep decrementing until you get to zero. Then everything repeats again. If i were signed, then the loop would make 9 iterations. The following code does not have this ill ...


12

I have used several MCUs from four different manufacturers. The main work every time again is to get familiar with the peripherals. For example a UART itself is not too complex and I find my drivers port easily. But the last time it took me almost a day to get the clocks, I/O pins interrupt , enable etc. sorted out. The GPIO can be very complex. Bit-set, ...


8

Wow, you're certainly rebuilding your project the hard way. There is a single click (or keystroke) solution to rebuilding any changed files, and programming the mcu with the new binary. You're looking for the "run" command, which is F5 in a default install. You can also access it from the debug menu, you want the "continue" command (no, I don't know why it'...


8

This is more an opinion/comment than an answer. You don't want and shouldn't be programming in C. C++, when used in the right way, is far superior. (OK, I have to admit, when used in the wrong way it is far worse than C.) That limits you to chips that have a (modern) C++ compiler, which is roughly evertything that is supported by GCC, including AVR (with ...


7

I recently installed Atmel Studio 6 and upgraded a project that had to be manualy recreated so I thought I'd document the process including use of an AVR Dragon. The first step was to create a new project and as my code was C++ I selected GCC C++ Executable Project: The next step is device selection, a search facility is provided that saves sifting through ...


7

I just started a new C++ project under Atmel Studio 7 and with the default options the following code failed with a nullptr not declared error: char *c; if (c == nullptr) ; Then I went into the Toolchain options under the project properties and added the -std=c++11 flag as suggested by Grebu under the "other flags" which seemed like the best place for ...


7

You can output messages and values to the output window with Atmel Studio 7 (it might work with other versions but I am running version 7.0.1006 and using Atmel ICE) by doing this: Create a normal breakpoint where you want the output. Right-click on the breakpoint and select "Actions". A window will be displayed under the breakpoint line, if the "Actions" ...


6

Atmel Studio 6 provides the Atmel Software Framework which is a massive, if bloated, set of libraries for all the various hardware configurations that Atmel offers. Atmel has done a pretty good job of using doxygen in these libraries so you can find a pretty thorough set of documentation here. The ASF is fairly well integrated into the IDE with some C ...


6

The language is the same. You can either use Arduino IDE or Atmel Studio (http://www.engblaze.com/tutorial-using-atmel-studio-6-with-arduino-projects/) The Arduino libary is more of a wrapper to make it easy to do things, like digitalWrite, which you do not have by default in Atmel Studio (or you can define it yourself). With Atmel Studio you would flip a ...


6

Good datasheets tell you what the part does, not how to use it for whatever your particular purpose is. It turns out your link is not to a datasheet, some product page apparently, so I can't comment on this particular datasheet directly. If datasheets provided the hand-holding you are asking for, they would get irritating very fast to everyone that didn't ...


6

So, here's the fun part: it may be impossible to cite exactly which line is throwing the fault. The reason is that a bug in your code may be causing a the fault to appear else where -or- the bug might be destroying all the state information in the system, which is super cool. What would really help, though, is to see your entire code base: including the ...


6

There is an official archive of old versions of Atmel Studio on the Microchip website here. The download links for Atmel Studio 6.0 and 6.2 both appear to still work. In fact they have versions all the way back to 4.13 still available.


5

"i >= 0" is always true because i is unsigned.


5

The difference isn't in the platfrom. The difference is that CodeBlocks probably compiles to no optimisation at Debug setting, whereas many, if not most, embedded compilers - as configured out of the box - optimise away function calls that have no macroscopic effect. If you go to debug mode you will see you can't put any breakpoints inside mySleep(). This ...


5

Did you set the optimization flag as -Os (optimize for size)? Other tips: In Atmel Studio: check "Prepare functions for garbage collection (-ffunction-sections)" check "Prepare data for garbage collection (-fdata-sections)" check "Pack Structure members together (-fpack-struct)" check "Garbage collect unused sections (-WI, --gc-sections)" Also don't use ...


4

Be sure atfw.exe runs without problems (found in C:\Program Files (x86)\Atmel\Atmel Studio 6.2\atbackend). I found atfw.exe was missing wdapi1010.dll. Copy wdapi1010.dll from C:\Program Files (x86)\Atmel\Atmel USB Drivers\Jungo\usb64 to the atfw.exe directory. Now simulator and programmer are avail in Atmel Studio 6.2.


4

You want to use AVRDUDE. It will allow you to specify files for writing and verifying flash and EEPROM, as well as values for fuses. You will need to use a number of command line arguments, an example of which is given at Adafruit's ArduinoISP tutorial. Simply replace the partno argument with t45 to target the ATtiny45. As for the fuses, use the Engbedded ...


4

You are using the old format for interrupts, I wonder if this is the cause of the problem. Please refer to avr/interrupt.h The interrupt handler should be like ISR(USART0_RX_vect) { }


4

No answers; here's what I discovered: Of these three, only the JTAGICE-mkII is supported by AVR Studio 4. It's also old, expensive, and (relatively) slow. The JTAGICE3 is the de-facto standard for a lesser-expensive Atmel JTAG programmer/debugger, and is supported in AS5 and AS6. The ATMEL-ICE is brand new, represents Atmel's attempt to hit the lower-cost ...


4

C# requires .NET. It does NOT directly compile out into assembly or machine code. It targets the CLR or one of its subsets. Most C# programmers tend to expect a minimum level of library support, as well. If you write up a .NET layer on your own (and source code is available) or if you find someone else who has already done it, then you probably could use C#....


4

Choose "Ext. Full-Swing Crystal". You can choose the one with maximum delay if startup time is not critical for you to stay safe.


4

If I understand correctly, you want to know what architecture specific features of the platform "pop up" in your C language environment, making it more challenging to write maintainable, portable code on both platforms. C is already quite flexible in that it is a "portable assembler". All platforms you've selected have GCC/commercial compilers available ...


4

This is far from trivial to do for this part, took me quite a while and then I'm something of a veteran when it comes to writing CAN drivers. Turns out that you have to be in order to use CAN on SAM C21, because the documentation for this CAN controller is by far the worst I've ever seen. (On the positive side, the controller hardware itself is very good &...


3

According to the ATMEGA644p datasheet section 9.3.1 page 57 , there is the MCU Status Register MCUSR that provides information on which reset source caused an MCU reset.


3

Does on-chip-debugging-engine modifies flash and remembers original instruction? Yes and no. Some AVR controllers have a limited number (3?) of "hardware" breakpoints which can be set dynamically at runtime and will not live beyond the end of the debugging session (reset, power down, ...). However, if/when you have set more breakpoints than are ...


3

View -> Available Atmel Tools -> Right click on target -> Remove


3

How you program the MCU is tied to the programmer you're using. For example, because Atmel Studio doesn't natively support the USB Tiny, the process is different. If you happen to be programming AVR microcontrollers with the USB Tiny, there's a video explaining how to set up External Tools in Atmel Studio, making use of avrdude. Here's the summary of how ...


3

This usually happens if you omit this step from the instructions: And in Directories you will need to include all directories containing .h files in your project(I only managed to get working only with absolute paths). Add GCC_MEGA_AVR in Defined Symbols to tell core that we are going to use GCC for AVR microcontroller. If you think you did that, show us ...


Only top voted, non community-wiki answers of a minimum length are eligible