Macros | Functions | Variables
JTAGfunc430FR.c File Reference

Detailed Description

JTAG Control Sequences for Erasing / Programming / Fuse Programming.

Definition in file JTAGfunc430FR.c.

#include "LowLevelFunc430Xv2.h"
#include "JTAGfunc430FR.h"
#include "FramErase.c"
#include "FramWrite.c"
#include "msp430CodeFR57_6xx.h"
Include dependency graph for JTAGfunc430FR.c:

Go to the source code of this file.

Macros

#define SAFE_FRAM_PC   0x0004
 
#define FR4xx_LOCKREGISTER   0x160
 

Functions

short i_WriteJmbIn32 (unsigned short dataX, unsigned short dataY)
 Write a 32bit value into the JTAG mailbox system. The function timeouts if the mailbox is not empty after a certain number of retries. More...
 
word VerifyPSA_430Xv2 (unsigned long StartAddr, unsigned long Length, unsigned short const *DataArray)
 This function compares the computed PSA (Pseudo Signature Analysis) value to the PSA value shifted out from the target device. It is used for very fast data block write or erasure verification. More...
 
void configure_IO_JTAG (void)
 Set JTAG pins to output direction - from REP430F to target. More...
 
word UnlockDevice_430Xv2 (unsigned short *password, unsigned long passwordLength)
 This function unlocks the Fram memory when a JTAG password is set. More...
 
word GetCoreipIdXv2 ()
 Function to determine & compare core identification info (Xv2) More...
 
word GetDevice_430Xv2 (void)
 Function to take target device under JTAG control. Disables the target watchdog. Sets the global DEVICE variable as read from the target device. More...
 
void ReleaseDevice_430Xv2 (unsigned long Addr)
 Function to release the target device from JTAG control. More...
 
void WriteMem_430Xv2 (word Format, unsigned long Addr, word Data)
 This function writes one byte/word at a given address ( <0xA00) More...
 
void WriteMemQuick_430Xv2 (unsigned long StartAddr, unsigned long Length, unsigned short const *DataArray)
 This function writes an array of words into the target memory. More...
 
short WriteFram_430Xv2 (unsigned long StartAddr, unsigned long Length, unsigned short const *DataArray)
 This function programs/verifies an array of words into the Fram memory. More...
 
short DownloadProgram (struct_Program *program)
 DownloadFile Load program data int memory sections. More...
 
short DownloadMsp430Code ()
 Download a program to target. More...
 
word ReadMem_430Xv2 (word Format, unsigned long Addr)
 This function reads one byte/word from a given address in memory. More...
 
void ReadMemQuick_430Xv2 (unsigned long StartAddr, unsigned long Length, word *DataArray)
 This function reads an array of words from the memory. More...
 
void EraseFRAM_430Xv2 (unsigned long EraseAddr, unsigned long Length)
 This function performs an erase of a user defined FRAM memory section. For FRAM devices the erase equals a write operation of 0xFFFF to the respective memory section. (Could be extended with erase check via PSA) This function should be used for "segment erases" only. For a "mass erase", consider using EraseFRAMViaBootCode_430Xv2 instead. More...
 
word EraseCheck_430Xv2 (unsigned long StartAddr, unsigned long Length)
 This function performs an Erase Check over the given memory range. More...
 
word VerifyMem_430Xv2 (unsigned long StartAddr, unsigned long Length, unsigned short const *DataArray)
 This function performs a Verification over the given memory range. More...
 
word ProgramLockKey (void)
 This function blows the security fuse. More...
 
word IsLockKeyProgrammed (void)
 This function checks if the JTAG lock key is programmed. More...
 
word DisableMpu_430Xv2 (void)
 This function disables the Memory Protection Unit (FRAM devices only) More...
 
void UnlockBsl_430Xv2FRAM (void)
 This function unlocks the BSL memory protection. More...
 
word EraseFRAMViaBootCode_430Xv2 (word mailBoxMode, word data1, word data2)
 This function performs a Erase of FRxx devices using the JTAG mailbox. More...
 

Variables

byte tdo_bit
 Holds the value of TDO-bit. More...
 
byte TCLK_saved
 Holds the last value of TCLK before entering a JTAG sequence. More...
 
struct_Program prog
 Executable code and meta data about downloaded program. More...
 

Function Documentation

void configure_IO_JTAG ( void  )

