avr

Is there a general algorithm for microcontroller EEPROM wear leveling?

你说的曾经没有我的故事 提交于 2019-12-03 05:15:59
问题 I'm working on an Arduino library that will maximize the life of the AVR's EEPROM. It takes the number of variables you want to store and does the rest. This is my attempt, which does not work in all cases. Background information Atmel says each memory cell is rated for 100,000 write/erase cycles. They also provide an application note, which describes how to perform wear levelling. Here is a summary of the application note. By alternating writes across two memory addresses, we can increase

Protocols used to talk between an embedded CPU and a PC

我的未来我决定 提交于 2019-12-03 04:24:46
问题 I am building a small device with its own CPU (AVR Mega8) that is supposed to connect to a PC. Assuming that the physical connection and passing of bytes has been accomplished, what would be the best protocol to use on top of those bytes? The computer needs to be able to set certain voltages on the device, and read back certain other voltages. At the moment, I am thinking a completely host-driven synchronous protocol: computer send requests, the embedded CPU answers. Any other ideas? 回答1:

Using the Arduino libraries for regular AVR code

这一生的挚爱 提交于 2019-12-03 04:22:21
问题 I have an Arduino Uno and a Linux environment. Though the Arduino IDE is great and all, however it doesn't give me much inputs if something goes wrong. And it also becomes excruciatingly slow and stops communicating with the chip sometimes. The alternative is to code my Arduino Uno using the AVR-GCC/g++ and AVRDude toolchain. However, I would very much like to have access to the same functions as in Arduino (like Serial, digitalWrite, etc.) while programming using a simple text editor and

Mixing C and assembly sources and build with cmake

依然范特西╮ 提交于 2019-12-03 01:51:23
I'm using eclipse for building a avr-gcc project that mixes assembly code and C source files. I want to get rid of the automatic makefile generation of eclipse because I need to automate some process into the makefiles and for other reasons. I used cmake some times ago and I was happy with it so I want to try to compile my source files using it. Everything run as expected with C sources. The problem is that at the end I need to compile some assembly files (actually 2) and add them to the target. I googled around but I didn't found a way for doing this. someone have an idea on how to do this?

Best platform for learning embedded programming? [closed]

和自甴很熟 提交于 2019-12-03 01:31:02
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 7 years ago . I'm looking to learn about embedded programming (in C mainly, but I hope to brush up on my ASM as well) and I was wondering what the

Is there a general algorithm for microcontroller EEPROM wear leveling?

我的未来我决定 提交于 2019-12-02 19:38:51
I'm working on an Arduino library that will maximize the life of the AVR's EEPROM. It takes the number of variables you want to store and does the rest. This is my attempt, which does not work in all cases. Background information Atmel says each memory cell is rated for 100,000 write/erase cycles. They also provide an application note , which describes how to perform wear levelling. Here is a summary of the application note. By alternating writes across two memory addresses, we can increase the erase/write to 200,000 cycles. Three memory addresses gives you 300,000 erase/write cycles and so on

Using the Arduino libraries for regular AVR code

半城伤御伤魂 提交于 2019-12-02 18:39:56
I have an Arduino Uno and a Linux environment. Though the Arduino IDE is great and all, however it doesn't give me much inputs if something goes wrong. And it also becomes excruciatingly slow and stops communicating with the chip sometimes. The alternative is to code my Arduino Uno using the AVR-GCC/g++ and AVRDude toolchain. However, I would very much like to have access to the same functions as in Arduino (like Serial , digitalWrite , etc.) while programming using a simple text editor and command line tools. So I tried to find the header file with all the functions defined ie "Arduino.h" in

Calculating delay from 3 nested loops

谁都会走 提交于 2019-12-02 17:45:43
问题 My exercise: •Calculate the maximum delay possible using three loops @ 1 MHz clock frequency. (Answer 49.94 s) delay: ldi r23,$FF ;Initialise 3rd loop counter loop3: ldi r24,$FF ;Initialise 2nd loop counter loop2: ldi r25,$FF ;Initialise 1st loop counter loop1: dec r25 ;Decrement the 1st loop counter brne loop1 ;and continue to decrement until 1st loop counter = 0 dec r24 ;Decrement the 2nd loop counter brne loop2 ;If the 2nd loop counter is not equal to zero repeat the 1st loop, else

Arduino Bootloader

☆樱花仙子☆ 提交于 2019-12-02 17:32:19
Can someone please explain how the Arduino bootloader works? I'm not looking for a high level answer here, I've read the code and I get the gist of it. There's a bunch of protocol interaction that happens between the Arduino IDE and the bootloader code, ultimately resulting in a number of inline assembly instructions that self-program the flash with the program being transmitted over the serial interface. What I'm not clear on is on line 270: void (*app_start)(void) = 0x0000; ...which I recognize as the declaration, and initialization to NULL, of a function pointer. There are subsequent calls

USB programming

独自空忆成欢 提交于 2019-12-02 15:54:27
I want to program a microcontroller (AVR) to control some leds through USB. It's just out of interest in how to build and program USB devices. There are some AVR microcontrollers that support the USB protocol or I could implement the USB protocol in an another microcontroller myself, but I wonder what to use to write your own drivers on the computer. My level in system programming: total noob (hence the question) So what is the literature you people would advice to get good knowledge of the USB technology and how to write your own drivers and beyond? P.S.: I know: C (probably will need it here