AnsweredAssumed Answered

IEC60355_STM8AS_V1.1.0, periodic RAM test error

Question asked by on Feb 23, 2015
Latest reply on Feb 27, 2015 by John Flood

I'm running ST library IEC60335 STM8AS v1.1.0 in a STM8S105C6. 
RAM March X periodic test is failing, I think there is an error in the library.

Class B RAM (from 
CLASS_B_START=0x10 to CLASS_B_END=0x7F) is checked from TIM4 interrupt by "ClassBTestStatus STL_TranspMarchX(void)" function. 

Firstly it copies 6 bytes from Class B RAM to RunTimeRamBuf[RT_RAM_BUF_SIZE]  @ "RUN_TIME_RAM_CHCK". Section RUN_TIME_RAM_CHCK is placed at 0x00-0x0F.

This is the loop that copies 6 bytes from Class B RAM to RunTimeRamBuf:

/* ------------------ Regular memory Self-check ----------------------- */
/*---------------------------- STEP 1 --------------------------------- */
/* Save the content of the 6 bytes to be tested and start MarchC-
         Write background with addresses increasing */

p_StartRamBlock = p_RunTimeRamChk;
= p_RunTimeRamChk + RT_RAM_BLOCKSIZE;
= 1u;
                RunTimeRamBuf[i++] = *p_RunTimeRamChk;
                *p_RunTimeRamChk++ = BCKGRND;
while(p_RunTimeRamChk < p_EndRamBlock);

p_StartRamBlock and p_EndRamBlock  are local variables placed at virtual registers (0x80…).

p_RunTimeRamChk is a global variable placed at Class B RAM, my linker places it @0x10. This variable is used in the above  loop that copies Class B RAM and then writes BCKGRND  (=0) in it, so the loop is writing to the variable that controls the loop. Result: it starts copying 6 bytes from 0x10 to 0x01 and writing 0 from 0x10 to 0x15, but when the loop writes 0 in 0x10 it is writing 0 in p_RunTimeRamChk. The loop copies more than 6 bytes and RAM is corrupted.

Is there an error in this library certified by VDE????