I am using S12ZVHY, when i put eeprom read/write then my system gets hang, if i remove eeprom read/write then it is working ok. why this issue occures?

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

I am using S12ZVHY, when i put eeprom read/write then my system gets hang, if i remove eeprom read/write then it is working ok. why this issue occures?

1,105件の閲覧回数
sourabhpatil
Contributor I

whats the root cause for this issue?

how this issue can be handled?

ラベル(1)
0 件の賞賛
返信
3 返答(返信)

629件の閲覧回数
RadekS
NXP Employee
NXP Employee

Hi Sourabh,

It is quite difficult to say what root cause is it in your case.

The system hangs directly on some EEPROM command?

What you mean by “system gets hang”? It means MCU reset or lost connection with debugger?

Could you please provide your code related to EEPROM read/write?

You cannot simultaneously read and write EEPROM. Did your software read EEPROM values inside any interrupts?

In that case, at least critical section of EEPROM commands has to be protected by disabling interrupts.

The all illegal accesses performed by the S12ZCPU trigger machine exceptions. Did you implement machine exception interrupt routine?

For example:

//==============================================================================

// Machine_Exception_ISR

//==============================================================================

interrupt 5 void Machine_Exception_ISR(void)

{

  asm NOP:  //place breakpoint here

  //MCU reset:

  //CPMUCOP = 0x01;  //Initialize COP watchdog

  //CPMUARMCOP = 0x00; //write any value except 0x55 or 0xAA cause MCU reset

}

EEPROM must be erased prior programming. Commutative writes are not allowed and it may cases double bit ECC error detection leading to machine exception.

In attachment is simple S12Z EEPROM example code.


I hope it helps you.

Have a great day,
RadekS

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 件の賞賛
返信

629件の閲覧回数
sourabhpatil
Contributor I

Hi RadekS,

System cannot hangs directly on the EEPROM command.

When I ON-OFF the system continuously then after some iteration system hangs.

System hangs means it doesn't come out of the one while loop which is before EEPROM read/write operations, but if I remove EEPROM

read/write then it is working OK.

Software doesn't read EEPROM in any interrupt.

I haven't implemented any exception in software.

abc.png

In attachment you find the EEPROM read/Write commands.

Regards,

Sourabh.

0 件の賞賛
返信

629件の閲覧回数
RadekS
NXP Employee
NXP Employee

Hi Sourabh,

Thank you for more details.

1.    What means “ErrF==0ff”, shouldn’t be there “ErrF==0xff”?

2.    If I understood correctly, you want write 32bit number into EEPROM. The smallest portion of EEPROM which could be programmed is one word = 16bits (Program EEPROM command could program 1..4 words). It doesn’t have any sense to divide temp_id into bytes, you could write whole temp_id variable by single command. Programming address must be aligned to word (global address [0] = 0). Target area of EEPROM must be erased prior programming.

3.    It seems that you don’t handle error codes from EEPROM routines. Therefore you don’t see that your commands failed.

Please look at EEPROM write implementation in my example code.

You could use for example such code:

error = EEPROM_Program(TEMP_ID_ADDR, temp_id, 2);

instead your huge for loop.


I hope it helps you.

Have a great day,
RadekS

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 件の賞賛
返信