Rev. 1.60
46
August 20, 2019
Rev. 1.60
47
August 20, 2019
BS66F340/BS66F350/BS66F360/BS66F370
Touch A/D Flash MCU with LED Driver
BS66F340/BS66F350/BS66F360/BS66F370
Touch A/D Flash MCU with LED Driver
Flash Memory Write Function Enable Procedure
In order to allow users to change the Flash memory data through the IAP control registers, users
must first enable the Flash memory write operation by the following procedure:
1.
Write "110" into the FMOD2~FMOD0 bits to select the FWEN mode.
2.
Set the FWPEN bit to "1". The step 1 and step 2 can be executed simultaneously.
3.
The pattern data with a sequence of 00H, 04H, 0DH, 09H, C3H and 40H must be written into the
FD1L, FD1H, FD2L, FD2H, FD3L and FD3H registers respectively.
4. A counter with a time-out period of 300μs will be activated to allow users writing the correct pattern
data into the FD1L/FD1H~FD3L/FD3H register pairs. The counter clock is derived from LIRC
oscillator.
5.
If the counter overflows or the pattern data is incorrect, the Flash memory write operation will
not be enabled and users must again repeat the above procedure. Then the FWPEN bit will
automatically be cleared to 0 by hardware.
6.
If the pattern data is correct before the counter overflows, the Flash memory write operation will
be enabled and the FWPEN bit will automatically be cleared to 0 by hardware. The CFWEN bit
will also be set to 1 by hardware to indicate that the Flash memory write operation is successfully
enabled.
7.
Once the Flash memory write operation is enabled, the user can change the Flash ROM data
through the Flash control register.
8.
To disable the Flash memory write operation, the user can clear the CFWEN bit to 0.
Flash Memory
Write Function
Enable Procedure
Set FMOD [2:0] =110 & FWPEN=1
Select FWEN mode & Start Flash write
Hardware activate a counter
Wrtie the following pattern to Flash Data registers
FD1L= 00h , FD1H = 04h
FD2L= 0Dh , FD2H = 09h
FD3L= C3h , FD3H = 40h
Success
END
Yes
Failed
CFWEN=0
CFWEN = 1
No
Is counter
overflow ?
No
FWPEN=0
Is pattern
correct ?
Yes
Flash Memory Write Function Enable Procedure