21 votes

PIC32 vs dsPIC vs ARM vs AVR, does the architecture matter when we are programming in C-language anyways?

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 ...
filo's user avatar
  • 8,951
12 votes

PIC32 vs dsPIC vs ARM vs AVR, does the architecture matter when we are programming in C-language anyways?

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 ...
Oldfart's user avatar
  • 14.4k
10 votes

Convert the type of calculation result in if() to uint8_t

rxWritePos is already uint8_t so obviously the cast (uint8_t)rxWritePos is nonsense - you ...
Lundin's user avatar
  • 20.2k
9 votes
Accepted

How to enable c++11 support for Atmel Studio?

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: ...
PeterJ's user avatar
  • 17.2k
9 votes
Accepted

Convert the type of calculation result in if() to uint8_t

You need parentheses around the whole expression: (uint8_t)(rxWritePos-1). If rxWritePos = 0: ...
DamienD's user avatar
  • 3,305
8 votes

PIC32 vs dsPIC vs ARM vs AVR, does the architecture matter when we are programming in C-language anyways?

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 ...
Wouter van Ooijen's user avatar
8 votes

How to share a variable between ISR and main-code?

This line: int encVal = 0; Creates a variable local to the ISR. If you expect that variable name to be globally accessible then you could have problems. Even if ...
Spehro Pefhany's user avatar
7 votes
Accepted

Finding the source of a Hard Fault using extended HardFault_Handler

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 fault to appear elsewhere -or- the bug might be ...
pgvoorhees's user avatar
  • 2,516
7 votes
Accepted

Is it possible to redirect print streams to debugger in Atmel system?

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 ...
DigitalNinja's user avatar
  • 1,087
6 votes

Atmel UC3A0512 microcontroller documentation

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 ...
Olin Lathrop's user avatar
6 votes
Accepted

Find Atmel Studio 6 installer?

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 ...
Tom Carpenter's user avatar
6 votes

Driving a 12 V DC pump using Atmega16 Microcontroller and a 2N2222a transistor but it is not working?

First, the transistor you have chosen may not be adequate for the job. You state that the water pump motor is rated 4.8 W and 12 V. This implies a rated current of 400 mA, not 0.4 mA. Now the 2N2222A ...
Math Keeps Me Busy's user avatar
5 votes

Differences in using c user-defined functions on PC and on ARM

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 ...
Asmyldof's user avatar
  • 18.4k
5 votes
Accepted

How to reduce code size in flash of atmega8?

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 ...
Flanker's user avatar
  • 561
5 votes
Accepted

ATSAMC21 - CAN configuration - Nominal bit timing vs. data bit timing & time quanta calculation

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 ...
Lundin's user avatar
  • 20.2k
4 votes

Write program for Atmega microcontroller with C#

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 ...
jonk's user avatar
  • 77.9k
4 votes
Accepted

Which crystal do i choose in atmel studio?

Choose "Ext. Full-Swing Crystal". You can choose the one with maximum delay if startup time is not critical for you to stay safe.
filo's user avatar
  • 8,951
4 votes
Accepted

How to correct Warning : array subscript has type 'char' [-Wchar-subscripts]

The warning is fairly self explanatory. One of your array subscripts is a char. Specifically: for (char i=0 ... PacketData[i] = ... Notice how ...
Tom Carpenter's user avatar
4 votes

PIC32 vs dsPIC vs ARM vs AVR, does the architecture matter when we are programming in C-language anyways?

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 ...
Hans's user avatar
  • 7,277
4 votes

difference between CMSIS and ASF

Basically, CMSIS is a vendor-independent interface for some ARM Cortex chips, while ASF is a restricted library for Atmel (now owned my microchip) devices. ARM Primer ARM Cortex is the core ...
Kurt E. Clothier's user avatar
3 votes

Unable to program ATSAML21 PCB via SWD - Problem with connection?

As it turns out, on the 32 pin variant of the SAML21, you have to tie VDDANA to the power supply as well (with a decoupling cap in place obvs). Got around it by soldering a bit of wire from the ...
Andy Mills's user avatar
3 votes

Atmel studio coding

Replying to your new version of the question: what's best DDRG |= (1<<DDRG3) OR DDRG = 0x08 There is no "best" because ...
SamGibson's user avatar
  • 17.9k
3 votes

PIC32 vs dsPIC vs ARM vs AVR, does the architecture matter when we are programming in C-language anyways?

Yes and no. From a programmers perspective you are ideally hiding the details of the instruction set. But that is to some extent already not relevant the peripherals which is the whole point of ...
old_timer's user avatar
  • 8,274
3 votes
Accepted

Using Atmel Studio 7 to program Arduino Uno

I successfully use a different approach for getting AtmelStudio to program a device with a bootloader, and that is to use the "Custom Programming Tool". In the "Solution Explorer" window, right-click ...
Tom Carpenter's user avatar
3 votes

Atmel SPI "wait for transmission complete" example is wrong?

According to the same manual 18.5.2 When a serial transfer is complete, the SPIF Flag is set. /--/ the SPIF bit is cleared by first reading the SPI status register with SPIF set, then accessing the ...
Lundin's user avatar
  • 20.2k
3 votes

Convert the type of calculation result in if() to uint8_t

(uint8_t)((rxWritePos-1) & 255) At each calculation you have to apply a mask, then you will get always the correct result.
Marko Buršič's user avatar
3 votes

Driving a 12 V DC pump using Atmega16 Microcontroller and a 2N2222a transistor but it is not working?

Reduce base resistance from 10kΩ to 470Ω. 10kΩ is too high to produce sufficient base current for 400mA collector current through the motor. Also, as explained here, the 2N2222 pin configuration is ...
Simon Fitch's user avatar
  • 35.1k
2 votes

Is it possible to power target microcontroller from AVRISP mkII using Atmel Studio

I've found very nice step by step instruction at the Arduino forum with the following pics: Hope it will help someone...
Roman Matveev's user avatar
2 votes

Differences in using c user-defined functions on PC and on ARM

You never say what your error actually is, but I suspect that because your function does nothing in main, it is being optimized out by your compiler. Try compiling with optimization turned off
Scott Seidman's user avatar

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