Set JTAG pins to output direction - from REP430F to target.

Definition at line 593 of file LowLevelFunc430Xv2.c.

word DisableMpu_430Xv2 ( void  )

This function disables the Memory Protection Unit (FRAM devices only)

Returns
word (STATUS_OK if MPU was disabled successfully, STATUS_ERROR otherwise)

Definition at line 1447 of file JTAGfunc430FR.c.

Here is the call graph for this function:

short DownloadMsp430Code ( )

Download a program to target.

Returns
received error of called funtion

Definition at line 1243 of file JTAGfunc430FR.c.

Here is the call graph for this function:

short DownloadProgram ( struct_Program program)

DownloadFile Load program data int memory sections.

Parameters
[in]programStructure containing executable code and meta data
Returns
word (STATUS_OK if verification was successful, STATUS_ERROR otherwise)

Definition at line 1176 of file JTAGfunc430FR.c.

Here is the call graph for this function:

word EraseCheck_430Xv2 ( unsigned long  StartAddr,
unsigned long  Length 
)

This function performs an Erase Check over the given memory range.

Parameters
[in]wordStartAddr (Start address of memory to be checked)
[in]wordLength (Number of words to be checked)
Returns
word (STATUS_OK if erase check was successful, STATUS_ERROR otherwise)

Definition at line 1386 of file JTAGfunc430FR.c.

Here is the call graph for this function:

void EraseFRAM_430Xv2 ( unsigned long  EraseAddr,
unsigned long  Length 
)

This function performs an erase of a user defined FRAM memory section. For FRAM devices the erase equals a write operation of 0xFFFF to the respective memory section. (Could be extended with erase check via PSA) This function should be used for "segment erases" only. For a "mass erase", consider using EraseFRAMViaBootCode_430Xv2 instead.

Parameters
[in]wordStartAddr (start address for the erase)
[in]wordLength (length of the memory section in WORDS)

Definition at line 1340 of file JTAGfunc430FR.c.

Here is the call graph for this function:

word EraseFRAMViaBootCode_430Xv2 ( word  mailBoxMode,
word  data1,
word  data2 
)

This function performs a Erase of FRxx devices using the JTAG mailbox.

Parameters
[in]wordmailBoxMode 32Bit 16Bit mode
[in]worddata1 mailbox data - first 16BIT
[in]worddata2 mailbox data - second 16BIT
Returns
word (STATUS_OK if erase was successful, STATUS_ERROR otherwise)

Definition at line 1552 of file JTAGfunc430FR.c.

Here is the call graph for this function:

word GetCoreipIdXv2 ( )

Function to determine & compare core identification info (Xv2)

Returns
word (STATUS_OK if correct JTAG ID was returned, STATUS_ERROR otherwise)

Definition at line 930 of file JTAGfunc430FR.c.

word GetDevice_430Xv2 ( void  )

Function to take target device under JTAG control. Disables the target watchdog. Sets the global DEVICE variable as read from the target device.

Returns
word (STATUS_ERROR if fuse is blown, incorrect JTAG ID or synchronizing time-out; STATUS_OK otherwise)

Definition at line 986 of file JTAGfunc430FR.c.

Here is the call graph for this function:

short i_WriteJmbIn32 ( unsigned short  dataX,
unsigned short  dataY 
)

Write a 32bit value into the JTAG mailbox system. The function timeouts if the mailbox is not empty after a certain number of retries.

Parameters
[in]worddataX (data to be shifted into mailbox)
[in]worddataY (data to be shifted into mailbox)

Definition at line 422 of file JTAGfunc430FR.c.

word IsLockKeyProgrammed ( void  )

This function checks if the JTAG lock key is programmed.

Returns
word (STATUS_OK if fuse is blown, STATUS_ERROR otherwise)

Definition at line 1426 of file JTAGfunc430FR.c.

word ProgramLockKey ( void  )

This function blows the security fuse.

Returns
word (TRUE if fuse blow was successful, FALSE otherwise)

Definition at line 1406 of file JTAGfunc430FR.c.

Here is the call graph for this function:

word ReadMem_430Xv2 ( word  Format,
unsigned long  Addr 
)

This function reads one byte/word from a given address in memory.

Parameters
[in]wordFormat (F_BYTE or F_WORD)
[in]wordAddr (address of memory)
Returns
word (content of the addressed memory location)

Definition at line 1260 of file JTAGfunc430FR.c.

