Inline ASM - Advanced AVR 3.0 Core - LMP read from flash Load Program Memory

Channel:
Subscribers:
580
Published on ● Video Link: https://www.youtube.com/watch?v=XCcsNbNLIEQ



Duration: 2:20
20 views
0


lmp instruction allows the MCU to read from its CPU flash memory location or program space. It seems like a super complicated process, but only 2 lines of code are needed in inline asm and total 4 lines of asm code compiled, so it's super simple. The MCU can write to the program space as well, bootloader-less, and that is more complicated, implementing as a read-and-write flash memory used in application. Flash memory can be read instantly, for a good reason, since the MCU is required to read 2 bytes in one clock cycle. On the other hand, writing to flash by itself without a bootloader is slightly complicated.

1, only 1 page can be written at a time. Where as reading can be done randomly.
2, during writing a page, the MCU is freezing.
3, spm instruction only works in the RWW section. Dumb name for a section indeed. It simply means the memory address within the bootloader section.
4, read can be done so as many time as desired. Write cycle wears down the memory cell and is limited to 10k write/erase cycles or 5k actual cycles since to write a page, it is required to be erased first.
5, done, that is all.

======================================
Strategy for solving number 4:
a, for battery powered logging application, sram can be used as a buffer, and combined with power down mode, minimal amount of energy is needed to keep the content of sram alive. Flash memory is updated at a fixed interval or with external event such as a push of a button.
b, eeprom has a true random access 100k write cycle, so it should be used as a secondary buffer.




Other Videos By Flyandance


2023-03-20Bootloader self-program - Juno AVR109 Rewrite Part 1 - Advanced AVR 3.0 Core
2023-03-19Bootloader self-program - AVR109 speed test avrdude - Advanced AVR 3.0 Core - 1Mbps with 8MHz CPU
2023-03-18Bootloader self-program - AVR109 w/ AVROSP and avrdude - Advanced AVR 3.0 Core
2023-03-17SPM 3.0 writes to self - Advanced AVR 3.0 Core Bootloader
2023-03-16SPM 2.0 writes to self - Advanced AVR 3.0 Core Bootloader
2023-03-14You jump, ijmp - Inline asm Indirect Jump - Advanced AVR 3.0 Core Bootloader
2023-03-05yt-dlp - A ultimate guide (The result of 2 weeks of hard work)
2023-03-03True bare Minimal code - Advanced AVR 3.0 Core Bootloader Pro Part 4 Size does matters getting naked
2023-02-28Bootloader-less Pro - Advanced AVR 3.0 Core - Part 3 - SPM - App Writes to App section - programmer
2023-02-27Bootloader-less Pro - Advanced AVR 3.0 Core - Part 2 - SPM erase self destruction code
2023-02-26Inline ASM - Advanced AVR 3.0 Core - LMP read from flash Load Program Memory
2023-02-25Inline ASM - Advanced AVR 3.0 Core - Finalizing
2023-02-22Inline ASM - Advanced AVR 3.0 Core
2023-02-19Bootloader-less Pro - Advanced AVR 3.0 Core - Part 1 - GCC Sections functions attribute
2023-02-17Script cowboy - the power of one line of code
2023-02-15Bootloader Pro - Advanced AVR 3.0 Core - AVR-C 2.0 sucks BBC
2023-02-11Juno ABC - Advanced Button Core 4.0 - Sleep mode ultra low power
2023-02-07My Coffee ritual 2.0 - Simple Minimalistic - Dry milk + sugar
2023-02-03Sleep mode - Advanced AVR 3.0 - Atiny13 watchdog less than 100nA - Peripheral leakage current Button
2023-02-02Definition of good soup - Chicken Turmeric
2023-02-01Sleep mode - Advanced AVR 3.0 - 32kHz Timer2 Asynchronous mode - Atmega8 low power 8-12uA