M3H Group(1) Application Note. I 2 C Interface (I2C-B) MASTER/SLAVE

Similar documents
M3H Group(1) Application Note I 2 C Interface (I2C-B)

M3H Group(2) Application Note I 2 C Interface (I2C-B) arbitration

M3H Group(2) Application Note Asynchronous Serial Communication Circuit (UART-C)

M3H Group(2) Application Note 12-bit Analog to Digital Converter (ADC-A)

RN1601, RN1602, RN1603 RN1604, RN1605, RN1606

TA75W393FU TA75W393FU. Dual Voltage Comparator. Features. Marking (Top View) Pin Connection (Top View)

TOSHIBA CMOS Digital Integrated Circuit Silicon Monolithic TC7SGU04FU IN A GND

3. Absolute Maximum Ratings (Note) (Unless otherwise specified, T a = 25 ) Symbol V ESD. P PK I PP T j T stg

DF10G7M1N DF10G7M1N. 1. Applications. 2. Packaging and Internal Circuit Rev.5.0. Start of commercial production

DF2S16FS DF2S16FS. 1. Applications. 2. Packaging and Internal Circuit Rev Toshiba Corporation

TC4049BP,TC4049BF, TC4050BP,TC4050BF

DF2S6.8FS DF2S6.8FS. 1. Applications. 2. Packaging and Internal Circuit Rev.5.0. Start of commercial production.

TCS40DPR. Digital Output Magnetic Sensor. Feature. Marking Pin Assignment (Top View) Function Table PA8

RN1101MFV,RN1102MFV,RN1103MFV RN1104MFV,RN1105MFV,RN1106MFV

TOSHIBA Zener Diode Silicon Epitaxial Type. CRY62 to CRZ39

DF2B6M4SL DF2B6M4SL. 1. General. 2. Applications. 3. Features. 4. Packaging Rev.4.0. Start of commercial production

TOSHIBA Schottky Barrier Diode CMS16

TOSHIBA Schottky Barrier Rectifier Schottky Barrier Type CMS05

RELIABILITY OF ENTERPRISE HARD DISK DRIVES

TC90195XBG Video signal Processing

TOSHIBA Bi-CMOS Integrated Circuit Silicon Monolithic TB62781FNG

TC35661SBG-501 Bluetooth IC Embedded Profile Series [SPP+GATT] Supported Functions Specification Overview. Rev 1.00

FIBER OPTIC TRANSMITTING MODULE TOTX1353(F)

FIBER OPTIC RECEIVING MODULE TORX1353(V,F) Characteristics Symbol Rating Unit

Super-convergence for Real Time Analytics at the Edge Flashmatrix 1000 Series. storage.toshiba.com/flashmatrix/

TCK22xxxG, TCK2065G, TCK1024G

32-bits RISC Microcontroller. TMPM3H Group(1) Reference manual Memory Map (MMAP-M3H(1)) Revision

TBD62785APG, TBD62785AFWG

NAND Flash Memory / NAND

FIBER OPTIC TRANSMITTING MODULE FIBER OPTIC TRANSMITTING MODULE FOR DIGITAL AUDIO EQUIPMENT

TOSHIBA CMOS Digital Integrated Circuit Silicon Monolithic TC74LCXR163245FT

TOSHIBA Bipolar Linear Integrated Circuit Silicon Monolithic TA58LT00F. 150 ma Output Current and Tracking Regulator with ON/OFF Control Switch

TD62783APG, TD62783AFWG

Product Guide Microwave Semiconductors

Product Guide 2017 Microwave Semiconductors

TXZ Family. Reference Manual. CRC calculation circuit (CRC-A) 32-bit RISC Microcontroller. Revision TXZ Family CRC calculation circuit

LDO XTAL. Built-in OSC for Wake-up. Power. Management. State Machine Management. Data Buffer CNL PHY. TC35420 Example System Configuration Diagram

FIBER OPTIC TRANSMITTING MODULE TOTX1952(F) FIBER OPTIC TRANSMITTING MODULE FOR DIGITAL AUDIO EQUIPMENT

