Teensy 3.1 is dead after Erase All Blocks Command :-(

Status
Not open for further replies.

NickViz

Member
Hi Paul,

today I managed to kill my Teensy 3.1 with an Erase All Blocks Command :-( May be you can help in this case somehow?

The whole story:
I enabled EEPROM for my project. It partitioned D-flash for that, etc, so EEPROM works OK. After that I wanted to use the D-flash as a normal flash and thus I need to disable the EEPROM. I read quite some info from tech spec, but all my attempts to revert to non-eeprom state failed.
The Program Partition Command:
Code:
FTFL_FSTAT = FTFL_FSTAT_RDCOLERR | FTFL_FSTAT_ACCERR | FTFL_FSTAT_FPVIOL;
FTFL_FCCOB0 = 0x80; // PGMPART = Program Partition Command
FTFL_FCCOB4 = 0x3F; // EEPROM Size is 0
FTFL_FCCOB5 = 0x00; // 32K for Dataflash, 0K for EEPROM backup
__disable_irq();
// do_flash_cmd() must execute from RAM.  Luckily the C syntax is simple...
(*((void (*)(volatile uint8_t *))((uint32_t)do_flash_cmd | 1)))(&FTFL_FSTAT);
__enable_irq();
failed with ACCERR all the time. Looks like the D-flash must be erased before this command.

I tried to erase the D-flash before run the Program Partition command:
Code:
for (unsigned int i = 0; i < 32; i++)
{
FTFL_FSTAT = FTFL_FSTAT_RDCOLERR | FTFL_FSTAT_ACCERR | FTFL_FSTAT_FPVIOL;
FTFL_FCCOB0 = 0x09; // ERSSCR = Erase Flash Sector Command
FTFL_FCCOB1 = 0x80; // Flash address [23:16], bit 23 is 1 = D-flash
FTFL_FCCOB2 = 0x00 + (i << 2); // Flash address [15:8]
FTFL_FCCOB3 = 0x00; // Flash address [7:0], [1:0] must be 00
__disable_irq();
FTFL_FSTAT = FTFL_FSTAT_CCIF;		// trigger erase
while (!(FTFL_FSTAT & FTFL_FSTAT_CCIF));// wait to complete
__enable_irq();
}
but again I got ACCERR state.

I enabled FlexRAM (well, actually it was the single action that succeeded in my try):
Code:
FTFL_FSTAT = FTFL_FSTAT_RDCOLERR | FTFL_FSTAT_ACCERR | FTFL_FSTAT_FPVIOL;
FTFL_FCCOB0 = 0x81; // SETRAM = Set FlexRAM Function
FTFL_FCCOB1 = 0xFF; // Make FlexRAM available as RAM
__disable_irq();
FTFL_FSTAT = FTFL_FSTAT_CCIF;		// trigger command
while (!(FTFL_FSTAT & FTFL_FSTAT_CCIF));// wait to complete
__enable_irq();

But even after that erase flash and partition didn't succeed. As your loader keeps EEPROM during the boot - I didn't find the way to get rid of EEPROMt. And then I used the Erase All Blocks.

That one succeed - Teensy has died :-( It doesn't appear in the Device Manager and the Teensy Loader doesn't recognize it. The LED (obviously) is not blinking and it doesn't react on button press.

12:53:07: Teensy Loader 1.19, begin program
12:53:07: File "main.hex". 14756 bytes, 6% used
12:53:07: Listening for remote control on port 3149
12:53:07: initialized, showing main window
12:53:07: HID/win32: vid:046D pid:0A0C ver:1013
12:53:09: Verbose Info event

Is there anything that I can do with it? Feed external clock or so? I read and did troubleshooting guide, but without success.

It would be nice if you place a decent note somewhere that the complete erasing will brick your Teensy. Also would be nice to be able to erase the Teensy through the loader to the factory state (for instance to have eeprom disabled).

Any help is really appreciated.

Nikolai
 
I'd like to get this back for testing. PJRC can swap it for a brand new one, if you're willing to send it to me. Please email me directly, paul at pjrc dot com.
 
Status
Not open for further replies.
Back
Top