Hot answers tagged

16

I would not write every event to EEPROM. Most of the time you will have power, so keep the live count in RAM. The amount of energy it takes to save the live value from RAM to EEPROM is pretty minimal. Use a capacitor to store enough energy to run the micro long enough after power fail is detected to copy the live data into EEPROM, then shut down cleanly. ...


14

If you have multiple circular indents on the package, and they are all the exact same size and shape, then they are not the identifying indents. In that case the identifying dot will be printed. In general, though, you have 2 types of indent in the package. Large flat ones are part of the moulding process and are to be ignored. The identifying one is ...


12

I work equally well on PIC and AVR (and others, too). I like AVRs largely because of AVR-libc. It's a decent embedded library that is open source and reasonably well documented (UNLIKE Microchip's plib, but plib does have full source, which I genuinely appreciate). AVRs use regular old gcc and gdb which means no idiotic IDEs getting in my way. The same ...


12

Refer to the AVR Instruction Set document. For the least significant byte you want a LSL – Logical Shift Left. Shift a 0 in as least significant bit and remember the highest bit in the Carry flag. Then for the subsequent higher bytes, you want a ROL – Rotate Left trough Carry. You shift the remembered bit from carry into the right (least significant) bit ...


12

A-grade AVRs (and as of November 2014, B-grade AVRs) are minor improvements over the previous iteration; these improvements vary from chip to chip, e.g. the difference between ATtiny2313 and ATtiny2313A is different from the difference between ATmega128 and ATmega128A. Atmel has application notes that explain the difference. AVR531: "Migrating from ...


11

I think the naming overlap of vectors and pins is confusing It is! The reason there are 8 different external pins for an interrupt vector is to make it easier to layout the PCB or to use a different pin if there is a conflict with another pin function. Am I correct in thinking ... the only way to determine which pin(s) caused the interrupt is to ...


11

C will be the same with some small compiler differences. Assembly will be quite different since it's a different architecture. I advise going with C, and maybe pick up enough assembly to be able to inline some important routines. For the IDE and programmer, Atmel have similar offerings to Microchip, just have a look at their website, download the free IDE ...


11

It is max232 ic. Which is used to convert the signals from the RS232 serial port to the proper signal which are used in the TTL compatible digital logic circuits.


10

PWM can be symmetric (center aligned) or asymmetric (rising edge / left aligned or falling edge / right aligned): (source) As mentioned in the above referenced Texas Instruments application note: It has been shown that symmetric PWM signals generate fewer harmonics in the output currents and voltages The advantage of symmetric PWM thus is better ...


10

