Electronic Components Datasheet Search
  New Zealand  ▼
ALLDATASHEET.CO.NZ

X  

PM0051 Datasheet(PDF) 24 Page - STMicroelectronics

Part # PM0051
Description  How to program STM8S and STM8A Flash program memory and data EEPROM
PDF  27 Pages
Scroll/Zoom Zoom In 100%  Zoom Out
Manufacturer  STMICROELECTRONICS [STMicroelectronics]
Direct Link  http://www.st.com
Logo STMICROELECTRONICS - STMicroelectronics

PM0051 Datasheet(HTML) 24 Page - STMicroelectronics

Back Button PM0051 Datasheet HTML 19Page - STMicroelectronics PM0051 Datasheet HTML 20Page - STMicroelectronics PM0051 Datasheet HTML 21Page - STMicroelectronics PM0051 Datasheet HTML 22Page - STMicroelectronics PM0051 Datasheet HTML 23Page - STMicroelectronics PM0051 Datasheet HTML 24Page - STMicroelectronics PM0051 Datasheet HTML 25Page - STMicroelectronics PM0051 Datasheet HTML 26Page - STMicroelectronics PM0051 Datasheet HTML 27Page - STMicroelectronics  
Zoom Inzoom in Zoom Outzoom out
 24 / 27 page
background image
Programming STM8 Flash microcontrollers
PM0051
24/27
Doc ID 14614 Rev 3
4.6.1
ICP methods
The in-circuit programming (ICP) method is used to update the content of Flash program
memory and data EEPROM.
The programming interface for STM8 devices is the SWIM (Single Wire Interface Module). It
is used to communicate with an external programming device connected via a cable.
See STM8 SWIM communication protocol and debug module user manual (UM0470) for
more details on the SWIM mode entry and SWIM protocol.
When using the SWIM protocol, two methods can be used:
First method
The first method consists of writing directly into the Flash registers and memory locations
through the write memory command of the SWIM protocol. To make sure that the CPU is
not accessing the memory during block Flash programming, the core must be stalled by
setting the STALL bit in the DM_CSR2 debug module register.
The following sequence is required:
1.
Apply a RESET
2.
Activate the SWIM by sending the entry sequence on the SWIM pin
3.
Activate the SWIM_CSR register by writing 1 to the DM bit in SWIM_CSR
4.
Disable interrupts by setting the SAFE_MASK bit in SWIM_CSR
5.
Release RESET
6.
Verify the DeviceID by reading it using ROTF command
7.
Send the SWIM SRST command
8.
Unlock the memory by writing the MASS keys
9.
Program the Flash program memory using the SWIM WOTF command
Second method
The second method uses the same sequence of operations as the first method except that
the ICP driver firmware must be downloaded in RAM before being launched:
1.
Apply a RESET
2.
Activate the SWIM by sending the entry sequence on the SWIM pin
3.
Activate the SWIM_CSR register by writing 1 to the DM bit in SWIM_CSR
4.
Disable interrupts by setting the SAFE_MASK bit in SWIM_CSR
5.
Release RESET
6.
Verify the DeviceID by reading it using ROTF command
7.
Send the SWIM SRST command
8.
Unlock the memory by writing the MASS keys
9.
Download the ICP driver firmware into the device RAM using the SWIM WOTF
command
10. Execute the ICP driver:
a)
Modify the CPU registers (new PC, X, Y, CC...) using the WOTF commands
b)
Set the FLASH bit in the DM_CSR2 register
c)
Clear the STALL bit in the DM_CSR2 register



Html Pages

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27


Datasheet Download

Go To PDF Page


Link URL



Does ALLDATASHEET help your business so far?  [ DONATE ] 

About Alldatasheet   |   Advertisement   |   Contact us   |   Privacy Policy   |   Link to Datasheet    |   Link Exchange   |   Manufacturer List
All Rights Reserved©Alldatasheet.com


Mirror Sites
English : Alldatasheet.com  |   English : Alldatasheet.net  |   Chinese : Alldatasheetcn.com  |   German : Alldatasheetde.com  |   Japanese : Alldatasheet.jp
Russian : Alldatasheetru.com  |   Korean : Alldatasheet.co.kr  |   Spanish : Alldatasheet.es  |   French : Alldatasheet.fr  |   Italian : Alldatasheetit.com
Portuguese : Alldatasheetpt.com  |   Polish : Alldatasheet.pl  |   Vietnamese : Alldatasheet.vn
Indian : Alldatasheet.in  |   Mexican : Alldatasheet.com.mx  |   British : Alldatasheet.co.uk  |   New Zealand : Alldatasheet.co.nz
Family Site : ic2ic.com  |   icmetro.com