beautypg.com

1 in-application programm, 1 in-application programming functions -3, Maxq7667 user’s guide – Maxim Integrated MAXQ7667 User Manual

Page 309: 1 in-application programming functions

background image

18-3

__________________________________________________________________________________________________________

MAXQ7667 User’s Guide

18.1 In-Application Programming Functions

Function:

flashWrite

Summary:

Write a word to the flash block (program memory).

Inputs:

A[0]: Word address in main flash block to write to.

A[1]: Word value to write to flash block.

Outputs:

Carry: Set on error and cleared on success. If set, then A[0] contains one of the following error codes:

1: Failure due to software timeout.

2: Failure reported by hardware (DQ5).

Destroys:

PSF, LC[1]

Notes:

1) If the watchdog reset is enabled, user code should disable it before calling this function. Also, disable interrupts globally (IGE = 0).

2) If the flash location has already been programmed to a non-FFFF (hex) value, this function returns with an error (Carry set). To repro-

gram a flash sector, it must first be erased by calling flashErasePage or flashEraseAll.

Function:

flashErasePage

Summary:

Erases one page, 256 words, in the flash block ( program memory).

Inputs:

A[0]: Word address located in the page to be erased.

Outputs:

Carry: Set on error and cleared on success. If set, then A[0] contains one of the following error codes:

1: Failure due to software timeout.

2: Failure reported by hardware (DQ5).

3: Failure due to trying to erase current page.

Destroys:

PSF, LC[1], GR, AP, APC (AP = APC = 0)

Notes:

1) If the watchdog reset is enabled, user code should disable it before calling this function. Also, disable interrupts globally (IGE = 0).

Function:

flashEraseAll

Summary:

Erases the entire flash block.

Inputs:

None.

Outputs:

Carry: Set on error and cleared on success.

Destroys:

PSF, GR, LC[0], LC[1], APC, AP, A[0] (AP, APC set to 0)

Notes:

1) If the watchdog reset is enabled, user code should disable it before calling this function. Also, disable interrupts globally (IGE = 0).

2) This function can only be called by code running from the RAM. An attempt to call this function while running from the flash results

in an error.

Function:

AutoBaud*

Summary:

Waits for a 0x0D and measures the bit time for it and a reasonable value for BT is calculated (baud clock).

Input:

A[15]: Number of retries when bad character received.

Output:

PR set and return code in A[7]. Return codes are one of ERROR_NONE,

ERROR_NO_AUTOBAUD_CHARACTER, or

ERROR_BAD_AUTOBAUD_CHARACTER.

Destroys:

Accumulators (pretty much all of them), AP, PSF, Timer 0

Notes:

1) Initializes the UART to mode 1 with baud rate quadrupler on.

*Refer to Section 8 for UART with LIN communication and Section 13 for in-system programming through UART (and JTAG).