#avr Logs

Dec 12 2019

#avr Calendar

02:50 AM Snoras_ is now known as Snoras
09:13 AM merethan_w: I´m working on a system reading eeprom pages at a time, then doing two´s complement before using any of the read data. Is it smart to use the nvm controller page buffer for this, or should I just copy the entire page to stack memory?
09:22 AM cehteh: eeprom is not paged
09:22 AM cehteh: (or actually its 1 byte pages)
09:22 AM merethan_w: For my model, one page is 32bytes
09:22 AM cehteh: what mcu anyway? on old ones its as i saied, on new ones eeprom is mapped to memory
09:22 AM cehteh: avr i mean
09:22 AM merethan_w: xmega256A3BU
10:02 AM merethan_w: Shite, can´t write the buffer twice :(
10:03 AM merethan_w: Writing buffer to eeprom is a flush operation, meaning data is no longer there once pushed to eeprom.
10:04 AM merethan_w: I wanted to write the buffer to two pages. Guess I´ll have to do this from stack memory then.
10:24 AM cehteh: somehoe i expected that :D ... because most hardware buffers work that way
10:25 AM cehteh: you may map the eeprom into memory if possible
10:27 AM merethan_w: Yes I can, the buffer can be memory mapped. But only one page at the time and flushing it means, well, flushing.
10:27 AM merethan_w: So I need a copy in SRAM anyways
10:37 AM Fuchikoma: I don't think there is any advantage either way
10:38 AM Fuchikoma: There's no "speed bonus" for sequential EEPROM reads afaik, other than not having to set up the memory pointer
10:41 AM Fuchikoma: "Data addresses 0x1000 to 0x1FFF are reserved for memory mapping of EEPROM"
10:43 AM Fuchikoma: I have to wonder though what the data in the EEPROM is for, or where it comes from, and if you can just do a 2's compliment to it before it's even written and save yourself the trouble?
10:43 AM merethan_w: Thats my plan.
10:44 AM merethan_w: I want to write each 32 byte page with 2 bytes checksum. And I want those pages to have a backup copy.
10:45 AM merethan_w: So writing one page means there´s also a backup written. Reading a page and checksum fails means the backup is read thereafter.
10:45 AM Fuchikoma: Okay that's not a big deal... 68 bytes in total
10:46 AM merethan_w: Nah I do the checksum in the last two bytes. Each page yields me 30 usable bytes.
10:46 AM Fuchikoma: Ah k
10:46 AM Fuchikoma: same difference
10:47 AM cehteh: hum
10:47 AM cehteh: why 2's complement?
10:47 AM Fuchikoma: positive <-> negative value
10:48 AM cehteh: avr libc has some crc calcs which are well optimized and can be done on the go
10:48 AM Fuchikoma: I don't know if that's relevant to the 2's compliment thing
10:48 AM cehteh: i added those to my eeprom lib for checksumming stuff
10:48 AM cehteh: yeha i dont know for what he needs 2-s complement
10:49 AM cehteh: why dont store it complemented in the first place?
10:49 AM Fuchikoma: Anyway, I do all my AVR programming in assembly so I can't help with using some fancy memory library or anything, but other than possible high wear-and-tear on the EEPROM this is a super easy thing to do if you have the 32bytes of RAM to spare
10:49 AM cehteh: round robin loggged writing is super easy to do
10:51 AM Fuchikoma: LD Rd, X+
10:51 AM Fuchikoma: ST Y+, Rd
10:51 AM Fuchikoma: Loop 32 times
11:58 PM day__ is now known as day