FIBER OPTIC TRANSMITTING MODULE TOTX1952(6M,F) FIBER OPTIC TRANSMITTING MODULE FOR DIGITAL AUDIO EQUIPMENT

TBD62783A series Usage considerations

32-bit RISC Microcontroller. TMPM3H Group(2) Reference Manual Memory Map (MMAP-M3H(2)) Revision

TBD62183A Series Usage considerations

TBD62384A series Usage considerations

FIBER OPTIC TRANSCEIVING MODULE TODX2355(F) Characteristics Symbol Rating Unit

TBD62781A series Usage considerations

TBD62064APG, TBD62064AFG

FIBER OPTIC TRANSCEIVING MODULE TODX2950(F)

TBD62308AFAG TBD62308AFAG. TOSHIBA BiCD Integrated Circuit Silicon Monolithic. 4channel Low active high current sink type DMOS transistor array

TBD62064A series Usage considerations

FFSA TM. 130nm series

TBD62786A series Usage considerations

TBD62783APG, TBD62783AFG, TBD62783AFNG, TBD62783AFWG

TB67Z800FTG TB67Z800FTG. 3-channel Half Bridge Driver. Features TOSHIBA Bi-CD Integrated Circuit Silicon Monolithic

TBD62387A series Usage considerations

Solid State Drive CG2 Series

TOSHIBA BIPOLAR LINEAR INTEGRATED CIRCUIT SILICON MONOLITHIC TA8428K, TA8428FG. Weight HSIP7 P 2.54 : 1.88 g (Typ.) The TA8428FG is RoHS compatible.

TOSHIBA LED Lamp TLWF1100C(T11)

Microwave Semiconductors. Product Guide

Item MN07ACA14T MN07ACA12T. Formatted Capacity 14 TB 12 TB Interface Speed. 6.0 Gbit/s, 3.0 Gbit/s, 1.5 Gbit/s Rotation Speed

AL15SEB SERIES ENTERPRISE PEFORMANCE HDD

BiCD Integrated Circuit Silicon Monolithic TB62215AFG

TBD62003APG, TBD62003AFG, TBD62003AFNG, TBD62003AFWG TBD62004APG, TBD62004AFG, TBD62004AFNG, TBD62004AFWG

FIBER OPTIC TRANSCEIVING MODULE TODX2860A(F) Characteristics Symbol Rating Unit

MG07SCA SERIES ENTERPRISE CAPACITY HDD

MD06ACA-V SERIES SURVEILLANCE HDD

XG5-P SERIES CLIENT SSD

TC358768AXBG/TC358778XBG

PX02SM SERIES ENTERPRISE MID ENDURANCE SSD

Flash Memory. Toshiba's Leading Technology Areas. Features of Toshiba's Flash Memory

TOSHIBA LED Lamp TLWLF1108(T11)

TOSHIBA LED lamps TL12W03-N(T30)

XG6 SERIES CLIENT SSD

GOODRAM Industrial DDR2 Unbuffered DIMM 240pin standard temperature

TC358763XBG. Overview. Features. 1 / Rev CMOS Digital Integrated Circuit Silicon Monolithic TC358763XBG Mobile Peripheral Devices

MG07ACA SERIES ENTERPRISE CAPACITY HDD

Toshiba Bi-CD Integrated Circuit Silicon Monolithic TB6593FNG

MG06ACA SERIES ENTERPRISE CAPACITY HDD

Old Company Name in Catalogs and Other Documents

TL2FL-DW1,L TL2FL-DW1,L. 1. Applications. 2. Features. 3. Packaging and Pin Assignment Rev.2.0. Start of commercial production

TLP290-4 Technical Information

Old Company Name in Catalogs and Other Documents

Old Company Name in Catalogs and Other Documents

Operation of Timer A (2-phase pulse signal process in event counter mode, multiply-by-4 processing operation)

Solid State Drive HG3 Series

Old Company Name in Catalogs and Other Documents

UnRegistered MB39C602 LED LIGHTING SYSTEM BULB 9W ZIGBEE CONTROL USER MANUAL. Fujitsu Semiconductor Design (Chengdu) Co. Ltd.