Here is the call graph for this function:

void ReadMemQuick_430Xv2 ( unsigned long  StartAddr,
unsigned long  Length,
word *  DataArray 
)

This function reads an array of words from the memory.

Parameters
[in]wordStartAddr (Start address of memory to be read)
[in]wordLength (Number of words to be read)
[out]word*DataArray (Pointer to array for the data)

Definition at line 1300 of file JTAGfunc430FR.c.

void ReleaseDevice_430Xv2 ( unsigned long  Addr)

Function to release the target device from JTAG control.

Parameters
[in]wordAddr (0xFFFE: Perform Reset, means Load Reset Vector into PC, otherwise: Load Addr into PC)

Definition at line 1015 of file JTAGfunc430FR.c.

Here is the call graph for this function:

void UnlockBsl_430Xv2FRAM ( void  )

This function unlocks the BSL memory protection.

Definition at line 1530 of file JTAGfunc430FR.c.

Here is the call graph for this function:

word UnlockDevice_430Xv2 ( unsigned short *  password,
unsigned long  passwordLength 
)

This function unlocks the Fram memory when a JTAG password is set.

Parameters
[in]unsignedshort* password (Pointer to array containing the JTAG Password)
[in]unsignedlong passwordLength (length of the password in words)
Returns
word (STATUS_OK if memory unlock was successful, STATUS_ERROR otherwise)

Definition at line 802 of file JTAGfunc430FR.c.

Here is the call graph for this function:

word VerifyMem_430Xv2 ( unsigned long  StartAddr,
unsigned long  Length,
unsigned short const *  DataArray 
)

This function performs a Verification over the given memory range.

Parameters
[in]wordStartAddr (Start address of memory to be verified)
[in]wordLength (Number of words to be verified)
[in]word*DataArray (Pointer to array with the data)
Returns
word (STATUS_OK if verification was successful, STATUS_ERROR otherwise)

Definition at line 1398 of file JTAGfunc430FR.c.

Here is the call graph for this function:

word VerifyPSA_430Xv2 ( unsigned long  StartAddr,
unsigned long  Length,
unsigned short const *  DataArray 
)

This function compares the computed PSA (Pseudo Signature Analysis) value to the PSA value shifted out from the target device. It is used for very fast data block write or erasure verification.

Parameters
[in]unsignedlong StartAddr (Start address of data block to be checked)
[in]unsignedlong Length (Number of words within data block)
[in]word*DataArray (Pointer to array with the data, 0 for Erase Check)
Returns
word (STATUS_OK if comparison was successful, STATUS_ERROR otherwise)

Definition at line 461 of file JTAGfunc430FR.c.

short WriteFram_430Xv2 ( unsigned long  StartAddr,
unsigned long  Length,
unsigned short const *  DataArray 
)

This function programs/verifies an array of words into the Fram memory.

Parameters
[in]wordStartAddr (Start address of Fram memory)
[in]wordLength (Number of words to be programmed)
[in]word*DataArray (Pointer to array with the data)

Definition at line 1109 of file JTAGfunc430FR.c.

Here is the call graph for this function:

void WriteMem_430Xv2 ( word  Format,
unsigned long  Addr,
word  Data 
)

This function writes one byte/word at a given address ( <0xA00)

Parameters
[in]wordFormat (F_BYTE or F_WORD)
[in]wordAddr (Address of data to be written)
[in]wordData (shifted data)

Definition at line 1053 of file JTAGfunc430FR.c.

void WriteMemQuick_430Xv2 ( unsigned long  StartAddr,
unsigned long  Length,
unsigned short const *  DataArray 
)

This function writes an array of words into the target memory.

Parameters
[in]wordStartAddr (Start address of target memory)
[in]wordLength (Number of words to be programmed)
[in]word*DataArray (Pointer to array with the data)

Definition at line 1092 of file JTAGfunc430FR.c.

Here is the call graph for this function:

Variable Documentation

Executable code and meta data about downloaded program.

Definition at line 1239 of file JTAGfunc430FR.c.

byte TCLK_saved

Holds the last value of TCLK before entering a JTAG sequence.

Definition at line 77 of file LowLevelFunc430Xv2.c.

byte tdo_bit

Holds the value of TDO-bit.

Definition at line 75 of file LowLevelFunc430Xv2.c.


Copyright 2016, Texas Instruments Incorporated