EZPORT write error (M52210)

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

EZPORT write error (M52210)

1,010 Views
mjbcswitzerland
Specialist V

Hi All

 

I am playing with the EZPORT (on Coldfire M52210) and found a problem when trying to program data.

 

1) I can read the status register, set the write enable bit and then the configuration register. Also bulk erase is working using the sequence:

- set write enabled, set configuration, set write enable, command bulk erase, poll the status register until the write in progress bit has cleared

 

2) When doing a page write to address 0 (32 bit aligned) I always get a Write Error Flag and no data is written. The sequence is (starting out of reset):

- set write enabled, set configuration, set write enable, command page program with 3 address bytes (all 0) plus send some data bytes (256, but I also tried sending just 4 (the minimum amount))

- reading the status register then always shows that the Write Error Flag is set

According to the data sheet this would be because the sector is protected.

 

Since the Flash is completely erased it does seem logical that all Flash sectors are protected out of reset (since the CFM protection register is loaded with 0xffffffff from the flash configuration), but how can the Flash sectors be unprotected using ezport since it can't write to processor registers?

 

I checked in a freescale application note but didn't find any reference to such a problem so maybe it has nothing to do with the flash security after all (?)

 

Any ideas why the sequence, which has correct status register values up to the start of the page program command (0x22 - showing that the configuration has been programmed and the write enable has been set) should cause a write error to result? Note that the configuration setting is 0x50 (clocked from 48MHz should give 185kHz flash clock and bulk erase works OK with the setting).

 

Regards

 

Mark

Labels (1)
Tags (1)
0 Kudos
3 Replies

528 Views
mjbcswitzerland
Specialist V

Hi All

I would like to add that the write "does" work when the sequence is:

- set write enabled, set configuration, set write enable, command bulk erase, poll the status register until the write in progress bit has cleared, set write enabled, command page program with 3 address bytes (all 0) plus send some data bytes (256)

That is, when the write takes place after the bulk erase "without a reset" between the two.

What is worrying me however is the following case:

- the internal Flash has a program and some parameters (in different sectors of flash)

- say the original program doesn't protect any sectors (although it could protect the parameter sectors without changing the case)

- now I want to update the program but without disturbing the parameters so I delete the sectors used by code (which should be possible since they are not protected by the original code - i.e. its flash configuration)

- however, before programming new code (presumably still possible) the board is reset and so the process has to be started again. In this case the code area is all 0xffffffff and the parameters are still in place. Since the flash configuration area is all 0xffffffff it presumably protects all sectors (the original problem) and now the only way to write code is to first perform a bulk erase - thus also erasing the parameter area which should be preserved.

OK - I could read out the parameter area before doing this and then program it back again later, but I wonder whether there is some means of removing the sector protection without having to do this ??

Regards

Mark

0 Kudos

528 Views
TomE
Specialist II

> I wonder whether there is some means of removing the sector protection without having to do this ??

From reading the manual, it looks like the simplest way is to read the "Protected Area" data, either from the existing FLASH or from your new code image (in case you're changing something), erase the Code blocks and then immediately reprogram the protected area data. Then you should be safe to perform a Reset and then program the code.

Tom

0 Kudos

528 Views
mjbcswitzerland
Specialist V

Hi Tom

Thanks - yes, that is a good strategy to save the amount of data to backup.

Regards

Mark

0 Kudos