Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EEPROM with new AVR EA CPU #482

Closed
LaurentR59 opened this issue Sep 26, 2023 · 3 comments
Closed

EEPROM with new AVR EA CPU #482

LaurentR59 opened this issue Sep 26, 2023 · 3 comments

Comments

@LaurentR59
Copy link

Hi

The EA headers files let show some semantic changes from previous DX header parts ( link too with read write operation change on this most recent parts)

Anyway the current EEPROM file in libraire do not countain the right sentences to compile:

As exemple here is the IOAVR64EA48 header extract

typedef enum NVMCTRL_CMD_enum
{
NVMCTRL_CMD_NOCMD_gc = (0x00<<0), / No Command /
NVMCTRL_CMD_NOOP_gc = (0x01<<0), /* No Operation /
NVMCTRL_CMD_FLPW_gc = (0x04<<0), /
Flash Page Write /
NVMCTRL_CMD_FLPERW_gc = (0x05<<0), /
Flash Page Erase and Write /
NVMCTRL_CMD_FLPER_gc = (0x08<<0), /
Flash Page Erase /
NVMCTRL_CMD_FLMPER2_gc = (0x09<<0), /
Flash 2-page erase enable /
NVMCTRL_CMD_FLMPER4_gc = (0x0A<<0), /
Flash 4-page erase enable /
NVMCTRL_CMD_FLMPER8_gc = (0x0B<<0), /
Flash 8-page erase enable /
NVMCTRL_CMD_FLMPER16_gc = (0x0C<<0), /
Flash 16-page erase enable /
NVMCTRL_CMD_FLMPER32_gc = (0x0D<<0), /
Flash 32-page erase enable /
NVMCTRL_CMD_FLPBCLR_gc = (0x0F<<0), /
Flash Page Buffer Clear /
NVMCTRL_CMD_EEPW_gc = (0x14<<0), /
EEPROM Page Write /
NVMCTRL_CMD_EEPERW_gc = (0x15<<0), /
EEPROM Page Erase and Write /
NVMCTRL_CMD_EEPER_gc = (0x17<<0), /
EEPROM Page Erase /
NVMCTRL_CMD_EEPBCLR_gc = (0x1F<<0), /
EEPROM Page Buffer Clear /
NVMCTRL_CMD_CHER_gc = (0x20<<0), /
Chip Erase Command (UPDI only) /
NVMCTRL_CMD_EECHER_gc = (0x30<<0) /
EEPROM Erase Command (UPDI only) */
} NVMCTRL_CMD_t;

and comparare with IOAVR128DB48 header

typedef enum NVMCTRL_CMD_enum
{
NVMCTRL_CMD_NONE_gc = (0x00<<0), / No Command /
NVMCTRL_CMD_NOOP_gc = (0x01<<0), /* No Operation /
NVMCTRL_CMD_FLWR_gc = (0x02<<0), /
Flash Write /
NVMCTRL_CMD_FLPER_gc = (0x08<<0), /
Flash Page Erase /
NVMCTRL_CMD_FLMPER2_gc = (0x09<<0), /
Flash Multi-Page Erase 2 pages /
NVMCTRL_CMD_FLMPER4_gc = (0x0A<<0), /
Flash Multi-Page Erase 4 pages /
NVMCTRL_CMD_FLMPER8_gc = (0x0B<<0), /
Flash Multi-Page Erase 8 pages /
NVMCTRL_CMD_FLMPER16_gc = (0x0C<<0), /
Flash Multi-Page Erase 16 pages /
NVMCTRL_CMD_FLMPER32_gc = (0x0D<<0), /
Flash Multi-Page Erase 32 pages /
NVMCTRL_CMD_EEWR_gc = (0x12<<0), /
EEPROM Write /
NVMCTRL_CMD_EEERWR_gc = (0x13<<0), /
EEPROM Erase and Write /
NVMCTRL_CMD_EEBER_gc = (0x18<<0), /
EEPROM Byte Erase /
NVMCTRL_CMD_EEMBER2_gc = (0x19<<0), /
EEPROM Multi-Byte Erase 2 bytes /
NVMCTRL_CMD_EEMBER4_gc = (0x1A<<0), /
EEPROM Multi-Byte Erase 4 bytes /
NVMCTRL_CMD_EEMBER8_gc = (0x1B<<0), /
EEPROM Multi-Byte Erase 8 bytes /
NVMCTRL_CMD_EEMBER16_gc = (0x1C<<0), /
EEPROM Multi-Byte Erase 16 bytes /
NVMCTRL_CMD_EEMBER32_gc = (0x1D<<0), /
EEPROM Multi-Byte Erase 32 bytes /
NVMCTRL_CMD_CHER_gc = (0x20<<0), /
Chip Erase Command /
NVMCTRL_CMD_EECHER_gc = (0x30<<0) /
EEPROM Erase Command */
} NVMCTRL_CMD_t;

So EEPROM only contain instructions for:

while (NVMCTRL.STATUS & NVMCTRL_EEBUSY_bm);
// check at start - not end. Makes writing single bytes fasterms
// Note that we only have interrupts disabled for the dozen or so clock cycles
// during which we start the write, not for the while loop, and we save SREG
// before the while loop. That way there is only a 1 clock window where an
// interrupt that starts a write will cause this write to halt the CPU
// which would cause millis() to lose time.
// Note that writing more than 1 byte in an ISR will always cause millis to lose time.
cli();

_PROTECTED_WRITE_SPM(NVMCTRL.CTRLA, NVMCTRL_CMD_NONE_gc);
_PROTECTED_WRITE_SPM(NVMCTRL.CTRLA, NVMCTRL_CMD_EEERWR_gc);
*(uint8_t *)(MAPPED_EEPROM_START + (index & EEPROM_INDEX_MASK)) = in;

This provide compilation error.

It look like trivious the semantic change of NVMCTRL_CMD_NONE_gc into NVMCTRL_CMD_NOCMD_gc is pretty misconduct habits attitude but about new rows should keep in charge too soon in EEPROM to full support EA parts...

Thanks
Laurent

@SpenceKonde
Copy link
Owner

SpenceKonde commented Sep 26, 2023 via email

@LaurentR59
Copy link
Author

Hi Spence

I use now your latest version 1.5.10 in witch one EEPROM have been updated at line#75 (compare to 1.5.8)

#if defined(MEGATINYCORE) || defined(AVR_EA) || defined(AVR_EB) // where parts added: EA & EB CPU

This step fixed my issue so look like perfect right now!

I m able to full compile.

Sorry for warning.

Laurent

@SpenceKonde
Copy link
Owner

Oh... did I not have CI working on EA for the 1.5.8 release? I don;t think I did. And so the included examples hadn't been compiletested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants