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

Use a single generic eep file for resetting EEPROM #75

Merged
merged 2 commits into from
May 20, 2019
Merged

Use a single generic eep file for resetting EEPROM #75

merged 2 commits into from
May 20, 2019

Conversation

fauxpark
Copy link
Member

@fauxpark fauxpark commented May 20, 2019

Description

Removed the MCU-specific atmega32u4_eeprom_reset.hex for a more universal .eep file which sets the first byte to 0x00 so that the first two bytes are no longer 0xFEED (which should trigger EEPROM reinit).

Works on macOS with a DFU keyboard. Windows, and Caterina on macOS still need testing.

Types of Changes

  • Core
  • Bugfix
  • New feature
  • Enhancement/optimization
  • Documentation

Issues Fixed or Closed by This PR

Copy link
Member

@drashna drashna left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested this on DFU (atmega32u4 and atmega32u2), and a Pro Micro with caterina bootloader, all on Windows.

Seems to work perfectly!

@drashna drashna merged commit 5cf499c into qmk:master May 20, 2019
@fauxpark fauxpark deleted the improve-eeprom-reset branch May 20, 2019 23:12
@drashna
Copy link
Member

drashna commented May 21, 2019

Ugh, it doesn't want to work now, with additional testing. So, yeah, we do need the erase :(

@fauxpark
Copy link
Member Author

It might just need --force to skip the blank check (that's where it's failing for me, anyway).

@fauxpark
Copy link
Member Author

fauxpark commented May 21, 2019

That seems to do the trick:

>>> dfu-programmer atmega32u4 flash --force --eeprom /Users/xxxxxxx/Library/Developer/Xcode/DerivedData/QMK_Toolbox-gdtrdjidcfskjkbqlxqokdgcpkat/Build/Products/Debug/QMK Toolbox.app/Contents/Resources/reset.eep
    0%                            100%  Programming 0x80 bytes...
    [>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>]  Success
    0%                            100%  Reading 0x400 bytes...
    [>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>]  Success
    Validating...  Success
    0x80 bytes written into 0x400 bytes memory (12.50%).

Not sure why it's still apparently writing 128 bytes though... Probably something to do with page size.

@drashna
Copy link
Member

drashna commented May 21, 2019

--force doesn't work for me

Okay. I see the issue. We're using an old version of dfu-programmer in Windows. We need to use flash-eeprom to write the eeprom

@drashna
Copy link
Member

drashna commented May 21, 2019

Nope, that still doesn't work on Windows :'(

@fauxpark
Copy link
Member Author

fauxpark commented May 21, 2019

What version is it on Windows? The macOS version is 0.7.0, and --force --eeprom should be the correct command since at least that point: dfu-programmer/dfu-programmer@c41ef7b

@fauxpark
Copy link
Member Author

fauxpark commented May 21, 2019

Okay, I'm back at my VS env... --force works fine for me 😕

Also, the dfu-programmer versions are definitely the same.

@drashna
Copy link
Member

drashna commented May 21, 2019

0.7.2 for Windows. And it wasn't for me.

To clarify with some testing.... This works fine for the 32u4, but the 32u2 .... it will not write, even with force.

@drashna
Copy link
Member

drashna commented May 21, 2019

Though, I think for now, that should be fine.

Though... if we keep with the Toolbox, the "reset eeprom" may be better as an option for flashing, rather than a separate thing.

@fauxpark
Copy link
Member Author

What's the output you get from trying to reset a 32U2?

@drashna
Copy link
Member

drashna commented May 21, 2019

Nothing helpful.

>>> dfu-programmer.exe atmega32u2 flash-eeprom "reset.eep" --force
    0%                            100%  Programming 0x80 bytes...
    [ X  ERROR
    Memory write error, use debug for more info.

And debugging info didn't dive anything useful

@fauxpark
Copy link
Member Author

fauxpark commented May 21, 2019

There's no such command as "flash-eeprom" as of 0.7.0, see the commit I linked above. Have you tried flash --eeprom --force "reset.eep"?

Okay, it appears to still work...

@fauxpark fauxpark mentioned this pull request Oct 16, 2019
@nooges nooges mentioned this pull request Apr 7, 2020
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reset EEPROM doesn't work for atmega32u2
2 participants