White Paper I May 2015

XG5 SERIES CLIENT SSD

Old Company Name in Catalogs and Other Documents

02DZ2.0~02DZ24 02DZ2.0~02DZ24. Constant Voltage Regulation Applications Reference Voltage Applications. Absolute Maximum Ratings (Ta = 25 C)

AN4113 Application note

TMP89FS60FG Sample Program. Rev 1.0 Dec. 2007

AN10955 Full-duplex software UART for LPC111x and LPC13xx

GOODRAM Industrial DDR3 ECC SODIMM LOW VOLTAGE 204pin standard temperature

AT03975: Getting Started with SAM L21. Descripton. Features. SMART ARM-Based Microcontroller APPLICATION NOTE

UM0792 User manual. Demonstration firmware for the DMX-512 communication protocol transmitter based on the STM32F103Zx.

GOODRAM Industrial DDR3 SODIMM 204pin standard temperature

AVR42789: Writing to Flash on the New tinyavr Platform Using Assembly

Ethernet1 Xplained Pro

Old Company Name in Catalogs and Other Documents

Transcription:

M3H Group(1) I 2 C Interface (I2C-B) MASTER/SLAVE Outlines This application note is a reference material for developing products using the Master/Slave function in I2C interface (I2C) functions of M3H Group(1). This document helps the user check operation of the product and develop its program. Target sample program: I2C_MASTER_SLAVE 2018-03-08 1 / 18 Rev 1.0 2018 Toshiba Electronic Devices & Storage Corporation

Table of Contents M3H Group(1) Outlines... 1 Table of Contents... 2 1. Preface... 3 2. Reference Document... 4 3. Function to Use... 4 4. Target Device... 4 5. Conditions for Correct Operation... 5 6. Evaluation Board Setting... 6 7. Operation of Eveluation Board... 6 8. Outline of I 2 C Interface function... 7 8.1. Clock Supply... 7 9. Sample Program... 8 9.1. Initialization... 8 9.2. Sample program main operation... 8 9.3. Output Example of Sample Program... 9 9.3.1. Setting Example of Terminal Software...10 9.4. Operating Flow of Sample Program... 11 10. Precaution... 17 11. Revision History... 17 RESTRICTIONS ON PRODUCT USE... 18 2018-03-08 2 / 18 Rev 1.0

1. Preface M3H Group(1) This sample program is used to check the operation of the I2C communication function. Data transmission and reception by I2C Master / Slave is performed by terminal software on the host PC via USB-UART. Structure diagram of Sample program Application Layer Main (main.c) BSP UART input / output control (bsp_uart_io.c/bsp_uart_io.h) SW (bsp_sw.c/bsp_sw.h) I2C (bsp_i2c.c/bsp_i2c.h) Driver Layer UART (txz_uart.c/txz_uart.h) I2C (txz_i2c.c/txz_i2c.h) H/W UART Port I2C CG 2018-03-08 3 / 18 Rev 1.0

2. Reference Document Datasheet TMPM3H group (1) datasheet Rev2.0 (Japanese edition) Reference manual I2C interface (I2C-B) Rev2.0 (Japanese edition) Other reference document TMPM3H(1) Group Peripheral Driver User Manual (Doxygen) 3. Function to Use IP Channel Port Function / operation mode PC0 (I2C0SCL) I2C interface ch0 I2C mode PC1 (I2C0SDA) Asynchronous communication ch0 PA1 (UT0TXDA) PA2 (UT0RXD) UART mode 4. Target Device The target devices of application note are as follows. TMPM3H6FWFG TMPM3H6FUFG TMPM3H6FSFG TMPM3H6FWDFG TMPM3H6FUDFG TMPM3H6FSDFG TMPM3H5FWFG TMPM3H5FUFG TMPM3H5FSFG TMPM3H5FWDFG TMPM3H5FUDFG TMPM3H5FSDFG TMPM3H4FWUG TMPM3H4FUUG TMPM3H4FSUG TMPM3H4FWFG TMPM3H4FUFG TMPM3H4FSFG TMPM3H3FWUG TMPM3H3FUUG TMPM3H3FSUG TMPM3H2FWDUG TMPM3H2FUDUG TMPM3H2FSDUG TMPM3H2FWQG TMPM3H2FUQG TMPM3H2FSQG TMPM3H1FWUG TMPM3H1FUUG TMPM3H1FSUG TMPM3H1FPUG TMPM3H0FSDUG TMPM3H0FMDUG * This sample program operates on the evaluation board of TMPM3H6FWFG. If other function than the TMPM3H6 one is checked, it is necessary that CMSIS Core related files (C startup file and IO header file) should be changed properly. The BSP related file is dedicated to the evaluation board (TMPM3H6). If other function than the TMPM3H6 one is checked, the BSP related file should be changed properly. 2018-03-08 4 / 18 Rev 1.0

