AN204940 F²MC - 8L Family, MB89F538, Programming Guide This application note describes how to program the Cypress MB89F538 MCU in serial asynchronous mode. Contents 1 2 3 4 Introduction ..................................................................1 Software Setup ............................................................1 2.1 Installation ...........................................................1 Flash Programmer .......................................................2 3.1 Programming the MB89F538 ..............................2 3.2 Customize Crystal Frequencies ..........................3 Hardware Settings .......................................................4 1 4.1 Pin Settings......................................................... 4 5 Pin Assignment ........................................................... 5 5.1 Related Pins for Programming ............................ 5 6 Example Schematic ..................................................... 8 6.1 Setup for Programming ....................................... 8 Document History.............................................................. 9 Introduction This application note describes how to program the Cypress MB89F538 MCU in serial asynchronous mode. 2 Software Setup Cypress Flash MCU Programmer 2.1 Installation To install the Cypress Flash 8-Bit-MCU Programming Software, you have to execute the program “PCW8Fsetup.exe”. Then follow the steps of the setup dialog. After successful installation, you will find the Cypress Flash MCU programmer in the folder: “C:\Program Files\ Cypress \CYPRESS FLASH MCU Programmer\FMC8L(FLASH)\flash.exe” The symbol of this tools looks like the following picture www.cypress.com Document No. 002-04940 Rev. *A 1 F²MC - 8L Family, MB89F538, Programming Guide 3 Flash Programmer Using the Flash Programmer 3.1 Programming the MB89F538 When the Cypress Flash 8-Bit MCU Programmer, “flash.exe”, is executed the following window will occur: The target microcontroller is MB89F538/L, and the crystal frequency has to be set to the used crystal frequency on the target board. 2MHz, 4MHz and 8MHz are available. For other frequencies see the next chapter. To program the flash with your code, first set the MCU into Serial Programming Mode (see Chapter 3 for hardware settings). Then choose Open for selecting the code to be programmed into the Flash Memory. This code has to be a mhx-, cnv-, or ahx-object file, which was generated by a compiler tool (e. g. Softune Workbench). After selecting the hex-file press the Full Operation (D+E+B+P) button. This means that the programming steps “download”, “erase”, “blank check”, and “program & verify” will be executed sequentially. Alternatively you can use Download first. Then the commands Erase, Blank Check, Program & Verify, and Read & Compare have to be used separately. Note: If Download is used, Full Operation can not be used afterwards. www.cypress.com Document No. 002-04940 Rev.*A 2 F²MC - 8L Family, MB89F538, Programming Guide 3.2 Customize Crystal Frequencies It is possible to use different crystal frequencies than the default frequencies. For this the file “Chipdef.ini” in the “FMC8L(FLASH)” directory can be customized with a standard text editor. Assume you want to use a 5MHz crystal. Open the file “Chipdef.ini” and change the following entries: Old: New: Clock=2MHz,4MHz,8MHz Clock=2MHz,4MHz,5MHz,8MHz,10MHz Baud=1200,2400,4800 Baud=1200,2400,3000,4800,5900 Baud2=2400,4800,9600 Baud2=2400,4800,6000,9600,11520 After you have done the changes, save the file and then start the Cypress Flash 8-Bit MCU Programmer. Now the added crystal frequency occurs in the Crystal Frequency text field. Note, Baud is the baud rate for downloading the transfer program and Baud2 the rate this program uses. Calculation formulas for the baud rates: BaudMCU = Φ · 0.0006 Bit/Hz·s Baud2MCU = Φ · 0.0012 Bit/Hz·s Φ = crystal frequency in Hz BaudPC = 230400 Hz / ( 230400 Hz / (2 · BaudMCU) · 2) Baud2PC= 230400 Hz / ( 230400 Hz / (2 · Baud2MCU) · 2) = floor function* The baud rate setting for Φ is only valid, if 0.955 ≤ (BaudMCU/BaudPC) ≤ 1.045 and 0.955 ≤ (Baud2MCU/Baud2PC) ≤ 1.045 . This means, that the PC-UART baud rates deviation to MCU baud rates must not less than −4.5% and bigger than 4.5%. If the both baud rates are valid, the PC-UART baud rates have to be entered in the file “Chipdef.ini”. Note: Please refer to the Clock Timing chapter in the Data sheet for the minimum and maximum crystal frequencies. *greatest integer function www.cypress.com Document No. 002-04940 Rev.*A 3 F²MC - 8L Family, MB89F538, Programming Guide 4 Hardware Settings How to program the FLASH MCU 4.1 4.1.1 Pin Settings S e r i a l As yn c h r o n o u s P r o g r a m m i n g To program the flash memory some pins of the MCU has to be set to several voltage levels (VSS and VCC). To enter the flash programming mode use the following pins settings and reset the MCU (low means VSS and high means VCC): Flash Programming Mode Pin Name Pin No. Pin No. Pin No. (DIP-M01) (FPT-M06) (FPT-M09) Logic Level MOD0 28 21 20 High MOD1 29 22 21 High MOD2 10 3 2 Low P10 48 41 40 Low P22 38 31 30 High P23 37 30 29 Low To download the software use the SI1(UI1)-Pin for serial input and the SO1(UO1)-Pin for serial output. Caution: To connect the MCU to the serial PC interface (RS232) you have to use a voltage level shifter (e.g. MAX232). The Flash Programming Tool described in chapter 2.1 can be used for programming. Attention: Do not abort the sequence “Erase Flash” by switching off the power of the MCU, by resetting the MCU or by aborting the programming tool! The Flash Memory can be damaged permanently in this case! 4.1.2 Run Mode After programming the Flash Memory the MCU executes the program in its run mode by setting the pins MOD0, MOD1, MOD2 to “Low” level and resetting it (or after power on). The Pins P10, P22, and P23 are working then as resource input/output or general purpose pin. www.cypress.com Document No. 002-04940 Rev.*A 4 F²MC - 8L Family, MB89F538, Programming Guide 5 Pin Assignment Pins for Flash Programming of different packages 5.1 Related Pins for Programming In the following illustrations show the related pins for programming the Flash Memory. These pins are marked red (grey). 5.1.1 MB89F538/L DIP-64P-M01 www.cypress.com Document No. 002-04940 Rev.*A 5 F²MC - 8L Family, MB89F538, Programming Guide 5.1.2 MB89F538/L FPT-64P-M06 www.cypress.com Document No. 002-04940 Rev.*A 6 F²MC - 8L Family, MB89F538, Programming Guide 5.1.3 MB89F538/L FPT-64P-M09 www.cypress.com Document No. 002-04940 Rev.*A 7 F²MC - 8L Family, MB89F538, Programming Guide 6 Example Schematic Hardware setup 6.1 Setup for Programming The following schematic gives an example for the hardware setup for programming the Flash Memory in serial asynchronous mode: www.cypress.com Document No. 002-04940 Rev.*A 8 F²MC - 8L Family, MB89F538, Programming Guide Document History Document Title: AN204940 – F²MC - 8L Family, MB89F538, Programming Guide Document Number: 002-04940 Revision ** *A ECN - 5278932 Orig. of Change WOFR WOFR Submission Date Description of Change 11/06/2002 First release 01/08/2003 Revision 2.0 03/04/2003 Revision 2.1; calculation errors removed 04/10/2003 Revision 2.2; typo on p. 7 removed 05/20/2016 Migrated Spansion Application Note “MCU-AN-389019-E-V22” to Cypress format. www.cypress.com Document No. 002-04940 Rev.*A 9 F²MC - 8L Family, MB89F538, Programming Guide Worldwide Sales and Design Support Cypress maintains a worldwide network of offices, solution centers, manufacturer’s representatives, and distributors. To find the office closest to you, visit us at Cypress Locations. Products ® ® PSoC® Solutions ARM Cortex Microcontrollers cypress.com/arm Automotive cypress.com/automotive PSoC 1 | PSoC 3 | PSoC 4 | PSoC 5LP Clocks & Buffers cypress.com/clocks Cypress Developer Community Interface cypress.com/interface Forums | Projects | Videos | Blogs | Training | Components Lighting & Power Control cypress.com/powerpsoc Memory cypress.com/memory PSoC cypress.com/psoc Touch Sensing cypress.com/touch USB Controllers cypress.com/usb Wireless/RF cypress.com/wireless Technical Support cypress.com/support PSoC is a registered trademark and PSoC Creator is a trademark of Cypress Semiconductor Corporation. All other trademarks or registered trademarks referenced herein are the property of their respective owners. Cypress Semiconductor 198 Champion Court San Jose, CA 95134-1709 Phone Fax Website : 408-943-2600 : 408-943-4730 : www.cypress.com © Cypress Semiconductor Corporation,2002-2016. This document is the property of Cypress Semiconductor Corporation and its subsidiaries, including Spansion LLC (“Cypress”). This document, including any software or firmware included or referenced in this document (“Software”), is owned by Cypress under the intellectual property laws and treaties of the United States and other countries worldwide. Cypress reserves all rights under such laws and treaties and does not, except as specifically stated in this paragraph, grant any license under its patents, copyrights, trademarks, or other intellectual property rights. If the Software is not accompanied by a license agreement and you do not otherwise have a written agreement with Cypress governing the use of the Software, then Cypress hereby grants you a personal, non-exclusive, nontransferable license (without the right to sublicense) (1) under its copyright rights in the Software (a) for Software provided in source code form, to modify and reproduce the Software solely for use with Cypress hardware products, only internally within your organization, and (b) to distribute the Software in binary code form externally to end users (either directly or indirectly through resellers and distributors), solely for use on Cypress hardware product units, and (2) under those claims of Cypress’s patents that are infringed by the Software (as provided by Cypress, unmodified) to make, use, distribute, and import the Software solely for use with Cypress hardware products. Any other use, reproduction, modification, translation, or compilation of the Software is prohibited. TO THE EXTENT PERMITTED BY APPLICABLE LAW, CYPRESS MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS DOCUMENT OR ANY SOFTWARE OR ACCOMPANYING HARDWARE, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. To the extent permitted by applicable law, Cypress reserves the right to make changes to this document without further notice. Cypress does not assume any liability arising out of the application or use of any product or circuit described in this document. Any information provided in this document, including any sample design information or programming code, is provided only for reference purposes. It is the responsibility of the user of this document to properly design, program, and test the functionality and safety of any application made of this information and any resulting product. Cypress products are not designed, intended, or authorized for use as critical components in systems designed or intended for the operation of weapons, weapons systems, nuclear installations, life-support devices or systems, other medical devices or systems (including resuscitation equipment and surgical implants), pollution control or hazardous substances management, or other uses where the failure of the device or system could cause personal injury, death, or property damage (“Unintended Uses”). A critical component is any component of a device or system whose failure to perform can be reasonably expected to cause the failure of the device or system, or to affect its safety or effectiveness. Cypress is not liable, in whole or in part, and you shall and hereby do release Cypress from any claim, damage, or other liability arising from or related to all Unintended Uses of Cypress products. You shall indemnify and hold Cypress harmless from and against all claims, costs, damages, and other liabilities, including claims for personal injury or death, arising from or related to any Unintended Uses of Cypress products. Cypress, the Cypress logo, Spansion, the Spansion logo, and combinations thereof, PSoC, CapSense, EZ-USB, F-RAM, and Traveo are trademarks or registered trademarks of Cypress in the United States and other countries. For a more complete list of Cypress trademarks, visit cypress.com. Other names and brands may be claimed as property of their respective owners. www.cypress.com Document No. 002-04940 Rev.*A 10