question: size of eeprom?

Discuss mods, hacks, tweaks, etc.

Moderators: altitude, adafruit_support_bill, adafruit, phono, hamburgers

Please be positive and constructive with your questions and comments.
Locked
mario1089
 
Posts: 208
Joined: Wed Sep 19, 2012 8:11 am

question: size of eeprom?

Post by mario1089 »

Is it right that "external" eprom is of size 4kBytes, while 16*16*8=2kBytes bytes are actually used for the pattern bank? So there would be enough space for each step to have another byte with the flags stored?

User avatar
antto
 
Posts: 1636
Joined: Thu Apr 15, 2010 3:21 pm

Re: question: size of eeprom?

Post by antto »

yes, the external EEPROM is 4KB
stock firmware (and sokkos and everything derived from those) use 16bytes for the patterns which sums up to 2048 bytes total
in BANNED you can extract all 4KB* of the eeprom, it simply requests for patterns from banks beyond 16, since there is no checks for that in the firmware
n0nx0x uses 21bytes for each pattern..

* in n0nx0x, it's slightly less than 4096 bytes due to the pattern size of 21 bytes, but BANNED does the math and won't request a pattern which would fall outside the eeprom length, also, the eeprom size can be adjusted from the settings, since there is no actual way for the app to know how big it is.. i do not recommend changing it if you're not sure what you're doing, i personally have no clue what happens if the firmware attempts to read/write beyond the length of the eeprom :shock:

mario1089
 
Posts: 208
Joined: Wed Sep 19, 2012 8:11 am

Re: question: size of eeprom?

Post by mario1089 »

So what do I have to do exactly in the (xoxbox-) code to make conbox read and write the entire eeprom (256 "patterns") when doing pattern export/import? What you say, sounds like nothing, it happens already. Or not? EDITED: Guess I have to send more bytes in compcontrol.c, right?

My plan is to use the 2nd half of the eeprom to store additional flags for each step, so that the patterns as they are keep being right when loading the new firmware with the new features (yes, I`ll have to do a clean up of the eeprom when first loading, but easy to do, doing that already for other things). Notice, 1 pattern then will consist out of 2 halfs, one in the 1st part, one in the second part of the eeprom. Single combined pattern dump will of course not work with conbox, but I think it`s enough to store all of it together.

User avatar
antto
 
Posts: 1636
Joined: Thu Apr 15, 2010 3:21 pm

Re: question: size of eeprom?

Post by antto »

all this mojo with the MSG_OS_VER has the purpose to make it easier for a firmware to be distinguishable, if needed

currently, BANNED "detects" the pattern size on connect, it simply asks for [Bank1, Slot1] and uses the message size
all current firmwares would return a pattern of size 16, except n0nx0x which returns 21 bytes (that's how it distinguishes it)

if you want to put additional information in each pattern, storing it "after" the 2kB would mean:
1) your patterns would still be consistent between stock firmware and sokkos
2) you will have to use "Export EEPROM" to make full backups
that's assuming you don't change the pattern size message (keep it 16)

you can do it like n0nx0x, put all data into a single area, and change the pattern size respectively
1) your patterns won't be consistent with the stock firmware
2) "Export Patterns" will be enough to make a backup of the patterns
3) a small convertion will be needed when going from stock firmware to your firmware and back

yet another option is to put the additional data after the 2048 bytes, and put the convertion code in the actual firmware:
1) your patterns will be consistent with stock firmware
2) when BANNED requests a pattern, you will return (for example) the first 16 bytes of the normal pattern plus the additional N bytes after it (which are located somewhere at the back of the eeprom) into one packet
3) as far as BANNED is concerned, your pattern would be 16+N bytes long
4) when BANNED gives you a pattern (which would be 16+N bytes big) you will take the first 16bytes and put them in the respective slot, and then put the remaining N bytes in their respective location at the back of the eeprom

so the 3rd variant would require slightly more code i guess
in all 3 cases, you are not required to implement MSG_OS_VER or anything, BANNED will automatically detect the pattern size and if it's not 16 bytes, it will show your firmware as "(auto) Unknown FW" (unless if it's 21 bytes where it will think it's "(auto) n0nx0x beta" )

i'd personally go for variant 3 in your case
i went for variant 2 in n0nx0x, because the actual pattern format was totally different from the stock one anyway

mario1089
 
Posts: 208
Joined: Wed Sep 19, 2012 8:11 am

Re: question: size of eeprom?

Post by mario1089 »

Thanx antto, this is a great answer! I agree variant 3 is the way to go, sounds not hard to do. but one question: would conbox still allow sending dumped patterns that had been exported with stock firmware? My code would be able to get that right, store the stock-pattern at normal eeprom place and set the other informations to default. But conbox may decide like "pattern size not matching, I`m not allowed to send this data to this firmware". That the case?

User avatar
antto
 
Posts: 1636
Joined: Thu Apr 15, 2010 3:21 pm

Re: question: size of eeprom?

Post by antto »

in the .CXM file format, there is a small header in the beginning of the file with a few values:
OS_ID OS_VER Pattern_Size

if you have a .cxm file which was exported and Pattern_Size was different than the current one, and try to import the file - BANNED would warn you about the inconsistency and ask you if you want to treat the file as if it's the same pattern size

in any case, "Export EEPROM" will always try to extract 4KB (that's the size of the eeprom as set from the settings) given the current pattern size
more specifically number of patterns that BANNED will extract is = (EEPROM_SIZE / PAT_SIZE) rounded down
so in n0nx0x that means 195 patterns or 4095 bytes

mario1089
 
Posts: 208
Joined: Wed Sep 19, 2012 8:11 am

Re: question: size of eeprom?

Post by mario1089 »

if you have a .cxm file which was exported and Pattern_Size was different than the current one, and try to import the file - BANNED would warn you about the inconsistency and ask you if you want to treat the file as if it's the same pattern size
Perfect, thanx! worked out well as it seems.

Locked
Please be positive and constructive with your questions and comments.

Return to “x0xm0dz”