The idea behind the Vbat input on chips such as the STM32 is that the RTC and other low-power peripherals will normally be powered from the main Vdd, automatically switching to Vbat when Vdd is absent. On-chip, this can be implemented with something as simple as a diode-OR: simulate this circuit – Schematic created using CircuitLab To save pins (I ...


10

Take a look at the compiler output here https://godbolt.org/g/TxZSgt. Notice that the inner for loop and the asm("nop") lines correspond to 3 assembly instructions, two of which (sbiw and brne) take two cycles (for brne when taken). So instead of taking one cycle per inner loop like you predicted, it takes 5. And actually, if you multiply your measured ...


10

Take a look a the micronucleus bootloader... https://github.com/micronucleus/micronucleus It allows an ATTINY to accept a code download over a (slightly hackey) USB connection. It is widely used and well supported. Here is an example of the hardware that uses only a handful of passives to add a minimal USB connection to an ATTINY... From the excellent ...


9

ESP family isn't a AVR! The Library you refere to is a Arduino IDE (Integrated Development Environment) library. The Arduino IDE has a hardware layer that gives it the ability to utilize several MCU arhitectures that isn't AVR, but they share the programming environment.


9

Use a 32.768kHz crystal or tuning fork. It can run asynchronously and you'll save as much power as you can while still having a clock. The system clock will still use the internal RC oscillator.


9

Global variables/types Changing the type of global variables (e.g. use uint8_t or a similar 1 byte instead of long), or use bits to store boolean arrays. Remove static variables and replace them by dynamic (local) variables if possible. Passing them as arguments might be used to keep the scope longer. Data/precalculated tables In case you now keep (fixed) ...


8

uC's software The PIC and AVR instruction sets are similar, but I would not start out programming an AVR in assembly. Program in C, with Atmel Studio. It comes packaged with the AVR version of gcc, and has a really good disassembler that shows you the line of C you wrote, and under it, the resulting assembly instructions, very handy. I would also download ...


8

The ground side of the incoming analog signals needs to be connected to the ground of the microcontroller. Multiple ground pins on a microcontroller very conveniently allow greater current load to reach ground with reduced pin impedance (by paralleling): For instance, if a microcontroller can sink 40 mA per GPIO pin, and has a total current limit of say 200 ...


8

The answer to your question is really not the answer you want to hear. You could use a search engine to search for user generated EAGLE CAD files for Atmel chips but you may receive files that are poorly designed or old. Unless the files are from a co-worker or a capable individual that I know: I wouldn't trust other files. It's usually always best to ...


8

The solution to the problem is relatively simple. You accumulate the pulse count to a regular RAM location. Then once each 10 minutes you the copy the current value of the RAM based counter to EEPROM. Using this strategy an EEPROM with a one million cycle count endurance will last about 19 years. For most products this is a good comparison to the expected ...


8

I did find one for At25020B, but not for one with the NB suffix. Why would Atmel make a chip and not publish the datasheet? Why wouldn't they? Chips are often manufactured for specific customers with specific needs, especially if the numbers are large enough. Probably, though, your IC is an AT25020 of some kind, which pretty much sets the way it ...


7

The p stands for picoPower. It uses less power than the normal chip. Atmel picoPower devices can operate down to 1.62V while still maintaining all functionality, including analog functions. They have short wake-up time, with multiple wake-up sources and multiple sleep modes. only thing I saw was a difference in hardware, the Atmega1284-pu have the ...


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

If you look at the AVR memory map you'll see that the address of PortB is $18 (hex) (which would be written as 0x18 in C-- syntax varies with assemblers- often they'll accept the C method). It's equivalent to decimal 24 (1 * 16 + 8 ) since hex is base 16. It's correct, but ugly to write assembler code like that.. Normally you'd prefer to use an include ...


7

It's possible you could reflow this tiny BGA onto a gold-plated PCB (flux only, no paste) with a toaster oven approach, but your yield may not be 100% on the first try. It has to be placed within 0.1mm or so (they say +/-0.03mm for production) so a microscope would be a good idea unless your eyes are a lot better than mine. There's not a lot of advantage ...


7

Converted to answer. There are numerous devices in each family, so I took a typical device from each one: Atmel typical device: ATSAME70 series Tables are in section 56.3.4 for active mode. For ST: STM32F745. Tables start at page 104. Be careful of power sequencing requirements in the Atmel device; see section 6.2 According to these documents, SAME70 ...


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" ...


7

Is it possible to stack and static data collide? Yes, that is entirely possible. Atmega has no dedicated stack space, so if you use too much of it, you will overflow and crash your static data. Try to reduce your memory consumption (use the smallest suitable data types for variables, reduce your array sizes etc.) Make sure you don't have any recursion or ...


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

You can solve this problem with just a couple of parts. TI makes logic parts in their 74AC logic family that operate correctly down to 1.5V. Use a 4 bit counter as shown below to repeatedly count from 8 to 15. Use the RCO output, which is a one clock wide pulse to reload the counter and to also drive an R/C circuit to produce the narrow pulse that you ...


6

You say that according to Figure 22-7 in the datasheet it should only draw 300µA, but that graph shows the current draw for operation without clock division. A crystal oscillator running at 16MHz is bound to draw more current than one running at 2MHz, and the 3 stage divider will add a bit more. The question is - how much more? The datasheet also suggests ...


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