Does the XMEGA EEPROM Erase command work?

Go To Last Post
8 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Freaks,

I'm currently dealing with a rather perplexing problem with my AVRISP-MKII clone programmer, specifically to do with the whole EEPROM space erase command handler. While all the other functions of my programmer work as they are intended, the Erase EEPROM command doesn't work, and I can't figure out why.

According to the datasheet, I need to load in the EEPROM ERASE command (0x30) into the NVM controller's command register, then execute the erase by setting the CMDEX bit. I won't bore everyone with the ins-and-outs of making a PDI programmer, but suffice to say that essentially the programmer gets complete access to the internal registers of the AVR just like the AVR does, and so my programmer has to follow the same sequence with the target as the target does with itself during self programming.

I know that my algorithm is correct, as the CHIP ERASE (0x40) command has the same procedure and works perfectly. This is why I'm confused; I've verified my algorithm via the similar command, yet the ERASE EEPROM command succeeds but does nothing.

Using my AVR ONE! I can see that it is possible for the command to work, as the AVR ONE! can erase the EEPROM memory space without any issues - so it's my code or their documentation that is wrong.

Has anyone experimented with the XMEGA's ERASE EEPROM command, and who can tell me for certain if it works as the datasheet indicates it does?

- Dean :twisted:

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You have an oscilloscope and a logic analyzer, don't you? So why not sniff what the AVR ONE is doing?

Stealing Proteus doesn't make you an engineer.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I've got a PoScope, but that really isn't sufficient. Actually, I'm thinking of buying a Saleae analyzer in the next week or so.

Since this command can be executed on the chip itself by the chip itself, I thought that someone with XMEGA experience might have some insight into this from their own experiments.

- Dean :twisted:

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I just tested the Erase EEPROM with self programming procedure on Xplain Rev4 and it works as expected.

Quote:
and so my programmer has to follow the same sequence with the target as the target does with itself during self programming.

According to data sheet, it is not quite true.

For self programming:

Quote:
30.11.5.6 Erase EEPROM
The Erase EEPROM command is used to erase all the locations in all EEPROM pages that corresponds the loaded and tagged locations in the EEPROM page buffer.
1. Set up the NVM CMD register to Erase EPPROM command.
2. Set the CMDEX bit in NVM CTRLA register. This requires the timed CCP sequence during self-programming.
The BUSY flag in the NVM STATUS register will be set until the operation is finished.

and for PDI:

Quote:
30.12.3.8 Erase Application/ Boot Loader/ EEPROM Section
The Erase Application Section, Erase Boot Loader Section and Erase EEPROM Section command is used to erase the complete section selected.
1. Load the NVM CMD register with Erase Application/ Boot/ EEPROM Section command
2. Write the selected section by doing a PDI Write. The section is written by addressing any byte location within the section.
The BUSY flag in the NVM STATUS register will be set until the operation is finished.

Anyway, I don't know if the PDI version is working.

George.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

And there's the rub. I discovered that inconsistency this morning -- it looks like there should be a separate entry in the command table for ERASE EEPROM SECTION (as opposed to ERASE EEPROM) but the command is missing.

The ERASE EEPROM command seems to be for split EEPROM writes, where you can erase specified EEPROM bytes within a page by tagging the bytes in the EEPROM buffer before calling ERASE EEPROM. This is distinct from the missing ERASE EEPROM SECTION, which is more like the ERASE APPLICATION SECTION command where it is PDI triggered by any write in the correct address space.

I've emailed Atmel asking if there is indeed a command missing from the table.

Cheers!
- Dean :twisted:

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

abcminiuser wrote:
I've got a PoScope, but that really isn't sufficient.

Then what about a DIY solution involving that USB stuff?

* Reduce the AVR ONE! PDI clock frequency to the lowest possible frequency (100 kHz?)

* Connect two high impedance AVR inputs of a USB AVR in parallel to the PDI lines between the AVR ONE! and the Xmega.

* Uses this second AVR to sniff the PDI protocol at a sample rate of maybe 300 kHz (hence the clock frequency reduction) when the AVR ONE! programs the Xmega. Or maybe the second AVR can use his USART as a synchronous slave.

* Continuously send the raw sampled data to a PC via USB (hence the suggestion to use an USB AVR for sniffing).

* Use a small DIY program, or a waveform viewer to decode the data on the PC.

Thinking about it, the way the Xmega and the AT90USB1287 on the Xplain are connected might already be sufficient to use the AT90USB1287 to sniff on the Xmega's PDI lines. Although the USB1287's Tx line might be a problem.

Stealing Proteus doesn't make you an engineer.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ArnoldB wrote:

Then what about a DIY solution involving that USB stuff?

Whether this works or not, you should still get one of Saleae's analyzers - they are awesome =)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

basil| wrote:
Whether this works or not,
We'll probably never know.

Stealing Proteus doesn't make you an engineer.