Home
Here - Hitex (UK)
Contents
1. Upper half not the inverse of lower half so flag an error uiCIC_DFLASH Error DFLASH Integrity Error It then resets the ClIC61508 and waits 60ms for it to restart before exiting This strategy could also be used in an application where the DFLASH is checked before the main system starts Using The ClC61508 SPI Interface 48 V1 0 2011 08 hitex TOOLS DEVELOPMENT PRO SIL Safety System SAKCIC61508 SPI Interface I d START of CIC61508 N Programming A Wait 60ms for CIC61508 to complete BIST upon power up Read CIC61508 SFR ERRORSYSTEM to ensure CIC61508 in disabled state _ Is CIC61508 in lt DISABLED state i ac Se NO YES Enter Secure SPI mode a 1s CIC61508 in NO Secure SPI mode r eg YES Read entire DFLASH contents into an array s value in main cop Erase entire DFLASH contents r Program entire DFLASH contents with data from C const array Force CIC to reset r Wait 60ms for CIC61508 to complete BIST upon power up EXIT Figure 12 Real Application Example Programming Corrupted Or Blank DFLASH Using The CIC61508 SPI Interface 49 V1 0 2011 08 PRO SIL Safety System hitex SAKCIC61508 SPI Interface 12 Troubleshooting The table below lists some common problems encountered when using the example ap
2. Error write failed Write was successful Return error status Write Any Address Sequence Figure 7 Basic example of secure mode writes are Write the location X 0xFOFF CIC Status uiCIC WriteSecureAddress QxAAU OxFOFFU XDATA Read the data back from X 0xFOFF uiTestValue uiCIC_ ReadSecureAddress OxFOFFU XDATA Code Listing 11 Writing a XDATA Location From the foregoing a simple function is created to write secure mode addresses uiData uintl6 CIC_ErrorType uiMspace uiCIC WriteSecureAddress uint8 Using The ClC61508 SPI Interface 37 uiAddress uintl6 V1 0 2011 08 e PRO SIL Safety System hitex SAKCIC61508 SPI Interface DEVELOPMENT TOOLS This uses the basic uiCIC_SPl_SendMessage function to send the write command and data It also uses the previously created uiCIC_ReadSecureAddress to check that the write was successful The memory space parameters are identical to those in the read function except that the CODE space has no effect as this is not writable see later sections for how to write to the DFLASH in the CODE space CIC _ErrorType uiCIC_ WriteSecureAddress uint8 uiData uintl6 uiAddress uintl6 uiMspace Declare Locals uint1l6 uiDummy uintl6 uiReadData uintl6 uiWriteData CIC_ErrorType uiResult Send address to write in secure mode using uiCIC SPI SendMessage uiDummy uiCIC_SPI SendMessage uiAddr
3. DEVELOPMENT TOOLS Introduction This application covers the use of the ClC61508 standard and secure SPI modes It uses a step by step approach to showing how to access the CIC SFRs and DFLASH programming modes from the SPI interface A TC1782 SafeTkit board is used as a basis as this is a stable and well known platform that is also used for PRO SIL applications proving and development The example applications developed in this application note can be downloaded from ftp internal hitex co uk pub hitex C1C61508 CIC61508 SPI zip The unzip password is hitex2013 Using The ClC61508 SPI Interface 8 V1 0 2011 08 PRO SIL Safety System hi tex Geet gemeng aan SAKCIC61508 SPI Interface 1 Overview It is accompanied by example applications which are built using the Tasking Eclipse VX tools v3 5r1 and executed using the evaluation version of the Hitex HifTOP54 TC debugger The final application contains all the techniques set out in earlier programs and provides a complete set of CIC61508 standard and secure mode driver functions Each application builds on the previous one In all cases the objective is to end up with a simple to use function with a clear API that does something useful For example to read a CIC61508 SFR step by step requires us to Wait for any previous transmission to complete Reset transmit interrupt request Write the SFR offset to the SSC Transmit buffer Loop until the transmission buffer is ava
4. READ CODE location 0xA000 A000 0008 CIC reply 00A0 lt bytedata gt 00 WRITE 0x11 to PDATA location 0xF000 F000 1184 CIC reply 00F0 8411 WRITE 0x22 to IDATA location OxOOFE OOFE 2282 CIC reply FE00 8222 To program the DFLASH Write 0xA000 to OxA01F wordline with data 0x01 to Ox1F Define the wordline address to be programmed Send A000 0088 Send data to be programmed Send A000 lt byte0 gt 88 AO00 lt byte1 gt 88 AOO0 lt byte31 gt 88 Wait for completion of Dflash programming using simple 102ms timeout Oe Ne Easy to use C functions will be created now to undertake these actions Using The ClC61508 SPI Interface 30 V1 0 2011 08 e PRO SIL Safety System hitex SAKCIC61508 SPI Interface DEVELOPMENT TOOLS 7 2 How To Get Into Secure SPI Mode Entering the secure SPI mode requires that the CIC61508 is in either the NOTREADY or DISABLED state ERRORSYSTEM 0x78 or 0x2D To enter the secure mode an address and password approach is used as per TC1782 sends secure mode address OxABO2 CIC61508 replies with random data this is OK TC1782 sends secure mode password OxA5B6 CIC61508 replies with OxABO2 TC1782 sends any secure mode address CIC61508 replies with OxAB4B TC1782 sends a read command E UL S a e E We are now in secure SPI mode Note that the steps 5 and 7 are not obvious and are required because the reply from the CIC61508 to any message is in fact the
5. TOOLS PRO SIL Safety System SAKCIC61508 SPI Interface 13 2 Appendix 2 CIC61508 SPI Functions Memory Usage Table 2 Function uiCIC_ EraseDFLASH uiCIC_ ReadSecureAddress uiCIC_SPI_EnterSecureMode uiCIC_SPI_FastWriteSFR uiCIC_SPl_ReadSFR uiCIC_SPI_SendMessage uiCIC_SPI_WriteSFR uiCIC_WriteDFLASH_Wordline uiCIC_WriteEntireDFLASH uiReset_CIC uiReset_CIC_Immediate vCIC_SPI_Driver Total ROM Size For All SPI Driver Functions Using The CIC61508 SPI Interface ROM Requirement For SPI Functions 55 Code size hex 0x0000003a 0x00000022 0x0000009e 0x00000034 0x00000032 0x00000030 0x00000062 0x00000060 0x0000002c 0x0000001e 0x00000026 0x000000e4 0x3D8 984 bytes V1 0 2011 08
6. data items Note port pins are not directly accessible from secure SPI mode If you need to read or write specific ClC61508 port pins you will need to use the Applet concept covered in a separate application note Some useful secure SPI mode addresses are C 0x1000 Secure SPI mode SSC interface C 0x2000 Reset hook legacy use only C 0x2FFF CRC8 of CIC61508 program ROM X 0xFO6A BIST memory test results X 0xF061 BIST opcode test results I 0x87 ERRORSYSTEM SFR absolute address Addresses of data items in the DFLASH can be gleaned from the CIC61508 Buildsheet spreadsheet Using The ClC61508 SPI Interface 35 V1 0 2011 08 PRO SIL Safety System hitex mam SAKCIC61508 SPI Interface 8 2 Creating A Function To Read Any Secure Mode Address In App6 the steps required to read a secure mode address were covered In this App these have been incorporated into a new function uintl6 uiCIC_ ReadSecureAddress uintl6 uiAddress uintl6 uiMspace The uiMspace parameter specifies which memory space in the CIC61508 is to be read according to define CODE Ox08U Access code space C 0x000 Ox2FFF define XDATA 0x04U Access xdata space X 0xF000 OxFI1FF define IDATA 0x02U Access idata space I 0x0000 Ox00FF The function consists of the following steps uintl6 uiCIC ReadSecureAddress uintl6 uiAddress uintl6 uiMspace Declare Locals uint1l6 uiDummy uintl16 uiReadData Send address
7. fun ction cccssccseeeeeeeeeeeseeceseeeeneneeeeeeeseaesesneeeneeeeseeseseaesnseeeeeenaeas 26 App5 Using the SFR WRITE function to load the SPI error COUNtEr ceceseseereeeeeeeeees 29 App6 Entering Secure SPI Mode c ccccsecesseeceseeeeeeeeeeeeeeeseaesesneeenseaeseaesasaaesasneeeneeeessaesaseenenseaees 30 Secure SPI Mode Example Messages s ssessessssresiresirssiissrrssirssirsstnsstnsstnsstnnstnnstnnstnnntnnnnennnnn ntent 30 How To Get Into Secure SPI Mode 31 First Steps In Secure SPI Mode A 33 App7 Using Secure SPI Mode Features cccseccesccessseceseeeeeeeeeeseeescaeseseeeenseeeseaeseseaeenseaeeeeneeas 35 CIG61508 Memory SpaCes a2c05 scevessscsiesdeaseeeanneceseddenaeerasdendedlenadecaesastbes Gad aana ridini na naaaahieida diiin 35 Creating A Function To Read Any Secure Mode Address cccccccccessececeesneeeeessneeeeessueeeeesnieeeeess 36 Writing Of Secure Mode Addresees eser tstr rttr retn nettnsttnssnnnstnsnnsnnnnnnnnnsnnnsnnn nann 37 App8 Erasing And Programming The DFLASH ccesccsseeesseeeeeeeeseeesesnaeenseeeeeeneeseeesesneeeenenees 40 Erasing The DELASH es eeggdettrdeeeegrhe red de E Seege A0 Erase Function Greg 41 Creating The Erase elo eseu eege aa aaa aa aat aiaa iiaae a a a AE aaa 41 Using The uiCIC_EraseDFLASH Erase Function sseseesseesseessesssessseersentnnnntnnnstnnnnnstnnnennnnnnnt 42 Programming The DFLASH siriasi iistogasceiinan eaa a aaa aaea a
8. function to allow the 2 6ms programming delay to be inserted Set up a 2 6ms delay to allow programming to complete case Start CS Wait For PROG Cycle Schedule the next tick 2 6ms later At 2 5us count we need to add 2600 2 5 1040 to the compare register GPTAO LTCXRO1 U 1040U Go to wait for end of programming time state CIC_SPI_ state CS Wait For PROG Cycle break End of 2 6ms programming delay case CS Wait For PROG Cycle End of Programming cycle CIC_SPI_ state CS Idle Schedule the next 75us tick GPTAO LTCXRO1 U 30 break Code Listing 18 Creating the 2 6ms programming delay Using The ClC61508 SPI Interface 43 V1 0 2011 08 hitex DEVELOPMENT TOOLS PRO SIL Safety System SAKCIC61508 SPI Interface The wordline programming procedure may be summarized as Figure 9 DFLASH Wordline programming procedure Using The CIC61508 SPI Interface C uiCIC_WriteDFLASH Wordline function Declare Locals Work out base address of this wordline Send base address of wordline in secure mode Send program DFLASH command y Move through the array containing new DFLASH data one wordline 0x20 at a time Construct the data to write to CIC61508 Get the first byte of the next wordline Move it to the high byte of the message OR in the CODE WRIT
9. hitex SAKCIC61508 SPI Interface DEVELOPMENT TOOLS The function CIC_SPI_Driver is located in CIC_SPI_Examples_App3 c and is basically a switch statement Determine this action switch CIC_SPI_ state case Start SPI Transmission Background has requested SPI transaction Send the next data SSCO_TSRC B CLRR 0x01U Reset transmit interrupt request SSCO_TB U uiSPI Tx data load transmit buffer register Wait for transmission buffer to be available again while SSCO TSRC B SRR 0x00U Wait Now wait for transmission to complete while SSCO STAT B BSY 0x01U Wait Get message just received from CIC uiSPI Rx data SSCO_RB U Next interrupt will be on the next 75us tick GPTAO LTC clock is 2 5us so 30 x 2 5 75us As the compare register GPTAQ LTCXRO1 contains the GPTAO LTCXROO count at the last 75us we just need to add another 30 counts to create the next 75us tick s Schedule next 75us interrupt by incrementing compare register by 30 GPTAO LTCXRO1 U 30 Next time wait for end of 75us slot CIG SPI state CS Idle Note A new transmission request from the background will not be actioned until 75us has elapsed break case CS Idle SPI transaction completed Schedule the next 75us tick GPTAO LTCXRO1 U 30 break Code Listing 4 CIC_SPI_Driver Interr
10. hitex SAKCIC61508 SPI Interface DEVELOPMENT TOOLS The sequence of operations for a SFR write are Send data to write Bit 7 must be set to tell CIC that this is a write high byte of reply from CIC By making a dummy read of the SFR the next transaction Issue a read command for SER just written Check that SFR address 0x80 is in high byte of reply from We need to wait one complete CIC61508 before false Return error status It should be noted that the function will hang for 660us while the system tick timeout Using The CIC61508 SPI Interface 28 V1 0 2011 08 PRO SIL Safety System hii i e en weng TFF SAKCIC61508 SPI Interface 6 App5 Using the SFR WRITE function to load the SPI error counter Now that we have a workable SFR write function we can perform an useful CIC61508 action To get the CIC61508 into the ACTIVE state all the error counters need to be gt 0x40 The SPI error count ERRORCNTCOMM has be manually loaded This is done by writing the SPI RESET command to the MODE SFR The CIC will then load 0x80 into ERRORCNTCOMM We can then read this back to check that it really is 0x80 Now set the SPI Error counter to 0x80 using SPI RESET command CIC Status uiCIC SPI WriteSFR CSFR_EST
11. reply to the previous one just as in standard SPI mode Thus to get the reply to the secure password 0xA5B6 we make a dummy read of the XDATA location 0xF001 The OxA5B6 is returned after the sending of the 0xF001 address so this where the 0x1234 and OxAB4B replies are checked for However to stop the CIC61508 getting out of step with the TC1782 the second part of the read of X 0xF001 is then sent Secure SPI messages to the CIC61508 must always be made in pairs The timing requirements for messages is the same i e 75us minimum between transactions However there is no need to ever wait 600us between address write and read operations as the normal CIC61508 system is disabled in secure mode The exact details of this are set out in the CIC61508 User Manual v1 0 section 2 8 What follows here is a practical implementation that works Using The CIC61508 SPI Interface 31 V1 0 2011 08 e PRO SIL Safety System hitex mem SAKCIC61508 SPI Interface a uiCIC_SPI_EnterSecureMode J Note it is not function defined what the first reply will be so Declare locals value is just discarded Initialise j Error Status Send secure mode password 0xA5B6 and get Check value of CIC61508 reply CIC SYS SFR to 0xAB02 Check Any error 7 reported will whether the not be handled C1IC61508 replied with first error code
12. to read in secure mode using uiCIC SPI SendMessage uiDummy uiCIC_SPI SendMessage uiAddress Send READ command using uiCIC_SPI SendMessage uiDummy uiCIC SPI SendMessage Secure READ uiMspace amp OxOOFFU Send address to read in secure mode again uiReadData uiCIC SPI SendMessage uiAddress Send READ command again to keep CIC in sync uiDummy uiCIC SPI SendMessage Secure READ uiMspace amp 0x00FFU Return data read from address return uiReadData Code Listing 10 The uiCIC_ReadSecureAddress Function Using The ClC61508 SPI Interface 36 V1 0 2011 08 h itex DEVELOPMENT TOOLS PRO SIL Safety System SAKCIC61508 SPI Interface 8 3 Writing Of Secure Mode Addresses In the App7 main we use secure SPI mode to perform some commonly used commands via proper secure mode read and write functions located in CIC_SPI_Examples_App7 The first action is writing to a memory location The low level sequence of operations to make a write are uiCIC_WriteSecureAddress function Declare Locals Send address to write in secure mode using uiCIC_SPI_Se ndMessage Shift data to write 8 places to left Send WRITE command using uiCIC_SPI_Se ndMessage Read back byte just written usin uiCIC_ReadSecu reAddress Was the data read back the same as that written false
13. 0800 Go to wait for end of erase time state CIC_ SPI state CS Wait For ERASE Cycle break case CS Wait For ERASE Cycle End of ERASE cycle Go back to idle state CIC SPI state CS Idle Schedule the next 75us tick GPTAO LTCXRO1 U 30 break Code Listing 16 Creating the 102ms erase delay Using The ClC61508 SPI Interface 41 V1 0 2011 08 e PRO SIL Safety System hitex SAKCIC61508 SPI Interface DEVELOPMENT TOOLS 9 1 3 Using The uiCIC_EraseDFLASH Erase Function In the main c for example App8 the entire DFLASH is read into a local array using the secure mode read command in a for loop Read th ntire DFLASH contents into an array for uil 0x00 uil lt DFLASH Length uiltt Read the DFLASH byte by byte into array uiDFLASH Image uil uiCIC_ ReadSecureAddress uilIl DFLASH Base Addr CODE Code Listing 17 Reading the entire DFLASH into an array prior to erasing When running in a debugger if you put uIDFLASH_Image into a watch window and you should see the contents of the DFLASH For most ClC61508 configurations this should start with OxF8 0x0D OxE9 0x74 0x071 The DFLASH is then erased CIC Status uiCIC_ EraseDFLASH After erasure the DFLASH will contain only zeros this being the usual state of erased Infineon FLASH memory The example then goes on to program the pre
14. 8 hitex DEVELOPMENT TOOLS PRO SIL Safety System SAKCIC61508 SPI Interface 1 1 Installing The Example Applications The examples must be imported into the Tasking Eclipse environment This is done from an import directory Run the installer ClC61508_SPl exe and follow the on screen instructions The result will be a directory structure on driver C A J CIC61508AppletExamples dJ CIC6L508FW Config Msi Date modified 24 06 2011 15 18 18 03 2011 13 59 08 06 2011 11 16 24 06 2011 08 54 Type File folder File folder File folder File folder The subdirectory CIC_SPI_Examples contains further directories as shown A Name J CIC_SPI_Examples_App0 A CIC_SPI_Examples_App1 A CIC_SPI_Examples_App2 A CIC_SPI_Examples_App3 A CIC_SPIExamples_App4 J CIC_SPI_Examples_App5 1 CIC_SPI_Examples_App6 A CIC_SPI_Examples_App7 A CIC_SPIExamples_App8 J CIC_SPI_Examples_App9 A cice1508 A Docs Date modified 24 0 24 0 24 0 24 0 24 0 24 0 24 0 24 0 24 0 24 0 24 0 24 0 2011 15 18 2011 15 18 2011 15 18 2011 15 18 2011 15 18 2011 15 18 2011 15 18 2011 15 18 2011 15 18 2011 15 18 2011 15 18 6 6 6 6 6 6 6 6 6 6 6 6 2011 15 18 Type File folder File folder File folder File folder File folder File folder File folder File folder File folder File folder File folder File folder The directories CIC_SPI_Examples_App0 1 2 etc con
15. 8 Internal System Ticks Ous 600us n Q O Ka 1200us Thus to avoid confusion the write function implemented here inserts a 600us delay before attempting to read back the reply This means that the CIC_SPI_Driver interrupt function now needs some additional cases Start_CS_Wait_For_ClC_System_Tick and CS_Wait_For_ClC_System_Tick In reality due to system oscillator tolerances the system tick time is assumed to be up to 10 slow so we actually use a 660us system tick time Using The ClC61508 SPI Interface 26 V1 0 2011 08 hitex DEVELOPMENT TOOLS PRO SIL Safety System SAKCIC61508 SPI Interface Insert a 600us case Start CS Wai delay t_ For CIC System Tick Schedule In fact CIC and a 600us tick period to accommodate the potential clock differences between th the host CPU we need to allow a 10 safety margin so the delay is really 660us 27 Incremen t LTCO1l compare register by 660us 2 5us 240 counts GPTAO LTCXRO1 U 264U Wait in next state CIC SPI state CS Wait For CIC System Tick break Stay in this state until timeout ends case CS Wait For CIC System Tick Go back to idle state CIC SPI state CS Idle Schedule the next 75us tick GPTAO LTCXRO1 U 30 break Code Listing 6 System tick timeout cases Using The ClC61508 SPI Interface 27 V1 0 2011 08 e PRO SIL Safety System
16. ASH void has been created Using The ClC61508 SPI Interface 40 V1 0 2011 08 PRO SIL Safety System hi tex Gm gemeng ETE SAKCIC61508 SPI Interface 9 1 1 Erase Function Error Codes The uiCIC_EraseDFLASH erase function is makes use of the ClIC61508 bootROM erase function that is built in the ClC61508 This is able to return a number of errors In addition the CIC61508 itself can identify a number of errors related to the addresses supplied The error codes returned are listed below define FLASH TYPE1 ERASE FAILED 0x0200U define Address Not DFLASH Base 0x0300U define Address Above DFLASH 0x0400U define Address Below _DFLASH 0x0400U Code Listing 15 Possible Erase Error Codes The error FLASH_TYPE1_ERASE_FAILED is generated by the CIC61508 bootROM and if this occurs it is likely that an attempt was made to erase the DFLASH while a previous attempt was in still progress i e no erase delay was used lf the functions given in CIC_SPI_Examples_App8 c are used unmodified then none of these errors should be encountered 9 1 2 Creating The Erase Delay To create the 102ms erase delay an extra pair of cases have been added to the CIC_SPI_Driver function Setup a 102ms delay to allow erase to complete case Start CS Wait For ERASE Cycle Schedule the next tick 102ms later At 2 5us count we need to add 102000 2 5 40800 to the compare register GPTAO LTCXRO1 U 4
17. Check CIC state for Ki 0x1234 true either alse ERIS NOTREADY or DISABLED Previously secure mode entry address CIC state is CIC was not in noe ee ee NOT READY or NOTREADY or metre DISABLED so OK DISABLED state replied with to enter secure 0x1234 mode Write Report error PROGRAMMING ee ee Gee Check that cIc61508 is really in secure SPI mode by trying a secure SPI mode command Here we will try and read CIC61508 XDATA location X 0xF001 Need to wait for at least two CIC 600us system ticks before proceeding first tick This allows the MODE command to be written inside the CIC Read X 0xF001 part 1 This gets back the reply to the previous Wait for system tick timeout to message complete the secure mode eru entry password Wait E Need to wait for at least two CIC 600us Bees t tick RE CIC61508 proceeding has a second tick true to SCH y This allows the wit Programming successful secure mode entry code OxAB4B Mode state to be entered Wait for system tick Incorrect reply CIC61508 has timeout to to OxABO2 replied with complete successful secure mode true Was the entry code Wait CIC61508 OxAB4B true first reply alse correct E Now use 16 bit secure mode entry address Address was OK Password an
18. E command Send base address of current wordline in secure mode Send data and program command Secure_WRITE CODE Need to wait for at least 2 6ms to allow programming to complete before proceeding Wait while 2 6ms timeout is in progress true Wait BEE Send address in secure mode again to force CIC61508 to return any error message from the last action here Send a dummy READ command to keep CIC in sync Return error status after programming 44 V1 0 2011 08 e PRO SIL Safety System hitex SAKCIC61508 SPI Interface DEVELOPMENT TOOLS The wordline programming is undertaken by the function uiCIC_WriteDFLASH_Wordline This receives a pointer to the 32bytes of the current wordline the base address of the DFLASH and the offset of the current wordline from the base of the DFLASH In the main for App8 we actually want to programme the entire DFLASH with the data previous read from it prior to the erase This means that a wrapper function is required to break up the 0x1000 DFLASH image into 0x20 byte chuncks This is done by uiCIC_WriteEntireDFLASH uiCIC_WriteEntireDFLASH Declare Locals Initialise status to no error Check for legal false length to program true Limit length to overall length of DFLASH Program data from inpu
19. ICK TIMEOUt CASCS 5 ccaceesseeeteres veticetececadts apehs thas cehentaadeteabescensiueneentedbcenetanetenebavecebadaceeeety 27 Initialising the SPI Error Counter Using The SFR Write Function esseesseesseesseessressserssreeenese 29 Reading the CIC61508 CRC8 at C 0x2FFF in secure SPI mode ssssssssssnnsssrreseennnnneennnneene 33 Secure SPI Command Set ue 34 The uiCIC_ReadSecureAddress Function cccccceeceeeeeeeeeeeeceeeeeeaeeeeneeseeeeessaeeeseeeeeaes 36 Writing a XDATA LOCATION 000 0 eee ee eeceee ee enne ee te eee ee ee tena ee ee taaeee ee eaae ee ee a irada aAA raa 37 The uiCIC_WriteSecureAddress FUNCTION cccccceeeeeeeeneeeeeeeeeeeeeeeaeeeeaeeseeeesaeeeeeaeeeeaes 38 Cause A CIC61508 Reset 0 2 eeeceeececeneeeceaeeeeeeeseeeeeceaeeesaaeseeaeeeeaeeecaaeeseaaeseeeeeseeeesaeeneaeees 39 Causing CIC61508 ReSet eccceeececeeeeeeeeeeeaee scenes ceaeeecaaeeeeaeeseaeeesaaeseeaaeseeeeeseaeeesaeeseaeees 39 Possible Erase Error Codes 0 cccccccecceeeeeeeeeeeeceeeeeceaeeeeaaeseeneeceaeeesaaeeseaaesnaeeeseeeesaeeeeaaeeee 41 Creating the 102ms erase delay nsen nnnn nnna 41 Reading the entire DFLASH into an array prior to eraelng 42 Creating the 2 6ms programming delay c ccceecceeeeeeeeee scenes eeaeeesaaeeeeeeeseeeeeaeeeeeeseeetes 43 DFLASH Image Export From TARDISS PRO SIL TestBench ssseeeseeeeeerssrrerreeneens 46 V1 0 2011 08 e PRO SIL Safety System hitex SAKCIC61508 SPI Interface
20. M_MODE ESTM SPI RESET Now read back the SPI Error counter to see whether it contains 0x80 CIC Status uiCIC SPI ReadSFR CSFR_ESTM_SPICNT uint8 amp uicIc6150 8 ERRORCNTCOMM lt Code Listing 7 Initialising the SPI Error Counter Using The SFR Write Function It is best to single step this in your debugger to see what happens Using The CIC61508 SPI Interface 29 V1 0 2011 08 PRO SIL Safety System hi tex pi gemeng ETT SAKCIC61508 SPI Interface 7 App6 Entering Secure SPI Mode Now that we have functions that can read and write CIC61508 SFRs reliably the next stage is to enter the secure SPI mode This uses a completely different SPI protocol still 16 bit messages and has a special set of entry conditions to ensure that it is not accidentally entered This security is required as in secure mode we have the ability to erase and reprogramme the calibration data in the DFLASH In addition we can read and write addresses that are not normally accessible cause the ClIC61508 to jump to any address plus make unconditional device resets Within the context of a safety system these actions must only be performed intentionally 7 1 Secure SPI Mode Example Messages Here are some low level examples of secure SPI mode reads and writes READ PDATA location OxF001 F001 0004 CIC reply 01F0 lt bytedata gt 00 READ IDATA location OxOOFE OOFE 0002 CIC reply FEOO lt bytedata gt 00
21. RORSYSTEM will go to OxFF The simple timing loop based delay used here is clearly unsuitable for real applications as it ties up the whole CPU for 60us at a time The next example overcomes this by using a GPTA interrupt for message pacing Using The ClC61508 SPI Interface 22 V1 0 2011 08 PRO SIL Safety System hi Et e mM weg aad SAKCIC61508 SPI Interface 4 App3 Practicable message exchange with the CIC61508 Apps results in workable CIC61508 SFR read function with error checking and message spacing based on a GPTAO timer This is useful for real applications 4 1 Providing A SPI Message Timebase Many aspects of the CIC61508 s SPI interface relies on accurate timing on the part of the master device TC1782 In uiClIC_SPI_ReadSFR in App3 the second read of the SFR address is delayed by 75us based on a state machine called from the GPTO_LTC01 interrupt SRN22 LTCOO is configured as a 2 5us count free running timer and LTC0O1 as a compare register with interrupt on match enabled void INTERRUPT GPTAO SRN22INT GPTAO viSRN22 void if GPTAO SRSS2 B LTC1 LTCl event compare with last timer GPTAO_SRSC2 U 0x00000002 reset LTCl service request bit Call the CIC SPI handler every 75us vCIC_SPI Driver FLASH LEDO I0 Sa OS 1 End of function GPTAO viSRN22 Figure4 GPTA_LTCO01 SRN22 interrupt handler Using The ClC61508 SPI Interface 23 V1 0 2011 08 e PRO SIL Safety System
22. Safety System hitex SAKCIC61508 SPI Interface DEVELOPMENT TOOLS 10 App9 Programming The DFLASH From A TARDISS Export This example takes a DFLASH image created by the TARDISS or PRO SIL TestBench tools and programs it into DFLASH The TARDISS and PRO SIL TestBench tools are able to import CIC61508 DFLASH data from a spreadsheet BuildSheet or a real device and then export them as a compilable C file containing the calibration data in the form of a C const array i a PRO SIL SafeTkit Test Bench Figure 11 PRO SIL TestBench NVM Tables Tab This kind of operation may be used on a production line where the CIC s DFLASH data is programmed by a production line test program running on the TC1782 The DFLASH image is held in the file CIC_DFLASH C and in a const array DELAGH data Autogenerated File Template Include the necessary include files include CIC_DFLASH h wu unsigned char CONST CIC_DFLASH data CIC_ DFLASH SIZE 0x00 OxF8 0x0D OxE9 0x74 0x01 OxB7 0x42 OxA6 0x3B 0x02 OxEE Ox1B OxFF 0x62 0x03 Code Listing 19 DFLASH Image Export From TARDISS PRO SIL TestBench In the main in App9 the programming is now carried via No error occurred so we are in secure SPI mode CIC Status uiCIC EraseDFLASH Program DFLASH data exported from the TARDISS or PRO SIL TestBench tools CIC Status uiCIC WriteEntireDFLASH CIC_DFLASH data DFLASH Lengt
23. _ErrorType ubeset ClCivoid eens eeeeaeeeeeeeeeaeeeeeaeeeeaaeseceeesaeeesaaeeeeeeeseaeeesiaeeseneeeee 53 CIC_ErrorType ubeset CIC Immediateivoid 53 uint16 uiCIC_SPI_FastWriteSFR uint8 uiSFR_addr uint8 uiSFR_data 0 ccecessseeeesseteeeeeees 54 Appendix 2 ClIC61508 SPI Functions Memory Usage 55 Using The ClC61508 SPI Interface 4 V1 0 2011 08 e PRO SIL Safety System hitex SAKCIC61508 SPI Interface DEVELOPMENT TOOLS List of Figures List of Figures Figure 1 Example Applications In Tasking Eclipse ce eeccceeeeeeeeeeeeeeeeeeeeaeeeeeeaaeeeeeeaaeeeeeeaaeeeseeaaeeeseeaeeeenenas 10 Figure 2 Example Application Directory Layout 10 Figure 3 uIGIG SPI ReadSFR le En EE 21 Figure 4 GPTA_LTCO01 SRN22 interrupt handler ccccceececeeeceeeee cee eeeeaeeeeeeeceaeeeseaesseaaeseeeeescaeeesaeeeeeeeenaees 23 Figure 5 Entering Secure SPI Mode veiiisssiscsctssseeesntevestevtesdes cst anviser ceiavesttvisveseethanesatvnsseedsvasedtisnestendsaneesiees 32 Figure6 Read any address Seguente cccceecccceceecceeeeeeeceeeeeeeceeeesseceeesaaeeeeeesaeaeeeeaaeaeeesaeeeeeeneeeseneeseeeeenenees 34 Figure 7 Write Any Address Sequence eesseesseeseeesseteneesn netr nesn netr netrnstrnntnnsstnntnnnnsstnsstnnstenanennnnnannennnennn nnt 37 Fig reg8 E HR le Ee HE A0 Figure 9 DFLASH Wordline programming procedure scccccceceeeeeceeeeeeeeceeeeeseaeeesaaeeeeaaeseeeeeseaeeesaeeseaeesnaees 44 Figure 10 Breaking
24. a a a aaa aia 43 Exiting Secure SPI Mode After DFLASH Reprogramming s sssssssssssssrsssrrssrnssrnssrnssrnssrnssrnssrnssrnssnns 45 App9 Programming The DFLASH From A TARDISS Export ssssssnssunseunreunreunnnunnnunnnunnnunnnnnnnnnnnnn 46 Restoring Corrupted DFLASH isinisieceninieriniaii eiaa aa ENNER ENEE 47 App10 Typical Usage Example ccceseeeccceseeeeeeeeeeeseseeeeeseeeeneeseseeneeseseeeeesesesneeseseeneeseseenenseseeeneets 48 Tro blesh o re nccesser te denen eb ece adele ted teceenv helene vide avhede st eceend 50 PAD PON ICOS eege dee 51 Appendix 1 ClIC61508 SPI FUNCTIONS sisi iraossni tanisma tiniknnniannn innein aiana enean aiaia aa 51 uint16 uiCIC_SPI_SendMessage uint16 us data 51 VOIdYVCIC SPI Driver Void EE 51 CIC_ErrorType uiCIC_SPI_ReadSFR uint8 uviSFR_addr uint8 uIGEH data 51 CIC_ErrorType uiCIC_SPI_WriteSFR uint8 uiSFR_addr uint8 GER data 51 CIC_ErrorType uClC GP ErmterGecurekModeivoid 52 uint16 uiCIC_ReadSecureAddress uint16 uiAddress uint16 uiMspace ssssseessessesseessresssresseess 52 CIC_ErrorType uiCIC_WriteSecureAddress uint8 uiData uint16 uiAddress uint16 uiMspace 52 CIC_ErrorType uiCIC_EraseDFLASH void cceccceeeeeeeeceeeeeee scenes eae eeeeaeeseaeeseneeeseaeeesaeeseaeeseeneee 52 CIC_ErrorType uiCIC_WriteDFLASH_Wordline uint8 uilnputData uint16 uiWordlineBaseAdadr d et DE 53 CIC_ErrorType uiCIC_WriteEntireDFLASH uint8 uilnputData uint16 uiLength 0 cee 53 CIC
25. age 0xAA00 0x0000 O0x0080U Data returned will be 0x2C28 Read back the value of OTRHH uiCIC value uiCIC_ SPI SendMessage 0x0000 Ox80AA returned OTRHH address now in the upper byte Code Listing 2 Writing The ClIC61508 OTRH SFR To cause a write the data to write to the SFR is in the high byte and the address of the SFR is bit0 6 of the low byte However to cause the write bit 7 of the low byte is set i e Message DataToWrite lt lt 8 SFR address 0x80 This simple write system does not check whether the write was successful which is undesirable in a real system This will be addressed in a later example Using The ClC61508 SPI Interface 19 V1 0 2011 08 e PRO SIL Safety System hitex SAKCIC61508 SPI Interface DEVELOPMENT TOOLS 3 App1 amp App2 Message exchange with the CIC61508 This will give us a CIC61508 read function with error checking App is an intermediate step to App2 App1 creates the function CIC_ErrorType uiCIC_SPl_ReadSFR uint8 uiSFR_addr uint8 uiSFR_data which has a more usable API than just the simple uiCIC_SPl_SendMessage 0x0000 from Appo The new function reads a CIC SFR by sending the address of that SFR and the address of a variable in which to put the SFR value The operation is repeated so that the CIC will return the data from the first access This means that a single call to this function returns the data in the requested SFR This means tw
26. d and password but password was address were wrong wrong Send secure mode entry Report error Report error address 0xAB02 Complete read of X 0xF001 part 2 otherwise CIC will hang Return error status Figure 5 Entering Secure SPI Mode Using The ClC61508 SPI Interface 32 V1 0 2011 08 PRO SIL Safety System hitex Gs gegen oben SAKCIC61508 SPI Interface 7 3 First Steps In Secure SPI Mode Now we are in secure SPI mode we can try some things are that not possible in standard SPI mode The first thing to do is read the CRC8 of the CIC61508 internal ROM at location C 0x2FFF In the App6 main this is implemented using the basic uiCIC_SPI_SendMessage function Try to read CRC8 value from CIC61508 ROM at C 0x2FFF secure SPI mode READ function Send address in secure mode uiDummy uiCIC SPI SendMessage 0x2FFFU Throw away reply Send READ command Parameters READ Command CODE Memory Space amp 0x00FFU uiDummy uiCIC_SPI SendMessage 0x0000U 0x0008U amp OXxOOFFU Throw away reply Note dummy ought to contain Address previously sent Ox2FFF Send address in secure mode again This will cause the data requested above to be sent by CIC uiCIC_ value uiCIC_ SPI SendMessage 0x2FFFU Reply contains value at C 0x2FFF E For the SAKCIC61508 ROM device the returned value 0xDA This this the
27. d state or corrupted In both cases you will need to use either the TARDISS or PRO SIL TestBench tools to recover the situation Alternatively App9 or App10 of this document could be used 9 1 Erasing The DFLASH Erasing the DFLASH relies on the ClIC61508 s bootROM FLASH erase function but with a wrapper function accessed from the secure SPI mode The sequence of operations to erase the DFLASH are Enter secure SPI mode Send the base address of the DFLASH X 0xA000 Write the erase command Secure_WRITE Erase_DFLASH This is in reality 0x80 0x03 Wait for 102ms see CIC61508 Data Sheet Send the DFLASH base address again Send a read command of the CODE memory space This will get back any error status from the erase function Oe We This can be summarized as fe uiCIC_EraseDFLASH N function Declare Locals Send base address of DFLASH in secure mode Send Erase command using uiCIC_SPI_Se ndMessage Need to wait for at least 102ms to allow erase to complete before proceeding Wait while 102ms erase false timeout is in progress true Wait Send address in secure mode again Any error message generated by the CIC will be picked up here Send READ command again to keep CIC in sync Return error status after ERASE Figure8 Erase DFLASH Sequence From this flowchart the function CIC_ErrorType uiCIC_EraseDFL
28. device CRC8 Send READ command again to keep CIC61508 in sync uiDummy uiCIC_SPI_SendMessage 0x0000U 0x0008U amp Ox00FFU Code Listing 8 Reading the CIC61508 CRC8 at C 0x2FFF in secure SPI mode Using The CIC61508 SPI Interface 33 V1 0 2011 08 hitex DEVEL OPMENT TOOLS PRO SIL Safety System SAKCIC61508 SPI Interface To make a read in secure mode the messages required are Crh WN C uiCIC_ReadSecureAddress function Declare Locals Send address to read in secure mode using uiCIC_SPI_Se ndMessage Send READ command using uiCIC_SPI_Se ndMessage Send address to read in secure mode again Send READ command again to keep CIC in sync Figure 6 Return data read from address Read any address sequence Send 16bit address message 0x2FFF CIC61508 returns random data Send 16 bit READ command message that specifies which memory are the address is in CIC61508 returns 0x2FFF Send 16bit address message 0x2FFF again CIC61508 returns the value The secure mode READ command uses the lower byte of the 16 bit transmission to specify the memory space in which the address lies There are 3 memory spaces each with an unique memory space code Here we are reading the CODE space so the memory space code is 0x0008 Secure SPI Mode Commands define Secure WRITE 0x0080U define Secure READ 0x0000U de
29. errupt scheduled from here 13 1 3 CIC_ErrorType uiCIC_SPI_ReadSFR uint8 uiSFR_addr uint8 uiSFR_data Description Reads a CIC SFR by sending the address of that SFR and the address of a variable in which to put the SFR value The operation is repeated so that the CIC will return the data from the first access This means that a single call to this function returns the data in the requested SFR This means two accesses are required but it is more convenient for the caller details The format of the data returned by the CIC is checked to make sure that the SFR address is returned in the upper byte As two accesses are made to the CIC a delay is required to avoid going below the 75us inter character spacing limit Input Parameters uint8 uiSFR_addr address of CIC SFR to read uint8 uiSFR_data pointer to variable where SFR value should be placed Output Parameters None Return CIC_ErrorType error code Preconditions CIC61508 just powered up Post Conditions attention This checks the value of the upper byte returned by the CIC and if it is not the SFR address then an error is returned 13 1 4 CIC _ErrorType uiCIC_SPl_WriteSFR uint8 uiSFR_addr uint8 uiSFR_data Description Write a CIC61508 SFR in standard SPI mode Input Parameters uiSFR_addr Address of SFR Input Parameters uiSFR_data Value to write to SFR Output Parameters None Return Error status Preconditions None Using The ClC61508 SPI Interface 51 V1 0 2011 08 PRO SIL Sa
30. ess Shift data to write 8 places to left uint16 uiData lt lt 8U uiWriteData T Send WRITE command using uiCIC SPI SendMessage uiDummy uiCIC_ SPI SendMessage uiWriteData Secure WRIT uiMspace amp OXOOFFU Gl Read back byte just written using uiCIC_ ReadSecureAddress uiReadData uiCIC_ ReadSecureAddress uiAddress uiMspace amp Ox0OFFU Was the data read back the same as that written if uiReadData uiData Write was successful uiResult CIC_No Error else Error write failed uiResult CIC SecureWriteError Return error status return uiResult Code Listing 12 The uiCIC_WriteSecureAddress Function Using The ClC61508 SPI Interface 38 V1 0 2011 08 e PRO SIL Safety System hitex SAKCIC61508 SPI Interface DEVELOPMENT TOOLS Other forms of secure mode write cause specific actions One example is using the write to cause a CIC reset using the Reset CIC61508 action 0x07 Actions that are supported are Secure mode actions define Erase DFLASH 0x03U Erase the DFLASH define Program DFLASH 0x05U Program a wordline in the DFLASH define Jump Address 0x06U Cause the CIC to call an absolute address define Reset _CIC61508 0x07U Cause the CIC to RESET To send an action request the message is of the form uiCIC_ SPI SendMessage 0x0080 0x0007 i e
31. eters Input Parameters Input Parameters Output Parameters Return Preconditions Post Conditions attention Using The CIC61508 SPI Interface CIC_ Write the DFLASH with large block of data uilnputData Pointer to array contain data destined for DFLASH uiLength Length of data to write must be a multiple of 0x20 None Error status resulting from programming attempt None None CIC must already be in secure SPI mode ErrorType uiReset_CIC void Cause the CIC61508 to reset using new command None None None None Error status after operation None None CIC must be in secure SPI mode ErrorType uiReset_CIC_Immediate void Cause the CIC61508 to reset in standard SPI mode None None None None Error status after operation None None CIC must be in standard SPI mode Uses new WakeUp timer immediate reset command 53 V1 0 2011 08 e PRO SIL Safety System hitex SAKCIC61508 SPI Interface DEVELOPMENT TOOLS 13 1 13 uint16 uiCIC_SPI_FastWriteSFR uint8 uiSFR_addr uint8 uiSFR_data Description Write a CIC61508 SFR in standard SPI mode but with no read back or error checking Input Parameters uiSFR_addr Address of SFR Input Parameters uiSFR_data Value to write to SFR Output Parameters None Return Last data from SPI RX buffer Preconditions None Post Conditions None attention CIC must already be in standard SPI mode Using The ClC61508 SPI Interface 54 V1 0 2011 08 hitex DEVELOPMENT
32. example applications are now ready for use Using The CIC61508 SPI Interface 16 V1 0 2011 08 PRO SIL Safety System hi tex i gemeng ETT SAKCIC61508 SPI Interface 1 2 Running The Example Applications A line by line explanation of the examples is not provided in this document Instead it is recommended to load the examples into a TriCore debugger Project files for the HiTOP54 TC debugger are supplied as this is what is provided in the Hitex TC 1782 SafeTkit but other debuggers can be used The only requirement is that they can connect to the USB JTAG interface and load programs created using Tasking VX TriCore v3 5r1 The examples are fully commented so what they are doing should be clear Where there is a critical action or timing required this is highlighted and a flow chart is provided in the section devoted to that example application later on in this document For each application described in this document it is recommended to load the associated example application and single step to gain an appreciation of what is happening The operation of each significant function is described with a combination of code listings explanations and flowcharts 1 3 TC1782 Setup The 10 examples are based on the DaVE tool which provides the TC1782 configuration and sets up the SSCO and GPTAO for use in the SPI examples The TC1782 oscillator is 20MHz and the actual CPU frequency is 180MHz The Tasking standard TC1782 SFR header file is used
33. fety System hitex vo SAKCIC61508 SPI Interface DEVELOPMENT TOOLS Post Conditions None attention CIC must already be in standard SPI mode Does not check that write was successful 13 1 5 CIC _ErrorType uiCIC_SPI_EnterSecureMode void Description Put the ClIC61508 SFR into secure SPI mode Input Parameters None Input Parameters None Output Parameters None Return Error status after operation Preconditions None Post Conditions None attention CIC must be in standard SPI mode 13 1 6 uint16 uiCIC_ReadSecureAddress uint16 uiAddress uint16 uiMspace Description Reads byte from an address in CIC secure SPI mode Input Parameters uiAddress Address in CIC to read Input Parameters uiMspace Code specifying 8051 memory space to access Output Parameters None Return Word received from CIC via SPI Byte read is in LSB Preconditions None Post Conditions None attention CIC must already be in secure SPI mode Makes 4 accesses to SPI attention Needs to check that previous transmission was returned 13 1 7 CIC_ErrorType uiCIC_WriteSecureAddress uint8 uiData uint16 uiAddress uint16 uiMspace Description Writes a byte to an address in CIC secure SPI mode Input Parameters uiAddress Address in CIC to write Input Parameters uiMspace Code specifying 8051 memory space to access Output Parameters None Return Byte received from CIC via SPI Preconditions None Post Conditions None attention CIC must already be in secure SPI mode Make
34. fine CODE Ox08U define XDATA 0x04U define IDATA 0x02U Secure mode actions define Erase DFLASH 0x03U define Program DFLASH 0x05U define Jump Address 0x06U define Reset CIC61508 0x07 Code Listing 9 Cause the MIL Access code space C 0x000 Ox2FFF Access xda Access ida Erase the Program a Cause the Secure SPI Command Set ta space X 0xF000 OxFIFF ta space 1 0x0000 Ox00OFF DFLASH wordline in the DFLASH MIL to call an absolute address to RESET In reality we need a simple functions that will perform the necessary steps to read and write a secure mode address and this will be done in App7 that follows Using The CIC61508 SPI Interface 34 V1 0 2011 08 PRO SIL Safety System hi tex pi gemeng ETE SAKCIC61508 SPI Interface 8 App7 Using Secure SPI Mode Features Now we have the means to enter secure SPI mode and know how to read data we can create a simple function to read any address in any CIC61508 memory space We can then go on to create a function to write any address or invoke a secure SPI mode action reset jump erase DFLASH etc 8 1 CIC61508 Memory Spaces The ClC61508 has three memory spaces CODE C this is where the ClIC61508 ROM is located and the DFLASH calibration data area XDATA X this is where the CIC61508 stores non critical variables IDATA I This is where the ClIC6158 SFRs are located and other critical
35. h Using The CIC61508 SPI Interface 46 V1 0 2011 08 e PRO SIL Safety System hitex mmm SAKCIC61508 SPI Interface DEVELOPMENT TOOLS 10 1 Restoring Corrupted DFLASH App9 can be used to re programme corrupted DFLASH with a standard image that will function with PRO SIL TriCore To do this just load the App9 into the debugger reset the CIC61508 and run the program Using The ClC61508 SPI Interface 47 V1 0 2011 08 PRO SIL Safety System hi ELOPMEN TPN FE SAKCIC61508 SPI Interface 11 App10 Typical Usage Example The SAKCIC61508 is supplied with no data in the DFLASH This will cause it to go straight to the DISABLED mode at power up During the manufacture of a board containing the SAKCIC61508 the DFLASH must be programmed with a valid DFLASH calibration data set This dataset usually takes the form of a C const array produced as an export from the TARDISS NVM Tables menu as covered in App9 above This application is slightly different in that it checks for a valid data set in the DFLASH If the data is invalid then it proceeds to program the correct data set into the DFLASH automatically Check that the upper half of the DFLASH contents is the inverse of the lower half Set initial error status uiCIC_ DFLASH Error DFLASH Integrity OK Loop through all locations for uil 0x00 uiI lt DFLASH Length 2U uilt if uiDFLASH Image uilI uiDFLASH Image uil DFLASH Length 2U QOxFF
36. h for existing Eclipse projects Select root directory C CIC61508_SPI_Examples Select archive file Projects CIC_SPI_Examples_App0 C CIC61508_SPI_Examples CIC_SPI_E CIC_SPI_Examples_App1 C CIC61508_SPI_Examples CIC_SPLE CIC_SPI_Examples_App2 C C1C61508_SPI_Examples CIC_SPI_E CIC_SPI_Examples_App3 C CIC61508_SPI_Examples CIC_SPI_E CIC_SPI_Examples_App4 C CIC61508_SPI_Examples CIC_SPI_E CIC_SPI_Examples_App5 C CIC61508_SPI_Examples CIC_SPI_E CIC_SPI_Examples_App6 C C1061508_SPI_Examples CIC_SPI_E CIC_SPI_Examples_App7 C CIC61508_SPI_Examples CIC_SPLE _ SJ S S S S S S S D D Copy projects into workspace Working sets Add project to working sets Working sets Select The Eclipse project window will list all 11 projects Using The ClC61508 SPI Interface 15 V1 0 2011 08 hitex DEVELOPMENT TOOLS PRO SIL Safety System SAKCIC61508 SPI Interface File Edit Navigate Search Project Run Windov So HSla gary Si l x Ol Y v v gt CIC_SPI_Examples_App1 gt E CIC_SPI_Examples_App2 gt E CIC_SPI_Examples_App3 gt E CIC_SPI_Examples_App4 gt E CIC_SPI_Examples_App5 gt ES CIC_SPI_Examples_App6 gt ES CIC_SPI_Examples_App7 gt E CIC_SPI_Examples_App8 gt E CIC_SPI_Examples_App9 The
37. hart The format of the data returned by the CIC is checked to make sure that the SFR address is returned in the upper byte As two accesses are made to the CIC a delay is required to avoid going below the 75us inter character spacing limit It checks the value of the upper byte returned by the CIC and f it is not the SFR address then an error is returned Using The CIC61508 SPI Interface 21 V1 0 2011 08 e PRO SIL Safety System hitex SAKCIC61508 SPI Interface DEVELOPMENT TOOLS The parameters are uint8 uiSFR_addr address of CIC SFR to read uint8 uiSFR_data pointer to variable where SFR value should be placed It returns CIC_ErrorType error code This function relies on a simple timing loop in vCIC_InterMessageSpacing The effects of having the message pacing can be seen by running App2 Enable the real time watch window update and single step around this while a few times Make sure CIC_Status and uiC1IC61508_ERRORSYSTEM are in a watch window uiClIC61508 ERRORSYSTEM will 0x78 NOTREADY state and CIC_Status No_Error 0 Loop forever while 0x01U Read CIC61508 SFR at address 0x07 ERRORSYSTEM CIC Status uiCIC_ SPI ReadSFR 0x07 uint8 amp uiCIC61508 ERRORSYSTEM Now run at full speed After a few seconds press and hold down the CIC61508 reset button to prevent it replying The value of CIC_Status will change to CIC_Bad_Reply_Format and the value of uiC1IC61508_ER
38. hitex mmm DEVELOPMENT TOOLS SAKCIC61508 SPI Communications Examples Application Note Examples of how to use the standard and secure SPI modes to access SAKCIC61508 on chip resources plus using the DFLASH erase and programming features Released Using The CIC61508 SPI Interface V1 0 2011 08 Hitex Safety Solutions Edition 2011 08 Published by Hitex UK Ltd University Of Warwick Science Park Coventry UK 2015 Hitex UK Ltd All Rights Reserved Legal Disclaimer The information given in this document shall in no event be regarded as a guarantee of conditions or characteristics With respect to any examples or hints given herein any typical values stated herein and or any information regarding the application of the product Hitex UK Ltd hereby disclaims any and all warranties and liabilities of any kind including without limitation warranties of non infringement of intellectual property rights of any third party Information For further information on technology delivery terms and conditions and prices please contact the nearest Hitex Office www hitex com h itex PRO SIL Safety System SAKCIC61508 SPI Interface DEVELOPMENT TOOLS Document Change History Date Version Changed By Change Description 24 6 11 0 1 M Beach First version for external review 14 7 11 0 2 M Beach Authorising version 9 8 2011 1 0 M Beach Released version We Listen to Your Com
39. ilable again Loop until the bit transmission takes place Reset transmit interrupt request Do steps 3 to 6 and then go to 8 Check that the ClC61508 returned the SFR address in the top byte DOS Or Gr ee iN eS Clearly in a real application it would be much more convenient to just do Read CIC61508 SFR at address 0x2C SVER CIC Status uiCIC_SPI_ ReadSFR 0x2C uintl6 amp uiSFR value Thus where possible the steps to perform an action are placed into a single function Future examples can then make use of the earlier functions at will By developing a series of simple functions eventually we will be able to read and write any SFR enter secure SPI mode erase the DFLASH programme the DFLASH and reset the CIC61508 This after all it the whole basis of modular programming Using The ClC61508 SPI Interface 9 V1 0 2011 08 hitex DEVELOPMENT TOOLS PRO SIL Safety System SAKCIC61508 SPI Interface The 11 example applications are pre installed in the Eclipse IDE File Edit Navigate Search Project Run Win ry v ei e 63 e Di v CG e EI CC Navigator 7 DI C7 CIC_SPI_Examples_App0 C7 CIC_SPI_Examples_Appl C7 CIC_SPI_Examples_App10 C7 CIC_SPI_Examples_App2 C7 CIC_SPIExamples_App3 C7 CIC_SPI_Examples_App4 C7 CIC_SPI_Examples_App5 C7 CIC_SPI_Examples_App6 C7 CIC_SPIExamples_App7 Figure 1 Example Applications In Tasking Eclipse Each AppX project has a directory structure simi
40. lar to the one shown below EN Name Date modified J Dave 22 06 2011 11 47 J Debug 22 06 2011 14 16 J Debugger 22 06 2011 11 55 A include 22 06 2011 11 47 J Source 22 06 2011 11 47 _ cproject 22 06 2011 14 15 _ project 22 06 2011 11 46 F CIC_SPI_Examples_App0 Is 22 06 2011 11 46 _ CIC_SPI_Examples_App0 simulator launch 22 06 2011 11 46 cstart c 22 06 2011 11 46 cstart h 22 06 2011 11 46 DConfig 22 06 2011 11 46 L MConfig 22 06 2011 11 46 Type File folder File folder File folder File folder File folder CPROJECT File PROJECT File LSL File LAUNCH File C File H File File File Figure2 Example Application Directory Layout Using The CIC61508 SPI Interface 10 Size 35 KB 1 KB 4 KB 3 KB 39 KB 11 KB 1 KB 1 KB V1 0 2011 08 e PRO SIL Safety System hitex SAKCIC61508 SPI Interface DEVELOPMENT TOOLS The SOURCE directory contains a C module CIC_SPI_Examples_AppX C All the source code that communicates with the CIC61508 is place in here The module DAVE MAIN C simply acts as a caller and manages the top level sequence of operations The files CSTART C and CSTART H are generated by the Tasking Eclipse and take care of the TC1782 CPU initialization The LSL file tells the Tasking linker about the TC1782 memory map The MCONFIG and DCONFIG are again automatically generate by the tools and should not be altered by the user Using The ClC61508 SPI Interface 11 V1 0 2011 0
41. led on each interrupt so show that something is happening Using The ClC61508 SPI Interface 17 V1 0 2011 08 e PRO SIL Safety System hitex SAKCIC61508 SPI Interface DEVELOPMENT TOOLS 2 App0 Simple message exchange with the CIC61508 This is the simplest possible way to communicate with the CIC61508 The first step to establish contact with the CIC is to send a read SFR command At this early stage several steps are required to do this C Start D Wait while any previous transmissi on is in We are safe to try and transmit Reset transmit terrupt request J load transmit buffer register Is transmissi on buffer still unavaila ble true Wait Wait while transmissi false on is in progress true Wait Reset transmit interrupt request Message now sent Return data received The code written to implement this is in CIC_SPI_Examples_App0 C Itis called from MAIN C One important point about low level CIC SPI communications is that as a 16 bit SPI slave the CIC only emits its 16 bits of data when it receives data and that this data is sent in parallel to the transmission by the master TC1782 Thus the reply to any master transmission belongs to the previous message This means that to get the value of a particular SFR two read commands must be issued by the maste
42. ments Is there any information in this document that you feel is wrong unclear or missing Your feedback will help us to continuously improve the quality of this document Please send your comments including a reference to this document to comments hitex co uk lt Using The CIC61508 SPI Interface V1 0 2011 08 e PRO SIL Safety System hitex SAKCIC61508 SPI Interface DEVELOPMENT TOOLS Table of Contents Table of Contents 12 13 13 1 13 1 1 13 1 2 13 1 3 13 1 4 13 1 5 13 1 6 13 1 7 13 1 8 13 1 9 13 1 10 13 1 11 13 1 12 13 1 13 13 2 0n ara TA a E E EE 9 Installing The Example Applications cccceeeceeeeeenneeeeeeneeeeeeaeeeeeeaaeeeeeeaaeeeseeaaeeeeeeaaeeeseeaeeeesenaees 12 Importing The Examples Into Tasking Eclipse cece ceeeneee eect ee eeeeaeeeeeeaaeeeeeeaaeeeseeaaeeeeneaeeeeeeaas 13 Running The Example Applications sresrrerseiriroceiseenoinivenneeiar vneta riranin E EAKA N iE AEEA 17 TG1 82 SOtUp EE 17 IERT le EE 17 GPT Rei elle TE e EE 17 App0 Simple message exchange with the CIC61508 csseccsseceseseeesseeeeseeeeeeeeesseesesnenenseeees 18 App1 amp App2 Message exchange with the CIC61508 ccsssssseesssnsseenseeesseessessnesseeeseneeenes 20 App3 Practicable message exchange with the CIC61508 csssseceeseseeeeesseeeeeeseeeeneeseeseees 23 Providing A SPI Message Timebase AA 23 Further Refinement Of SPI Driver 25 App4 Adding a SFR WRITE
43. o accesses are required but it is more convenient for the caller In reality the function will only work if it is single stepped in a debugger As the function uiCIC_SendMessage is very simple and contains no message pacing the SPI messages sent to the CIC61508 would be spaced every19us This illegal as the ClIC61508 only accepts SPI messages on a 75us timebase i e 75us between message starts You can see the effects of not having this message separation by running App in a debugger as follows Single step main up until the while 1 loop Make sure that the variable uiCIC61508_ ERRORSYSTEM is ina watch window and that the real time updates are enabled Now run at full speed iClIC61508 ERRORSYSTEM will change to 0x2D DISABLED state This is because the SSC will be sending messages every 18 19us This is too fast for the ClIC61508 and it will go to DISABLED state The minimum time permitted between messages is 75us so some sort of pacing mechanism will be required App2 adds this pacing Loop forever while 0x01U Read CIC61508 SFR at address 0x07 ERRORSYSTEM uiCIC SPI ReadSFR 0x07 uint8 amp ulCIC61508 ERRORSYSTEM Code Listing 3 Continually read the ERRORSYSTEM SFR Using The ClC61508 SPI Interface 20 V1 0 2011 08 e PRO SIL Safety System hitex SAKCIC61508 SPI Interface DEVELOPMENT TOOLS 9 function We are safe to try and transmit Declare locals Reset transmit interrup
44. plications Table 1 Troubleshooting Symptom Cause Workaround CIC61508 SPI read functions CIC61508 not running always return OxFF 2k2 pull resistor not fitted to CIC61508 MRST pin CIC61508 SPI functions report ClC61508 in standard SPI mode when secure SPI mode commands errors are sent CIC61508 in secure SPI mode when standard SPI mode commands are sent CIC61508 is always in It is likely that the DFLASH has been erased or corrupted Run App10 DISABLED mode to restore it Using The ClC61508 SPI Interface 50 V1 0 2011 08 PRO SIL Safety System hi tex pi gemeng ETE SAKCIC61508 SPI Interface 13 Appendices 13 1 Appendix 1 CIC61508 SPI Functions All the functions in the Hitex CIC61508 SPI driver library are listed here along with a brief description 13 1 1 uint16 uiCIC_SPI_SendMessage uint16 uiTx_data Description Lowest level SPI driver Sends 16bit pattern to CIC via SPI Input Parameters uiTx_data Word to send via SPI Output Parameters None Return Word received from CIC via SPI Data is the reply to the preceding message Preconditions None Post Conditions None attention None 13 1 2 void vCIC_SPI_Driver void Description SPI driver to generate chipselect and drive SPI peripheral Input Parameters None Output Parameters None Return None Preconditions None Post Conditions None attention Called from SPI transmission timebase interrupt gt 75us off GPTAO LTCO1 Next 75us int
45. r The first one sends the address of the SFR to read while the second one sends the same data but importantly the reply to this message contains the actual SFR contents The first reply is simply discarded This is illustrated in App Using The ClC61508 SPI Interface 18 V1 0 2011 08 e PRO SIL Safety System hitex SAKCIC61508 SPI Interface DEVELOPMENT TOOLS Read CIC61508 SFR at address 0x2C SVER uiCIC value uiCIC_ SPI SendMessage 0x002C 0x5555 returned Read CIC61508 SFR at address 0x2C SVER uiCIC value uiCIC_ SPI SendMessage 0x002C Data returned will be 0x2C28 Code Listing 1 Reading The CIC61508 SVER SFR In this code fragment the address of the SVER SFR 0x2C is sent as the low byte of the 16 bit message As the CIC is assumed to have just powered up the first reply it always sends is Ox5555 Sending the address of the SVER a second time results in the CIC sending back the contents of the SVER as the low byte and the address of the SVER previously sent as the high byte In more advanced examples this high byte is compared with the SFR address to detect possible errors Here we just take the data as received To write a CIC SFR the process is slightly different Continuing on directly from the first code fragment we will attempt a write to the OTRHH SFR whose address is 0x00 Write OxAA to OTRHH SFR at location 0x00 in CIC61508 uiCIC value uiCIC_ SPI SendMess
46. rather than the DAVE generated one This makes the functions developed in the examples more easily transferrable to PRO SIL applications 1 3 1 SSCO Configuration fractional divider mode required baud rate 1500000 baud SSCO master mode transfer data width is 16 bit transfer receive LSB first shift transmit data on the leading clock edge latch on trailing edge idle clock line is low leading clock edge is low to high transition check receive error is enabled check phase error is enabled ignore receive parity errors parity transmit enable bit is disabled parity receive enable bit is disabled even parity is selected P3 6 is used as SSCO slave select output signal 1 SLSO01 slave output select leading delay 3 SCLK periods slave output select trailing delay 2 SCLK periods slave output select inactive delay 3 SCLK periods P3 2 is used as SSCO clock output signal SCLKO P3 4 is used as SSCO master transmit slave receive output signal MTSRO P3 3 is used as SSCO master receive slave transmit input signal MRSTO 1 3 2 GPTAO Configuration The basic GPTAO clock is 51 24 MHz which is divided down by 128 by the LTC prescaler to give a timebase of 2 5us count 4MHz LTCO00 is used as a free running timer and LTC01 is configured as a compare register able to generate an interrupt on SRN22 The period of the interrupt is set by the SPI handler interrupt which is called from this SRN The blue LED on TC1782 Port 5 0 is togg
47. s 4 accesses to SPI attention Needs to check that previous transmission was returned 13 1 8 CIC_ErrorType uiCIC_EraseDFLASH void Description Erases the entire CIC61508 DFLASH Input Parameters None Output Parameters None Return Error status resulting from ERASE attempt Preconditions None Post Conditions None attention CIC must already be in secure SPI mode Using The ClC61508 SPI Interface 52 V1 0 2011 08 hitex PRO SIL Safety System SAKCIC61508 SPI Interface DEVELOPMENT TOOLS 13 1 9 CIC_ErrorType uiCIC_WriteDFLASH_Wordline uint8 uilnputData uint16 uiWordlineBaseAddr uint16 uiOffset Description Write a wordline in the ClIC61508 DFLASH Input Parameters Input Parameters Input Parameters Output Parameters Return Preconditions Post Conditions attention 13 1 10 CC uilnputData Pointer to array contain wordline data uiWordlineBaseAddr Base address of the DFLASH uiOffset Offset of the current wordline in multiples of 0x20 None Error status resulting from programming attempt None None CIC must already be in secure SPI mode ErrorType uiCIC_WriteEntireDFLASH uint8 uilnputData uint16 uiLength Description Input Parameters Input Parameters Output Parameters Return Preconditions Post Conditions attention 13 1 11 Description Input Parameters Input Parameters Input Parameters Output Parameters Return Preconditions Post Conditions attention 13 1 12 CC Description Input Param
48. spects of CIC61508 operation so this function will be added to considerably 4 1 1 Further Refinement Of SPI Driver The CIC_SPI_Driver function here is quite simplistic in that it waits for the SPI transmission to complete before proceeding to read the received data from the CIC61508 In a real system the reading of the CIC returned data could be done in an additional case that is scheduled around 25us after the transmission is begun Alternatively the SSC RX interrupt could be enabled and the loading of data between the receive and transmit buffers to the globals uiSPI_Tx_data and uiSPI_Tx_data could be made there However for the sake of clarity these have not been implemented in the example Using The ClC61508 SPI Interface 25 V1 0 2011 08 PRO SIL Safety System hii LOPMEN TP SOLI SAKCIC61508 SPI Interface 5 App4 Adding a SFR WRITE function To write to a CIC61508 SFR requires bit7 of the low byte sent to be set The data returned by the CIC contains the address of the SFR in the high byte This needs to be checked Thus two transactions per write are needed as with the proper SFR read function developed in App3 and App4 above uiCIC_SPI_ReadSFR A complication with the write function is that unlike READ the actual update of the SFR can take up to 600us to complete This is because internally the CIC61508 only checks for new write messages every 600us lt SPI Write Received Write To SFR completed CIC6150
49. t request a uiCIC_SPI_ReadSFR Initialise error status load transmit buffer register Wait for any i previous Wait for transmissi transmissi on to on buffer complete to be available again true Wait true oo Wait We are safe to try and transmit Reset transmit interrupt for request transmissi on to y complete load transmit true buffer register Wait Wait for transmissi ness on buffer i sent to be available again Reset Tx true interrupt request Capture SFR value from SSC into a global variable transmissi on to complete i Write the SFR Erue data to 4 caller s Wait variable t Message now Check that sent SFR address is in high byte of reply from CIC Data returned by CIC not used true CIC did not return the address in the Wait for around 60us to prevent CIC overload required position Send SFR address again Wait for around to get data 60us to prevent from first CIC overload attempt This stops the next call causing transmission too soon Return error status Always OK in this example Figure3 uiCIC_SPI_ReadSFR Flowc
50. t array one wordline 0x20 at a time Write the next wordline of data to DFLASH Return error status Figure 10 Breaking up the 0x1000 DFLASH image into 32 byte wordlines for programming It is called as per Program the image array back into DFLASH CIC Status uiCIC WriteEntireDFLASH uiDFLASH Image DFLASH Length As a confidence check the second location of the DFLASH is read to make sure it contains something other than 0x00 the value returned by an erased DFLASH In most cases the second DFLASH byte is OxF8 Read a DFLASH location should return OxF8 uiTestValue uiCIC_ReadSecureAddress DFLASH Base Addr 1 CODE lt 9 3 Exiting Secure SPI Mode After DFLASH Reprogramming After reprogramming the CIC61508 will still be in secure SPI mode To get back to standard SPI mode a Reset action command must be sent If the SYSDIS_C LED on the board is not illuminated after this then a problem has occurred during programming To fix this you will need to use the TARDISS or PRO SIL TestBench tools to restore the DFLASH contents If you are using a FLASH CIC61508 the CIC61508 hex file included in the ClC61508 directory can be blown into FLASH using the FLOAD programmer Alternatively you can use the final example App9 to program a DFLASH image held in the TC 1782 ROM into the CIC61508 DFLASH Using The ClC61508 SPI Interface 45 V1 0 2011 08 e PRO SIL
51. tain separate Tasking Eclipse projects These need to be imported into Eclipse before we can make use of them Using The ClC61508 SPI Interface 12 V1 0 2011 08 e PRO SIL Safety System hitex mm SAKCIC61508 SPI Interface DEVELOPMENT TOOLS 1 1 1 Importing The Examples Into Tasking Eclipse Start the Tasking Eclipse When prompted for a workspace location browse for the directory just created by the installer Select a workspace TASKING VX toolset for TriCore and PCP v3 5rl stores your projects in a folder called a workspace Choose a workspace folder to use for this session IC CIC61508_SPI_Examples e Browse Use this as the default and do not ask again File Edit Navigate Search Project Run Window Help Gr Gr iy amp My By G By GA KEE EECH STETA Se Outline 7 8 m An outline is not available EL Problems E Console E Properties Location 1D Using The CIC61508 SPI Interface 13 V1 0 2011 08 e PRO SIL Safety System hitex aa SAKCIC61508 SPI Interface DEVELOPMENT TOOLS Next we need to import the 11 example applications This is done by choosing File Import J TASKING C C TASKING VX toolset for TriCore an File Edit Navigate Search Project Run Windoy Open File Close Ctrl W Close All Ctrl Shift W Save Ctrl S Save As Save All Ctrl Shift S Revert Move Rename Refresh Con
52. uiCIC_ SPI SendMessage Secure WRITE Reset _CIC61508 Code Listing 13 Cause A CIC61508 Reset In reality this would appear as Cause a CIC61508 reset Send dummy address uiCIC_ SPI SendMessage 0x0000U Send a reset command uiCIC SPI SendMessage Secure WRITE Reset CIC61508 Wait for CIC to restart Code Listing 14 Causing CIC61508 Reset The reset command will cause the CIC61508 to behave as it does at power on This means that it will run all its startup self tests This takes up to 60ms to complete Any attempt to communicate with the CIC during this time will get a reply of NEE This is because it MRST pin is inactive and floating high The SYSDIS LEDs on the board will blink once as the CIC restarts Once this has completed the CIC61508 will be back in standard SPI mode The 60ms reset delay will be incorporated into the CIC_SPI_Driver interrupt function in the next example along with a proper CIC61508 reset function Hitex UK Using The ClC61508 SPI Interface 39 V1 0 2011 08 e PRO SIL Safety System hi tex ng gemeng EE SAKCIC61508 SPI Interface 9 Apps Erasing And Programming The DFLASH This example adds the ability to read the entire DFLASH into a RAM array erase the DFLASH and re program the array contents back again It also shows standard and secure SPI mode reset commands Note if this example fails it is likely that the DFLASH in your ClIC61508 will be left in an erase
53. up the 0x1000 DFLASH image into 32 byte wordlines for programming 45 Figure 11 PRO SIL TestBench NVM Tables Tab 46 Figure 12 Real Application Example Programming Corrupted Or Blank DEL AGH seeseeeeeeeseeeeeeeen 49 Using The ClC61508 SPI Interface 5 V1 0 2011 08 e PRO SIL Safety System hitex mmm SAKCIC61508 SPI Interface DEVELOPMENT TOOLS List of Tables List of Tables Table 1 Breif ln BEE 50 Table 2 ROM Requirement For SPI Functions cccccessceceeseeeceeeaeeeseeeaeeeceeeaeeessesaeeeseesaeeeseeaeeessenaeeeeneaas 55 Using The ClC61508 SPI Interface 6 V1 0 2011 08 hitex OPMENT TOOLS DEVEL PRO SIL Safety System SAKCIC61508 SPI Interface List of Code Listings List of Code Listings Code Listing 1 Code Listing 2 Code Listing 3 Code Listing 4 Code Listing 5 Code Listing 6 Code Listing 7 Code Listing 8 Code Listing 9 Code Listing 10 Code Listing 11 Code Listing 12 Code Listing 13 Code Listing 14 Code Listing 15 Code Listing 16 Code Listing 17 Code Listing 18 Code Listing 19 Using The ClC61508 SPI Interface 7 Reading The CIC61508 SVER GER 19 Writing The CIC61508 OTRH SER A 19 Continually read the ERRORSYSTEM SFR ssesssesseesssesresrsssrnesrnsrnsrnssrnssrnssrnssrnssrnnstnnsnnnnnn 20 CIC_SPI_Driver Interrupt Provides Message Timebasee 24 Beginning a SPI tranSMiSSion icssccciseseccessetetets es ceuesiadeesstussecausasvdvedeeatcaevsacevedsts vestevierevedtteesnieass 25 System T
54. upt Provides Message Timebase When the SPI interface is not in use the variable CIC_SPI_state has the value 0x00 typedef enum CS_Idle To begin a transmission sequence the uiCIC_SPl_ReadSFR function sets it equal to Start_SPl_ Transmission Using The ClC61508 SPI Interface 24 V1 0 2011 08 e PRO SIL Safety System hitex SAKCIC61508 SPI Interface DEVELOPMENT TOOLS Load Tx variable with SFR address uiSPI Tx data uintl6 uiSFR addr CIC_SPI_ state Start SPI Transmission Code Listing 5 Beginning a SPI transmission Within 75us the LTC01 interrupt will occur and the case Start_SPI_Transmission will execute This case schedules the next interrupt 75us later by adding the number of LTCOO counts in 75us to the current LTCO1 value As the GPTAO_LTC clock is 2 5us count 30 x 2 5 75us Thus we just need to add another 30 counts to create the next 75us tick The state is changed to CS_lIdle allowing the uiCIC_SPl_ReadSFR to continue However as the next interrupt is 75us in the future any further transmissions will not be auctioned immediately Thus the 75us message spacing demanded by the CIC61508 is maintained Wait for transmission to complete next 75us interrupt while CIC SPI state CS Idle Wait The CS_Idle state continues with the interrupt being rescheduled for 75us spacing until the next transmission is requested In the later examples timeouts are required for other a
55. vert Line Delimiters To Print Ctrl P Switch Workspace D Alt Enter Select Choose import source Select an import source type filter text a General Archive File i Existing Projects into Workspace G File System E Preferences gt amp C C gt LG Run Debug gt TASKING C C gt amp Team Then click Next and then the ClIC61508_SPI_Examles directory Using The ClC61508 SPI Interface 14 V1 0 2011 08 e PRO SIL Safety System hitex ven SAKCIC61508 SPI Interface DEVELOPMENT TOOLS i SS Dien w Je8 SI Elsen Import Projects n R Select a directory to search for existing Eclipse projects DIS Outline XN ml a An outline is not available WEE Select archive file Browse Projects Select root directory of the projects to import gt A MSSETUP T gt J 29fb3cc78709beff774c gt J ab24cd6b5fa9caf198ec210e Copy projects into workspace Working sets Add project to working sets gt J Admin p a cSldev gt J c166dev 4 1 C1C61508_SPI_ Examples Working set Folder CIC61508_SPI_Examples sien Fae CD Gea men eem Location Click OK and Eclipse will list all 10 example applications with the select boxes ticked As we want all the applications just click finish Le Omo e nr k Import Projects Select a directory to searc
56. viously read DFLASH contents back into the CIC61508 This covered in the next section Using The ClC61508 SPI Interface 42 V1 0 2011 08 PRO SIL Safety System hi tex ein gemeng TETEP SAKCIC61508 SPI Interface 9 2 Programming The DFLASH Programming of the DFLASH relies on the CIC61508 s bootROM FLASH programming function but with a wrapper function accessed from the secure SPI mode The CIC61508 DFLASH is arranges in wordlines of length 32 bytes This represents the smallest programmable area Thus to program the entire 0x1000 bytes of the DFLASH we have to break it into chunks of length 0x20 At the lowest level the bytes in the wordline are sent one by one as part of a write to CODE space command The programme wordline sequence is Get the first byte of the next wordline from an array Move it to the high byte of the message OR in the WRITE to CODE command to make a 16 bit value Send base address current wordline Send programme DFLASH command Send the 16 value composed of lt data gt lt write CODE gt Repeat from step 1 another 31 times until all wordline bytes have been sent Wait 2 6ms for programming to complete see ClC61508 Data Sheet Make a dummy read to see if any programming errors have been reported by the ClC61508 10 Add 0x20 to the wordline base address 11 Get the next wordline 12 Go back to step 1 WON ANMARWNE As with the erase function two extra cases have been added to the CIC_SPI_Driver
Download Pdf Manuals
Related Search
Related Contents
取扱説明書 Manual de Usuario Constructor de sitios A B C D E I F G H c b a J D-Link K 3xRouter EN ADSL 4p 10 100Mbps Switch Copyright © All rights reserved.
Failed to retrieve file