5. Conditions for Correct Operation Used microcontroller TMPM3H6FWFG Used board TMPM3H6FWFG Evaluation Board (Product of Sensyst) Unified development environment IAR Embedded Workbench for ARM 8.11.2.13606 Unified development environment μvision MDK Version 5.24.2.0 Terminal software Tera Term V4.96 Sample program V1100 Evaluation board (TMPM3H6FWFG Evaluation Board) (Top view) M3H Group(1) For purchasing the board, refer to the following homepage. (http://www.chip1stop.com/) 2018-03-08 5 / 18 Rev 1.0

6. Evaluation Board Setting The following pin connections should be done on the evaluation board. Two evaluation boards are used for Master and Slave. There are three kinds of connection as follows. Common to board A and board B CN5 Use Through-hole No. Setting UART (RXD) 9-10 Connection UART (TXD) 11-12 Connection Connection between CN in board A Connect CN9 No.2 and CN12 No.32 Connect CN9 No.4 and CN12 No.34 Connection between boards Connect board A CN9 No.2 and board B CN9 No.2 Connect board A CN9 No.4 and board B CN9 No.4 Board A Board B 7. Operation of Eveluation Board Connect the PC with the USB_UART terminal of the evaluation board with a USB cable. After start-up the terminal software (Tera Term), performs communication setting on the terminal software. Press the reset button on the evaluation board. Communication starts according to command input. For details of command input operation, refer to the sample program main operation. 2018-03-08 6 / 18 Rev 1.0

8. Outline of I 2 C Interface function The I2C can operate as a transceiver circuit of 1ch (SCL, SDA) in 1 unit circuit. 8.1. Clock Supply When using I2C, please set a clock enabling bit corresponding with the fsys supply on/off register A ([CGFSYSENA]) or B ([CGFSYSENB]) and fc supply on/off register ([CGFCEN]) as 1 (clock supply). Please refer to "Clock Control and Operation Mode" of the reference manual for the details. 2018-03-08 7 / 18 Rev 1.0

9. Sample Program According to the command input in the terminal software, Master and Slave are operated. 9.1. Initialization The following initialization is done after power is supplied. The port setting is executed after the initialization of each clock setting, the watchdog timer setting and the clock setting. 9.2. Sample program main operation After the initialization operation, shift to the main function and perform the following initialization 1 Initialization of BSP (Board Support Package) 2 Initialize the application 3 Initialization of the I2C interfaces for Master and Slave. After the above processing, perform the following operations on PC terminal software (Tera Term). "Command>" is displayed on Tera Term. The command slave should be set to the board which should be used as Slave. The command write or read should be input to the board which should be used as Master. When write is input, the slave address and the transmission data are displayed for the Master board. And the address and the reception data are displayed for the Slave one. When read is input, the slave address and the transmission/reception data are displayed for the Master board. The address and the reception/transmission data are displayed for the Slave one. For the displayed image, refer to Section 9.3 Output Example of Sample Program. 2018-03-08 8 / 18 Rev 1.0

9.3. Output Example of Sample Program When the sample program operates, the command results are shown as follows; Master Slave 2018-03-08 9 / 18 Rev 1.0

9.3.1. Setting Example of Terminal Software M3H Group(1) The operation of the terminal software (Tera Term) has been checked with the following settings. 2018-03-08 10 / 18 Rev 1.0

9.4. Operating Flow of Sample Program The operating flows of the sample program are shown in the following; Main i2c_eeprom Creation and Initialization uart_io ref Creation and Initialization loop opt Command analysis Command transmission 2018-03-08 11 / 18 Rev 1.0

Creation and Initialization i2c_eeprom EEPROM_i2c_init() Creation i2c_api i2c_init (Instance address, sda, scl) CG:FSYSENA FSYSENA02(PortC)Enable FSYSENA20(I2C)Enable Port: I2C0SCL and I2C0SDA settings Register assignment i2c i2c_reset() I2C_reset(Instance address) i2c_frequency(100khz) I2C_get_clock_setting(Instance address) I2C initial setting result = i2c_init(-):successful EEPROM_i2c_init(-) 2018-03-08 12 / 18 Rev 1.0

write command procedure write command procedure main i2c_api i2c result:strncmp() In the case of write ; ts_i2c_master_non_blocking_write() ref i2c_transfer_asynch ((Instance handle, Transmission buffer address, Transmission Byte count, Reception buffer address, Reception Byte count, Slave address, stop = 1) opt [stop=1] ref i2c_stop Terminal display Write data is displayed. 2018-03-08 13 / 18 Rev 1.0

slave command procedure slave command procedure main i2c_api i2c result:strncmp() In the case of slave ; ts_i2c_set_slave_mode() i2c_slave_address (Instance handle, Slave address) I2C_set_address (Instance handle, Slave address) i2c_slave_address(-): i2c_slave_mode ((Instance handle, Slave mode) I2C_slave_init(Instance handle) ts_i2c_slave_non_blocking_receive() ref i2c_slave_transfer_asynch (Instance handle, Transmission buffer address, Transmission Byte count, Reception buffer address, Reception Byte count, Slave address, stop = 1) opt [stop=1] ref i2c_stop Terminal display Read data is displayed. 2018-03-08 14 / 18 Rev 1.0

i2c_transfer_asynch i2c_transfer_asynch i2c_api i2c i2c_transfer_asynch (Instance handle, Transmission buffer address, Transmission Byte count, Reception buffer address, Reception Byte count, Slave address, stop = 1) reset_asynch(instance handle) I2C_clear_int_status (Instance handle) I2C_start_condition (Instance handle, Slave address) Loop[I2C interrupt request is present.] I2C_int_status(Instance handle) I2C_get_ack(Instance handle) ACK result = i2c_transfer_asynch(-):i2c_ack 2018-03-08 15 / 18 Rev 1.0

i2c_stop i2c_stop i2c_api i2c i2c_stop(instance handle) I2C_stop_condition(Instance handle) Loop[BUSY] I2C_status_busy(Instance handle) i2c_stop(-) 2018-03-08 16 / 18 Rev 1.0

10. Precaution M3H Group(1) When using the sample program with CPU other than TMPM3H6, please check operation sufficiently. 11. Revision History Rev Date Page Description 1.0 2018-03-08 - First release 2018-03-08 17 / 18 Rev 1.0

RESTRICTIONS ON PRODUCT USE Toshiba Corporation and its subsidiaries and affiliates are collectively referred to as TOSHIBA. Hardware, software and systems described in this document are collectively referred to as Product. TOSHIBA reserves the right to make changes to the information in this document and related Product without notice. This document and any information herein may not be reproduced without prior written permission from TOSHIBA. Even with TOSHIBA's written permission, reproduction is permissible only if reproduction is without alteration/omission. Though TOSHIBA works continually to improve Product's quality and reliability, Product can malfunction or fail. Customers are responsible for complying with safety standards and for providing adequate designs and safeguards for their hardware, software and systems which minimize risk and avoid situations in which a malfunction or failure of Product could cause loss of human life, bodily injury or damage to property, including data loss or corruption. Before customers use the Product, create designs including the Product, or incorporate the Product into their own applications, customers must also refer to and comply with (a) the latest versions of all relevant TOSHIBA information, including without limitation, this document, the specifications, the data sheets and application notes for Product and the precautions and conditions set forth in the "TOSHIBA Semiconductor Reliability Handbook" and (b) the instructions for the application with which the Product will be used with or for. Customers are solely responsible for all aspects of their own product design or applications, including but not limited to (a) determining the appropriateness of the use of this Product in such design or applications; (b) evaluating and determining the applicability of any information contained in this document, or in charts, diagrams, programs, algorithms, sample application circuits, or any other referenced documents; and (c) validating all operating parameters for such designs and applications. TOSHIBA ASSUMES NO LIABILITY FOR CUSTOMERS' PRODUCT DESIGN OR APPLICATIONS. PRODUCT IS NEITHER INTENDED NOR WARRANTED FOR USE IN EQUIPMENTS OR SYSTEMS THAT REQUIRE EXTRAORDINARILY HIGH LEVELS OF QUALITY AND/OR RELIABILITY, AND/OR A MALFUNCTION OR FAILURE OF WHICH MAY CAUSE LOSS OF HUMAN LIFE, BODILY INJURY, SERIOUS PROPERTY DAMAGE AND/OR SERIOUS PUBLIC IMPACT ("UNINTENDED USE"). Except for specific applications as expressly stated in this document, Unintended Use includes, without limitation, equipment used in nuclear facilities, equipment used in the aerospace industry, medical equipment, equipment used for automobiles, trains, ships and other transportation, traffic signaling equipment, equipment used to control combustions or explosions, safety devices, elevators and escalators, devices related to electric power, and equipment used in finance-related fields. IF YOU USE PRODUCT FOR UNINTENDED USE, TOSHIBA ASSUMES NO LIABILITY FOR PRODUCT. For details, please contact your TOSHIBA sales representative. Product shall not be used for or incorporated into any products or systems whose manufacture, use, or sale is prohibited under any applicable laws or regulations. The information contained herein is presented only as guidance for Product use. No responsibility is assumed by TOSHIBA for any infringement of patents or any other intellectual property rights of third parties that may result from the use of Product. No license to any intellectual property right is granted by this document, whether express or implied, by estoppel or otherwise. ABSENT A WRITTEN SIGNED AGREEMENT, EXCEPT AS PROVIDED IN THE RELEVANT TERMS AND CONDITIONS OF SALE FOR PRODUCT, AND TO THE MAXIMUM EXTENT ALLOWABLE BY LAW, TOSHIBA (1) ASSUMES NO LIABILITY WHATSOEVER, INCLUDING WITHOUT LIMITATION, INDIRECT, CONSEQUENTIAL, SPECIAL, OR INCIDENTAL DAMAGES OR LOSS, INCLUDING WITHOUT LIMITATION, LOSS OF PROFITS, LOSS OF OPPORTUNITIES, BUSINESS INTERRUPTION AND LOSS OF DATA, AND (2) DISCLAIMS ANY AND ALL EXPRESS OR IMPLIED WARRANTIES AND CONDITIONS RELATED TO SALE, USE OF PRODUCT, OR INFORMATION, INCLUDING WARRANTIES OR CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, ACCURACY OF INFORMATION, OR NONINFRINGEMENT. Do not use or otherwise make available Product or related software or technology for any military purposes, including without limitation, for the design, development, use, stockpiling or manufacturing of nuclear, chemical, or biological weapons or missile technology products (mass destruction weapons). Product and related software and technology may be controlled under the applicable export laws and regulations including, without limitation, the Japanese Foreign Exchange and Foreign Trade Law and the U.S. Export Administration Regulations. Export and re-export of Product or related software or technology are strictly prohibited except in compliance with all applicable export laws and regulations. Please contact your TOSHIBA sales representative for details as to environmental matters such as the RoHS compatibility of Product. Please use Product in compliance with all applicable laws and regulations that regulate the inclusion or use of controlled substances, including without limitation, the EU RoHS Directive. TOSHIBA ASSUMES NO LIABILITY FOR DAMAGES OR LOSSES OCCURRING AS A RESULT OF NONCOMPLIANCE WITH APPLICABLE LAWS AND REGULATIONS. 2018-03-08 18 / 18 Rev 1.0