TWI694376B - Light sensor device controlled with dual-mode master-and-slave mcu application - Google Patents

Light sensor device controlled with dual-mode master-and-slave mcu application Download PDF

Info

Publication number
TWI694376B
TWI694376B TW108112545A TW108112545A TWI694376B TW I694376 B TWI694376 B TW I694376B TW 108112545 A TW108112545 A TW 108112545A TW 108112545 A TW108112545 A TW 108112545A TW I694376 B TWI694376 B TW I694376B
Authority
TW
Taiwan
Prior art keywords
memory
light sensor
slave
interface
mode
Prior art date
Application number
TW108112545A
Other languages
Chinese (zh)
Other versions
TW202038085A (en
Inventor
林俊賢
詹朋翰
林文勝
蘇育正
李盛城
Original Assignee
敦宏科技股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 敦宏科技股份有限公司 filed Critical 敦宏科技股份有限公司
Priority to TW108112545A priority Critical patent/TWI694376B/en
Application granted granted Critical
Publication of TWI694376B publication Critical patent/TWI694376B/en
Publication of TW202038085A publication Critical patent/TW202038085A/en

Links

Images

Abstract

A light sensor is provided. It is controlled with a dual-mode master and slave microcontroller unit (MCU) application. An MCU is embedded into an optical sensor chip. The original dual-mode master and slave dual-CPU architecture is combined to be operated as a single-CPU architecture. According to the original circuit pin design, it is possible to be compatible with the old circuit design. The present invention uses a single-CPU architecture to directly control optical sensor with microcontroller. Through the configuration of random access memory (RAM), internal integrated circuit (I2C I/F) bus can be redirected to internal non-volatile memory. The operating mode of optical sensor is switched from slave device to host device; and interrupt pin is switched off and, then, is turned into GPIO pin. Thus, the present invention provides a single-CPU architecture with simple use and effectively-lowered cost.

Description

具兩種模式之MCU主從應用控制光感測器裝置 MCU master-slave application with two modes to control light sensor device

本發明係有關於一種具兩種模式之MCU主從應用控制光感測器裝置,尤指涉及一種光感測器操作模式,特別係指將小型微控制器(Microcontroller Unit,MCU)嵌入光感測器晶片中,使光感測器由微控制器控制者。 The present invention relates to an MCU master-slave application with two modes for controlling a light sensor device, in particular to an operation mode of a light sensor, and in particular to embedding a small microcontroller (Microcontroller Unit, MCU) into a light sensor In the detector chip, the light sensor is controlled by the microcontroller.

光感測器(Light Sensor)係利用光敏元件將光訊號轉換為電信訊號之感測器。該光感應器通常由一組投光器與受光器所組成,該投光器將光線經由透鏡聚焦,傳輸至受光器之透鏡,再傳至接收感測器。該感測器將收到的光訊號轉變成電信訊號,此電信訊號則可進一步作各種不同之開關及控制動作。換而言之,光感測器之基本原理,即為運用投光器與受光器之間的光線改變所獲得之信號,以完成各種自動化控制。光感測器係取代限位開關等接觸式之檢測方式,凡是不接觸檢測對象而進行檢測之感測器,皆通稱為近接感測器。其原理係將檢測對象之移動資訊或存在資訊轉換成電性訊號。 Light sensor (Light Sensor) is a sensor that uses light-sensitive elements to convert optical signals into telecommunications signals. The light sensor is usually composed of a group of light projectors and light receivers. The light projectors focus light through a lens, transmit it to the lens of the light receiver, and then pass it to the receiving sensor. The sensor converts the received optical signal into a telecommunication signal, which can be further used for various switching and control actions. In other words, the basic principle of the light sensor is to use the signal obtained by changing the light between the projector and the receiver to complete various automatic controls. The light sensor replaces contact detection methods such as limit switches, and any sensor that performs detection without touching the detection object is generally called a proximity sensor. The principle is to convert the mobile information or presence information of the detected object into electrical signals.

到目前為止,光感測器操作模式仍然通過微控制器來啟動/關閉;亦即,其操作總是需要通過微控制器喚醒,因此整體主要成本昂貴。如第3圖所示為主從(master/slave)架構,係使用雙CPU,以主機通過內部積體電路匯流排(Inter-Integrated Circuit,I2C)協定去控制從屬機光感測器的方式。此前案本身就具有一主機3的中央處理器31跟 一從屬機4的微控制器41,主機3的中央處理器31即為控制內部光感測器32之CPU,從屬機4的微控制器41則是用以控制外部組態調整之CPU,藉此形成雙CPU之控制模式。然而,傳統前案微控制器41之組態調整不是用來控制光感測器32,而是使用主機3之中央處理器31來控制光感測器32。 Up to now, the operation mode of the light sensor is still activated/deactivated by the microcontroller; that is, its operation always needs to be woken up by the microcontroller, so the overall main cost is expensive. As shown in Figure 3, the master/slave architecture uses dual CPUs, and the host uses the internal integrated circuit (Inter-Integrated Circuit, I2C) protocol to control the slave's light sensor. The previous case itself had a central processor 31 of host 3 A microcontroller 41 of the slave 4, the central processor 31 of the master 3 is the CPU that controls the internal light sensor 32, and the microcontroller 41 of the slave 4 is the CPU used to control the external configuration adjustment. This forms a dual CPU control mode. However, the configuration adjustment of the conventional microcontroller 41 is not used to control the light sensor 32, but uses the central processor 31 of the host 3 to control the light sensor 32.

鑑於習知技術之各項問題,發展一套更便宜之感測器結構來節省物件清單(BOM)列表實有必要。 In view of the problems of the conventional technology, it is necessary to develop a cheaper sensor structure to save the bill of materials (BOM) list.

本發明之主要目的係在於,克服習知技藝所遭遇之上述問題並提供一種將小型微控制器嵌入光感測器晶片中,將原本主從雙模式的雙CPU架構合併成單CPU架構運作,並按照原始電路腳位設計,因此能與舊有電路設計模式相容之具兩種模式之MCU主從應用控制光感測器裝置。 The main purpose of the present invention is to overcome the above-mentioned problems encountered in the conventional art and provide a small microcontroller embedded in the light sensor chip, combining the dual CPU architecture of the original master-slave dual mode into a single CPU architecture, It is designed according to the original circuit pin, so it can be compatible with the old circuit design mode. The MCU master-slave application with two modes controls the light sensor device.

本發明之次要目的係在於,提供一種以單CPU架構即可使光感測器直接由微控制器控制,透過隨機存取記憶體之配置,可從內部積體電路匯流排重定向到內部非揮發性記憶體,使光感測器運行模式由從屬機設備切換到主機設備,關閉中斷接腳,然後轉為GPIO接腳,進而使所提單CPU架構具有架構簡單、容易使用,成本亦能有效下降之具兩種模式之MCU主從應用控制光感測器裝置。 The secondary object of the present invention is to provide a single CPU architecture that allows the light sensor to be directly controlled by a microcontroller. Through the configuration of random access memory, it can be redirected from the internal integrated circuit bus to the internal Non-volatile memory, switch the operation mode of the light sensor from the slave device to the host device, close the interrupt pin, and then switch to the GPIO pin, thus making the bill of lading CPU architecture simple, easy to use, and cost-effective The MCU master-slave application with two modes for effective descent controls the light sensor device.

為達以上之目的,本發明係一種具兩種模式之MCU主從應用控制光感測器裝置,係包括:一光感測器區,設置有數個光感測器(light sensor);一類比前端電路(Analog Front End,AFE),電性連接該光感測器區,用以光電轉換並類比的修整該些光感測器之參數;一微控制器,電性連接該類比前端電路,該微控制器為一軟體狀態機(State machine),分別具有一第一記憶體及一I/O通訊介面,並由該第一記憶體儲存軟體狀態機之程式;一記憶體仲裁器(Arbitration,ARB),電性連接該微控制器,用以接收與各別記憶體關聯之微指令,並用於根據一仲裁程序選定該等微指令之順序並進行處理,令一經過處理之微指令建立對該微指令指定之記憶體部份及位址之存取;一第二記憶體,電性連接該記憶體仲裁器,其儲存有一函數式(Functional)的光感測器控制之設定值;一內部積體電路(I2C I/F)匯流排,電性連接該記憶體仲裁器,該內部積體電路匯流排為通訊介面,供連接一外部裝置,其具有一暫存器,所有運算設定會存在該第二記憶體與該暫存器中;一第三記憶體,其內建有一修整(Trim)值,作為該微控制器控制該類比前端電路修整該些光感測器之AFE修整參數資料;一第四記憶體,其配置作為單位元(Single bit)單元記憶體,並以該些運算設定燒錄成Single bit形式之資料,藉以決定進行從屬模式或單晶片模式;以及一記憶體介面電路,電性連接該記憶體仲裁器、該第三記憶體及該第四記憶體,用以基於該記憶體仲裁器經過處理之微指令產生記憶體通道位址以存取該第三記憶體與該第四記憶體;藉上述構成元件形成一光感測器晶片,通過連續讀取該第三記憶體與該第四記憶體並存入該第二記憶體,該微控制器將取得來自該第三記憶體與該第四記憶體之讀出數據並檢查Single bit狀態,當Single bit狀態為0時,來自該第四記憶體之讀出數據不能取代在該第二記憶體中之Functional光感測器控制之設定值,令該光感測器晶片之運行模式進入從屬模式,成為從屬端,該I/O通訊介面將作為INT介面使用,而該內部積體電路匯流排所連接之外部裝置成為主機端,通過該內部積體電路匯流排等待該外部裝置之作動命令以控制該些光感測器;當該 Single bit狀態為1時,來自該第四記憶體之讀出數據能取代在該第二記憶體中之Functional光感測器控制之設定值,令該光感測器晶片之運行模式進入單晶片模式,該第二記憶體設置將從該內部積體電路匯流排重定向到該第三記憶體與該第四記憶體,使該些光感測器由該微控制器控制,該I/O通訊介面將由從屬模式的INT介面切換為GPIO介面。 To achieve the above purpose, the present invention is a MCU master-slave application control light sensor device with two modes, which includes: a light sensor area provided with several light sensors; an analogy A front-end circuit (Analog Front End, AFE) is electrically connected to the photo-sensor area for photoelectric conversion and analog trimming of the parameters of the photo-sensors; a microcontroller is electrically connected to the analog front-end circuit, The microcontroller is a software state machine (State machine), which has a first memory and an I/O communication interface, respectively, and stores the program of the software state machine from the first memory; a memory arbiter (Arbitration, ARB), electrically connected to the microcontroller , Used to receive micro-instructions associated with various memories, and used to select the order of these micro-instructions according to an arbitration procedure and process them, so that a processed micro-instruction creates the memory portion designated for the micro-instruction and Access to the address; a second memory, electrically connected to the memory arbiter, which stores the setting value controlled by a functional light sensor; an internal integrated circuit (I2C I/F) The bus is electrically connected to the memory arbiter. The internal integrated circuit bus is used as a communication interface for connecting an external device. It has a register. All calculation settings are stored in the second memory and the temporary storage. A third memory, which has a trim value built-in, used as the microcontroller to control the analog front-end circuit to trim the AFE trim parameter data of the light sensors; a fourth memory, its configuration As a unit bit (Single bit) unit memory, and burn the data in the form of single bit with these operation settings, so as to decide whether to perform slave mode or single chip mode; and a memory interface circuit, electrically connected to the memory arbitration Device, the third memory, and the fourth memory, used to generate memory channel addresses based on the processed microinstructions of the memory arbiter to access the third memory and the fourth memory; The constituent elements form a light sensor chip. By continuously reading the third memory and the fourth memory and storing them in the second memory, the microcontroller will obtain the data from the third memory and the fourth memory Read the data from the memory and check the Single bit status. When the Single bit status is 0, the read data from the fourth memory cannot replace the setting value controlled by the Functional light sensor in the second memory. Make the operation mode of the light sensor chip into the slave mode and become the slave terminal, the I/O communication interface will be used as the INT interface, and the external device connected to the internal integrated circuit bus becomes the master terminal, through the internal The integrated circuit bus waits for the actuation command of the external device to control the light sensors; when the When the Single bit state is 1, the read data from the fourth memory can replace the setting value controlled by the Functional light sensor in the second memory, so that the operation mode of the light sensor chip enters the single chip Mode, the second memory setting redirects the internal integrated circuit bus to the third memory and the fourth memory, so that the light sensors are controlled by the microcontroller, and the I/O The communication interface will be switched from the INT interface in slave mode to the GPIO interface.

於本發明上述實施例中,該些光感測器為環境光感測器(Ambient Light Sensor,ALS)與近接感測器(Proximity Sensor,PS)。 In the above embodiments of the present invention, the light sensors are an ambient light sensor (Ambient Light Sensor, ALS) and a proximity sensor (Proximity Sensor, PS).

於本發明上述實施例中,該第一記憶體為唯讀記憶體(Read-Only Memory,ROM),該第二記憶體為隨機存取記憶體(Random Access Memory,RAM),該第三記憶體為Trim非揮發性記憶體(Trim non volatile memory),及該第四記憶體為SetUp非揮發性記憶體(SetUp non volatile memory)。 In the above embodiments of the present invention, the first memory is a read-only memory (Read-Only Memory, ROM), the second memory is a random access memory (Random Access Memory, RAM), and the third memory The body is a Trim non-volatile memory (Trim non-volatile memory), and the fourth memory is a SetUp non-volatile memory (SetUp non-volatile memory).

於本發明上述實施例中,該設定值為光感測器校正與控制暫存器設定。 In the above embodiment of the present invention, the set value is a photo sensor calibration and control register setting.

於本發明上述實施例中,每個光感測器晶片在出廠前測試(FT)階段都是默認的從屬模式,該第三記憶體在FT之後被燒錄之Trim值僅針對該些光感測器之校正(Calibration),若該第四記憶體之Single bit未燒錄而使狀態為0,則開機時,來自該第四記憶體之讀出數據不能取代在該第二記憶體中之Functional光感測器控制之設定值,進入從屬模式;最終用戶將Single bit燒錄而使狀態為1,則開機時,來自該第四記憶體之讀出數據能取代在該第二記憶體中之Functional光感測器控制之設定值,進入單晶片模式,該第二記憶體設置將從該內部積體電路匯流排重定向到該第三記憶體與該第四記憶體。 In the above embodiments of the present invention, each light sensor chip is the default slave mode during the factory test (FT) stage. The Trim value of the third memory that is burned after FT is only for the light sensors Calibration of the detector, if the single bit of the fourth memory is not programmed and the status is 0, then the data read from the fourth memory cannot replace the data in the second memory when starting up The setting value controlled by the Functional light sensor enters the slave mode; the end user burns the Single bit and the status is 1, when the power is turned on, the read data from the fourth memory can be replaced in the second memory The setting value controlled by the Functional light sensor enters the single-chip mode, and the second memory setting is redirected from the internal integrated circuit bus to the third memory and the fourth memory.

於本發明上述實施例中,該用戶可將最佳的光感測器控制之設定值先用從屬模式驗證得到,再透過該內部積體電路匯流排來燒錄,將Single bit燒錄而使狀態成為1。 In the above embodiment of the present invention, the user can first verify the setting value of the optimal light sensor control using the slave mode, and then burn through the internal integrated circuit bus to burn the single bit to make The status becomes 1.

於本發明上述實施例中,該INT介面切換為GPIO介面,可以被重置為輸出OBJ狀態位元。 In the above embodiment of the present invention, the INT interface is switched to the GPIO interface and can be reset to output the OBJ status bit.

於本發明上述實施例中,該內部積體電路匯流排包括一SDA/SCL介面,當進行單晶片模式時將不再使用,需要接成VDD。 In the above embodiment of the present invention, the internal integrated circuit bus includes an SDA/SCL interface, which will no longer be used in the single-chip mode and needs to be connected to VDD.

於本發明上述實施例中,該內部積體電路匯流排包括一SEL介面,當進行單晶片模式時將釋放成GPIO介面使用或移除。 In the above embodiment of the present invention, the internal integrated circuit bus includes a SEL interface, which will be released as a GPIO interface for use or removal when performing the single-chip mode.

(本發明部分) (Part of the invention)

1:光感測器晶片 1: Light sensor chip

11:光感測器區 11: Light sensor area

111、112:光感測器 111, 112: light sensor

12:類比前端電路 12: Analog front-end circuit

13:微控制器 13: Microcontroller

131:唯讀記憶體 131: read-only memory

132:I/O通訊介面 132: I/O communication interface

14:記憶體仲裁器 14: memory arbiter

15:隨機存取記憶體 15: Random access memory

16:內部積體電路匯流排 16: Internal integrated circuit bus

161:暫存器 161: register

162:SDA/SCL介面 162: SDA/SCL interface

163:SEL介面 163: SEL interface

17:Trim非揮發性記憶體 17: Trim non-volatile memory

18:SetUp非揮發性記憶體 18: SetUp non-volatile memory

19:記憶體介面電路 19: Memory interface circuit

2:外部裝置 2: External device

s11~s22:步驟 s11~s22: steps

(習用部分) (Conventional part)

3:主機 3: Host

31:中央處理器 31: CPU

32:光感測器 32: Light sensor

4:從屬機 4: Slave machine

41:微控制器 41: Microcontroller

第1圖,係本發明之裝置架構示意圖 Figure 1 is a schematic diagram of the device architecture of the present invention

第2圖,係本發明之裝置操作流程示意圖。 Figure 2 is a schematic diagram of the operation flow of the device of the present invention.

第3圖,係習用主機通過I2C協定控制從屬光感測器模式示意圖。 Figure 3 is a schematic diagram of a conventional host computer controlling the slave light sensor through the I2C protocol.

請參閱『第1圖及第2圖』所示,係分別為本發明之裝置架構示意圖、及本發明之裝置操作流程示意圖。如圖所示:本發明係一種具兩種模式之MCU主從應用控制光感測器裝置,係包括一光感測器區11、一類比前端電路(Analog Front End,AFE)12、一微控制器(Microcontroller Unit,MCU)13、一記憶體仲裁器(Arbitration,ARB)14、一隨機存取記憶體(Random Access Memory,RAM)15、一內部積體電路(I2C I/F)匯流排16、一Trim非揮發性記憶體(Trim non volatile memory)17、一SetUp非揮發性記憶體(SetUp non volatile memory)18、一記憶體介面電路19所構成。 Please refer to "Figure 1 and Figure 2", which are respectively a schematic diagram of the device architecture of the present invention and a schematic diagram of the operation flow of the device of the present invention. As shown in the figure: the present invention is an MCU master-slave application control light sensor device with two modes, including a light sensor area 11, an analog front end (Analog Front End, AFE) 12, a micro Controller (Microcontroller Unit, MCU) 13, a memory arbiter (Arbitration, ARB) 14, a random access memory (Random Access Memory, RAM) 15, an internal integrated circuit (I2C I/F) bus 16. A Trim non-volatile memory (Trim non-volatile memory) 17, a SetUp non-volatile memory (SetUp non-volatile memory) 18, and a memory interface circuit 19.

上述所提之光感測器區11設置有數個光感測器(light sensor)111、112,包括環境光感測器(Ambient Light Sensor,ALS)與近接感測器(Proximity Sensor,PS)。 The above-mentioned light sensor area 11 is provided with a plurality of light sensors (light sensors) 111 and 112, including an ambient light sensor (Ambient Light Sensor, ALS) and a proximity sensor (Proximity Sensor, PS).

該類比前端電路12電性連接該光感測器區11中該些光感測器111、112,用以光電轉換並類比的修整該些光感測器111、112之參數。 The analog front-end circuit 12 is electrically connected to the photo sensors 111 and 112 in the photo sensor area 11 for photoelectric conversion and analog modification of the parameters of the photo sensors 111 and 112.

該微控制器13電性連接該類比前端電路12,該微控制器13為一軟體狀態機(State machine),分別具有一唯讀記憶體(Read-Only Memory,ROM)131及一I/O通訊介面132,並由該唯讀記憶體131儲存軟體狀態機之程式。 The microcontroller 13 is electrically connected to the analog front-end circuit 12. The microcontroller 13 is a software state machine (State machine) with a read-only memory (Read-Only Memory, ROM) 131 and an I/O The communication interface 132, and the read-only memory 131 stores the software state machine program.

該記憶體仲裁器14電性連接該微控制器13,用以接收與各別記憶體關聯之微指令,並用於根據一仲裁程序選定該等微指令之順序並進行處理,令一經過處理之微指令建立對該微指令指定之記憶體部份及位址之存取。 The memory arbiter 14 is electrically connected to the microcontroller 13 for receiving microinstructions associated with each memory, and for selecting and processing the order of the microinstructions according to an arbitration procedure, so that a processed The microinstruction establishes access to the memory portion and address specified by the microinstruction.

該隨機存取記憶體15電性連接該記憶體仲裁器14,其儲存有一函數式(Functional)的光感測器控制之設定值,該設定值為光感測器校正與控制暫存器設定。 The random access memory 15 is electrically connected to the memory arbiter 14 and stores a functional light sensor control setting value. The setting value is a light sensor calibration and control register setting .

該內部積體電路匯流排16電性連接該記憶體仲裁器14,該內部積體電路匯流排16為通訊介面,供連接一外部裝置2,其具有一暫存器161,所有運算設定會存在該隨機存取記憶體15與該暫存器161中。其中,該內部積體電路匯流排包括一SDA/SCL介面162及一SEL介面163。 The internal integrated circuit bus 16 is electrically connected to the memory arbiter 14. The internal integrated circuit bus 16 is a communication interface for connecting an external device 2 and has a temporary memory 161, and all calculation settings will exist The random access memory 15 and the temporary memory 161. The internal integrated circuit bus includes an SDA/SCL interface 162 and a SEL interface 163.

該Trim非揮發性記憶體17內建有一修整(Trim)值,作為該微控制器13控制該類比前端電路12修整該些光感測器111、112之 AFE修整參數資料。 The Trim non-volatile memory 17 has a Trim value built in, as the microcontroller 13 controls the analog front-end circuit 12 to trim the light sensors 111, 112 AFE trimming parameter data.

該SetUp非揮發性記憶體18配置作為單位元(Single bit)單元記憶體,並以該些運算設定燒錄成Single bit形式之資料,藉以決定進行從屬模式或單晶片模式。 The SetUp non-volatile memory 18 is configured as a single-bit (Single bit) unit memory, and burns data in the form of single bits with these operation settings to determine whether to perform the slave mode or the single-chip mode.

該記憶體介面電路19電性連接該記憶體仲裁器14、該Trim非揮發性記憶體17及該SetUp非揮發性記憶體18,用以基於該記憶體仲裁器14經過處理之微指令產生記憶體通道位址以存取該Trim非揮發性記憶體17與該SetUp非揮發性記憶體18;藉上述構成元件形成一光感測器晶片1。如是,藉由上述揭露之結構構成一全新之具兩種模式之MCU主從應用控制光感測器。 The memory interface circuit 19 is electrically connected to the memory arbiter 14, the Trim non-volatile memory 17 and the SetUp non-volatile memory 18 to generate memory based on the processed microinstructions of the memory arbiter 14 The body channel address is used to access the Trim non-volatile memory 17 and the SetUp non-volatile memory 18; a light sensor chip 1 is formed by the above components. If so, a new MCU master-slave application with two modes is used to control the light sensor with the structure disclosed above.

當運用時,在出廠前測試(FT)階段的每個光感測器晶片1都是默認的從屬模式,該Trim非揮發性記憶體17在FT之後被燒錄之Trim值,僅針對該些光感測器111、112之校正(Calibration),如果該SetUp非揮發性記憶體18之Single bit未燒錄而使狀態為0,則開機時,來自該SetUp非揮發性記憶體18之讀出數據不能取代在該隨機存取記憶體15中之Functional光感測器控制之設定值,進入從屬模式。最終用戶將Single bit燒錄而使狀態為1,則開機時,來自該SetUp非揮發性記憶體18之讀出數據能取代在該隨機存取記憶體15中之Functional光感測器控制之設定值,進入單晶片模式,該I/O通訊介面132將由從屬模式的INT介面切換為GPIO介面,其可以被重置為輸出OBJ狀態位元。並且,該內部積體電路匯流排16之SDA/SCL介面162不再使用,需要接成VDD 3.3V,而該SEL介面163也可釋放成GPIO介面使用或移除。此外,用戶可將最佳的隨機存取記憶體15中光感測器控制之設定值先用從屬模式驗證得到,再透過該內部積 體電路匯流排16來燒錄,將Single bit燒錄成1,即可使狀態為1。 When used, each light sensor chip 1 in the pre-factory test (FT) stage is the default slave mode. The Trim value of the Trim non-volatile memory 17 that is burned after FT is only for these Calibration of the light sensors 111 and 112. If the Single bit of the SetUp non-volatile memory 18 is not burned and the status is 0, the read-out from the SetUp non-volatile memory 18 is turned on The data cannot replace the setting value controlled by the functional light sensor in the random access memory 15 and enter the slave mode. When the end user burns the Single bit and the status is 1, the data read from the SetUp non-volatile memory 18 can replace the setting of the functional light sensor control in the random access memory 15 when starting up When entering the single chip mode, the I/O communication interface 132 will switch from the slave mode INT interface to the GPIO interface, which can be reset to output OBJ status bits. In addition, the SDA/SCL interface 162 of the internal integrated circuit bus 16 is no longer used and needs to be connected to VDD 3.3V, and the SEL interface 163 can also be released for use as a GPIO interface or removed. In addition, the user can first verify the setting value of the light sensor control in the optimal random access memory 15 using the slave mode, and then pass the internal product Use the body circuit bus 16 to program, and program the single bit to 1 to set the state to 1.

以下實施例僅舉例以供了解本發明之細節與內涵,但不用於限制本發明之申請專利範圍。 The following embodiments are only examples for understanding the details and connotation of the present invention, but are not intended to limit the patent application scope of the present invention.

如第2圖所示,安裝有本發明所提光感測器晶片1之智能感測器之操作模式如步驟s11,通過連續讀取Trim非揮發性記憶體17與SetUp非揮發性記憶體18並存入隨機存取記憶體15,如步驟s12、s13,微控制器13將取得來自該Trim非揮發性記憶體17與該SetUp非揮發性記憶體18之讀出數據並檢查Single bit狀態如步驟s14,當Single bit狀態為0時,來自該SetUp非揮發性記憶體18之讀出數據不能取代在該隨機存取記憶體15中之Functional光感測器控制之設定值,令該光感測器晶片1之運行模式進入從屬模式如步驟s15,成為從屬端,該I/O通訊介面132將作為INT介面使用,而該內部積體電路匯流排16所連接之外部裝置2成為主機端,通過該內部積體電路匯流排16等待該外部裝置2之作動命令以控制該些光感測器111、112。如步驟s16,由主機端配置隨機存取記憶體15,再按主機端命令開機如步驟s17,聽從主機端命令如步驟s18。當該Single bit狀態為1時,令該光感測器晶片1之運行模式進入單晶片模式如步驟s19,光感測器運行模式由從屬機設備切換到主機設備,來自該SetUp非揮發性記憶體18之讀出數據能取代在該隨機存取記憶體15中之Functional光感測器控制之設定值,使光感測器能加載專屬的控制設定如步驟s20,該光感測器晶片1於智能感測器重新開機後將自動啟動該隨機存取記憶體15之設置並永久執行如步驟s21、s22,從該內部積體電路匯流排16重定向到該Trim非揮發性記憶體17與該SetUp非揮發性記憶體18,使該些光感測器111、112由該微 控制器3控制,關閉中斷接腳,使該I/O通訊介面132由從屬模式的INT介面切換為GPIO介面。 As shown in FIG. 2, the operation mode of the smart sensor equipped with the light sensor chip 1 of the present invention is as in step s11, by continuously reading the Trim non-volatile memory 17 and the SetUp non-volatile memory 18 It is stored in the random access memory 15, as in steps s12 and s13, the microcontroller 13 will obtain the read data from the Trim non-volatile memory 17 and the SetUp non-volatile memory 18 and check the status of the single bit such as Step s14, when the Single bit status is 0, the read data from the SetUp non-volatile memory 18 cannot replace the setting value controlled by the Functional light sensor in the random access memory 15, so that the light sensing The operation mode of the detector chip 1 enters the slave mode as step s15, and becomes the slave terminal. The I/O communication interface 132 will be used as the INT interface, and the external device 2 connected to the internal integrated circuit bus 16 becomes the master terminal. The internal integrated circuit bus 16 waits for an operation command of the external device 2 to control the light sensors 111 and 112. In step s16, the random access memory 15 is configured by the host, and then booted according to the host command as in step s17, and the host command is followed as in step s18. When the Single bit state is 1, the operation mode of the light sensor chip 1 is entered into the single-chip mode as in step s19, the operation mode of the light sensor is switched from the slave device to the host device, from the SetUp non-volatile memory The read data of the body 18 can replace the setting value of the functional light sensor control in the random access memory 15, so that the light sensor can load the dedicated control settings as in step s20, the light sensor chip 1 After the smart sensor restarts, it will automatically start the setting of the random access memory 15 and permanently execute steps s21 and s22, redirecting from the internal integrated circuit bus 16 to the Trim nonvolatile memory 17 and The SetUp non-volatile memory 18 allows the light sensors 111, 112 to be The controller 3 controls to close the interrupt pin, so that the I/O communication interface 132 is switched from the slave mode INT interface to the GPIO interface.

本發明將小型微控制器嵌入光感測器晶片中,將原本主從雙模式的雙CPU架構合併成單CPU架構運作,並按照原始電路腳位設計,因此能與舊有電路設計模式相容。本發明以單CPU架構即可使光感測器直接由微控制器控制,透過光感測器控制暫存器之配置,可從內部積體電路匯流排重定向到內部非揮發性記憶體,使光感測器運行模式由從屬機設備切換到主機設備,關閉中斷接腳,然後轉為GPIO接腳。藉此,本發明所提單CPU架構簡單、容易使用,成本亦能有效下降。 The invention embeds a small microcontroller in a light sensor chip, merges the dual CPU architecture of the original master-slave dual mode into a single CPU architecture, and operates according to the original circuit pin design, so it is compatible with the old circuit design mode . The invention uses a single CPU architecture to enable the light sensor to be directly controlled by the microcontroller, and to control the configuration of the register through the light sensor, which can be redirected from the internal integrated circuit bus to the internal non-volatile memory. Switch the operation mode of the light sensor from the slave device to the master device, turn off the interrupt pin, and then switch to the GPIO pin. In this way, the bill of lading CPU structure of the present invention is simple, easy to use, and the cost can be effectively reduced.

綜上所述,本發明係一種具兩種模式之MCU主從應用控制光感測器裝置,可有效改善習用之種種缺點,係將小型微控制器嵌入光感測器晶片中,將原本主從雙模式的雙CPU架構合併成單CPU架構運作,並按照原始電路腳位設計,藉此單CPU架構可使光感測器直接由微控制器控制,透過光感測器控制暫存器之配置,可從內部積體電路匯流排重定向到內部非揮發性記憶體,使光感測器運行模式由從屬機設備切換到主機設備,從而令所提裝置具有架構簡單、容易使用,成本亦能有效下降之功效,進而使本發明之產生能更進步、更實用、更符合使用者之所須,確已符合發明專利申請之要件,爰依法提出專利申請。惟以上所述者,僅為本發明之較佳實施例而已,當不能以此限定本發明實施之範圍;故,凡依本發明申請專利範圍及發明說明書內容所作之簡單的等效變化與修飾,皆應仍屬本發明專利涵蓋之範圍內。 In summary, the present invention is a MCU master-slave application control light sensor device with two modes, which can effectively improve the various shortcomings of the conventional. It is to embed a small microcontroller in the light sensor chip and integrate the original master The dual-mode dual-CPU architecture is merged into a single-CPU architecture, and is designed according to the original circuit pins. With this single-CPU architecture, the light sensor can be directly controlled by the microcontroller, and the register can be controlled by the light sensor. Configuration, can be redirected from the internal integrated circuit bus to the internal non-volatile memory, so that the operation mode of the light sensor is switched from the slave device to the host device, so that the proposed device has a simple structure, easy to use, and cost It can effectively reduce the efficiency, thereby making the invention more advanced, more practical, and more in line with the needs of users. It does meet the requirements of the invention patent application, and the patent application is filed according to law. However, the above are only preferred embodiments of the present invention, which should not be used to limit the scope of implementation of the present invention; therefore, simple equivalent changes and modifications made according to the scope of the patent application of the present invention and the content of the invention description , Should still fall within the scope of this invention patent.

1:光感測器晶片 1: Light sensor chip

11:光感測器區 11: Light sensor area

111、112:光感測器 111, 112: light sensor

12:類比前端電路 12: Analog front-end circuit

13:微控制器 13: Microcontroller

131:唯讀記憶體 131: read-only memory

132:I/O通訊介面 132: I/O communication interface

14:記憶體仲裁器 14: memory arbiter

15:隨機存取記憶體 15: Random access memory

16:內部積體電路匯流排 16: Internal integrated circuit bus

161:暫存器 161: register

162:SDA/SCL介面 162: SDA/SCL interface

163:SEL介面 163: SEL interface

17:Trim非揮發性記憶體 17: Trim non-volatile memory

18:SetUp非揮發性記憶體 18: SetUp non-volatile memory

19:記憶體介面電路 19: Memory interface circuit

2:外部裝置 2: External device

Claims (9)

一種具兩種模式之MCU主從應用控制光感測器裝置,係包括:一光感測器區,設置有數個光感測器(light sensor);一類比前端電路(Analog Front End,AFE),電性連接該光感測器區,用以光電轉換並類比的修整該些光感測器之參數;一微控制器(Microcontroller Unit,MCU),電性連接該類比前端電路,該微控制器為一軟體狀態機(State machine),分別具有一第一記憶體及一I/O通訊介面,並由該第一記憶體儲存軟體狀態機之程式;一記憶體仲裁器(Arbitration,ARB),電性連接該微控制器,用以接收與各別記憶體關聯之微指令,並用於根據一仲裁程序選定該等微指令之順序並進行處理,令一經過處理之微指令建立對該微指令指定之記憶體部份及位址之存取;一第二記憶體,電性連接該記憶體仲裁器,其儲存有一函數式(Functional)的光感測器控制之設定值;一內部積體電路(I2C I/F)匯流排,電性連接該記憶體仲裁器,該內部積體電路匯流排為通訊介面,供連接一外部裝置,其具有一暫存器,所有運算設定會存在該第二記憶體與該暫存器中;一第三記憶體,其內建有一修整(Trim)值,作為該微控制器控制該類比前端電路修整該些光感測器之AFE修整參數資料;一第四記憶體,其配置作為單位元(Single bit)單元記憶體,並以該些運算設定燒錄成Single bit形式之資料,藉以決定進行從屬模式或單晶片模式;以及一記憶體介面電路,電性連接該記憶體仲裁器、該第三記憶 體及該第四記憶體,用以基於該記憶體仲裁器經過處理之微指令產生記憶體通道位址以存取該第三記憶體與該第四記憶體,藉上述構成元件形成一光感測器晶片,通過連續讀取該第三記憶體與該第四記憶體並存入該第二記憶體,該微控制器將取得來自該第三記憶體與該第四記憶體之讀出數據並檢查Single bit狀態,當Single bit狀態為0時,來自該第四記憶體之讀出數據不能取代在該第二記憶體中之Functional光感測器控制之設定值,令該光感測器晶片之運行模式進入從屬模式,成為從屬端,該I/O通訊介面將作為INT介面使用,而該內部積體電路匯流排所連接之外部裝置成為主機端,通過該內部積體電路匯流排等待該外部裝置之作動命令以控制該些光感測器;當該Single bit狀態為1時,來自該第四記憶體之讀出數據能取代在該第二記憶體中之Functional光感測器控制之設定值,令該光感測器晶片之運行模式進入單晶片模式,該第二記憶體設置將從該內部積體電路匯流排重定向到該第三記憶體與該第四記憶體,使該些光感測器由該微控制器控制,該I/O通訊介面將由從屬模式的INT介面切換為GPIO介面。 A MCU master-slave application with two modes to control the light sensor device includes: a light sensor area, provided with several light sensors (light sensor); an analog front end circuit (Analog Front End, AFE) , Electrically connected to the light sensor area, used for photoelectric conversion and analogously trimming the parameters of the light sensors; a microcontroller (Microcontroller Unit, MCU), electrically connected to the analog front-end circuit, the microcontroller The device is a software state machine (State machine) with a first memory and an I/O communication interface, and the program of the software state machine is stored by the first memory; a memory arbiter (Arbitration, ARB) , Electrically connected to the microcontroller, used to receive micro-instructions associated with each memory, and used to select the order of the micro-instructions according to an arbitration process and process, so that a processed micro-instruction establishes the micro-instruction Access to the memory part and address specified by the command; a second memory, electrically connected to the memory arbiter, which stores a set value controlled by a functional light sensor; an internal product I2C I/F bus, which is electrically connected to the memory arbiter. The internal integrated circuit bus is used as a communication interface for connecting an external device. It has a register. All calculation settings are stored in the A second memory and the temporary memory; a third memory, which has a trim value built in, as the microcontroller controls the analog front-end circuit to trim the AFE trimming parameter data of the light sensors; A fourth memory, which is configured as a single bit unit memory, and burns data in the form of single bits with these operation settings to decide whether to perform a slave mode or a single chip mode; and a memory interface circuit , Electrically connected to the memory arbiter and the third memory And the fourth memory, used to generate a memory channel address based on the processed microinstructions of the memory arbiter to access the third memory and the fourth memory, and forming a light sensor by the above-mentioned components Sensor chip, by continuously reading the third memory and the fourth memory and storing in the second memory, the microcontroller will obtain the read data from the third memory and the fourth memory And check the Single bit status. When the Single bit status is 0, the read data from the fourth memory cannot replace the setting value controlled by the Functional light sensor in the second memory, so that the light sensor The operation mode of the chip enters the slave mode and becomes the slave terminal. The I/O communication interface will be used as the INT interface, and the external device connected to the internal integrated circuit bus becomes the host terminal, and waits through the internal integrated circuit bus The actuation command of the external device to control the light sensors; when the Single bit state is 1, the read data from the fourth memory can replace the functional light sensor control in the second memory Setting value, the operation mode of the light sensor chip enters the single chip mode, the second memory setting is redirected from the internal integrated circuit bus to the third memory and the fourth memory, so that The light sensors are controlled by the microcontroller, and the I/O communication interface will be switched from the slave mode INT interface to the GPIO interface. 依申請專利範圍第1項所述之具兩種模式之MCU主從應用控制光感測器裝置,其中,該些光感測器為環境光感測器(Ambient Light Sensor,ALS)與近接感測器(Proximity Sensor,PS)。 The MCU master-slave application with two modes as described in item 1 of the patent scope controls the light sensor device, where the light sensors are ambient light sensors (Ambient Light Sensor, ALS) and proximity sensors Tester (Proximity Sensor, PS). 依申請專利範圍第1項所述之具兩種模式之MCU主從應用控制光感測器裝置,其中,該第一記憶體為唯讀記憶體(Read-Only Memory,ROM),該第二記憶體為隨機存取記憶體(Random Access Memory,RAM),該第三記憶體為Trim非揮發性記憶體(Trim non volatile memory),及該第四記憶體為SetUp非揮發性記憶體(SetUp non volatile memory)。 The MCU master-slave application with two modes described in item 1 of the patent scope controls the light sensor device, wherein the first memory is a read-only memory (Read-Only Memory, ROM), and the second The memory is a random access memory (Random Access Memory, RAM), the third memory is a Trim non-volatile memory (Trim non volatile memory), and the fourth memory is a Set Up non-volatile memory (Set Up non volatile memory). 依申請專利範圍第1項所述之具兩種模式之MCU主從應用控制光感測器裝置,其中,該設定值為光感測器校正與控制暫存器設定。 The MCU master-slave application with two modes described in item 1 of the patent application scope controls the light sensor device, wherein the setting value is the light sensor calibration and control register setting. 依申請專利範圍第1項所述之具兩種模式之MCU主從應用控制光感測器裝置,其中,每個光感測器晶片在出廠前測試(FT)階段都是默認的從屬模式,該第三記憶體在FT之後被燒錄之Trim值僅針對該些光感測器之校正(Calibration),若該第四記憶體之Single bit未燒錄而使狀態為0,則開機時,來自該第四記憶體之讀出數據不能取代在該第二記憶體中之Functional光感測器控制之設定值,進入從屬模式;最終用戶將Single bit燒錄而使狀態為1,則開機時,來自該第四記憶體之讀出數據能取代在該第二記憶體中之Functional光感測器控制之設定值,進入單晶片模式,該第二記憶體設置將從該內部積體電路匯流排重定向到該第三記憶體與該第四記憶體。 The MCU master-slave application with two modes as described in item 1 of the patent scope controls the light sensor device, where each light sensor chip is the default slave mode during the pre-factory test (FT) stage, The Trim value of the third memory that is burned after FT is only for the calibration of the light sensors. If the Single bit of the fourth memory is not burned and the status is 0, when powering on, The read data from the fourth memory cannot replace the setting value controlled by the Functional light sensor in the second memory and enter the slave mode; the end user burns the single bit and the status is 1, when the power is turned on , The read data from the fourth memory can replace the setting value controlled by the Functional light sensor in the second memory, enter the single-chip mode, the second memory setting will converge from the internal integrated circuit The row is redirected to the third memory and the fourth memory. 依申請專利範圍第5項所述之具兩種模式之MCU主從應用控制光感測器裝置,其中,該用戶可將最佳的光感測器控制之設定值先用從屬模式驗證得到,再透過該內部積體電路匯流排來燒錄,將Single bit燒錄而使狀態成為1。 The MCU master-slave application with two modes described in item 5 of the patent scope controls the light sensor device, where the user can first verify the optimal settings of the light sensor control using the slave mode, Then burn through the internal integrated circuit bus to burn the single bit to make the state become 1. 依申請專利範圍第1項所述之具兩種模式之MCU主從應用控制光感測器裝置,其中,該INT介面切換為GPIO介面,可以被重置為輸出OBJ狀態位元。 The MCU master-slave application with two modes as described in item 1 of the patent scope controls the light sensor device, where the INT interface is switched to the GPIO interface and can be reset to output OBJ status bits. 依申請專利範圍第1項所述之具兩種模式之MCU主從應用控制光感測器裝置,其中,該內部積體電路匯流排包括一SDA/SCL介面,當進行單晶片模式時將不再使用,需要接成VDD。 The MCU master-slave application with two modes as described in item 1 of the patent scope controls the photo sensor device, where the internal integrated circuit bus includes an SDA/SCL interface, which will not be For reuse, it needs to be connected to VDD. 依申請專利範圍第1項所述之具兩種模式之MCU主從應用控制光感測器裝置,其中,該內部積體電路匯流排包括一SEL介面,當進行單晶片模式時將釋放成GPIO介面使用或移除。 The MCU master-slave application with two modes as described in item 1 of the patent scope controls the photo sensor device, wherein the internal integrated circuit bus includes a SEL interface, which will be released as GPIO when performing single-chip mode Use or remove the interface.
TW108112545A 2019-04-10 2019-04-10 Light sensor device controlled with dual-mode master-and-slave mcu application TWI694376B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
TW108112545A TWI694376B (en) 2019-04-10 2019-04-10 Light sensor device controlled with dual-mode master-and-slave mcu application

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
TW108112545A TWI694376B (en) 2019-04-10 2019-04-10 Light sensor device controlled with dual-mode master-and-slave mcu application

Publications (2)

Publication Number Publication Date
TWI694376B true TWI694376B (en) 2020-05-21
TW202038085A TW202038085A (en) 2020-10-16

Family

ID=71896214

Family Applications (1)

Application Number Title Priority Date Filing Date
TW108112545A TWI694376B (en) 2019-04-10 2019-04-10 Light sensor device controlled with dual-mode master-and-slave mcu application

Country Status (1)

Country Link
TW (1) TWI694376B (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP0964324B1 (en) * 1998-06-09 2002-06-05 Keyence Corporation Controller for plural area sensors
TW200530825A (en) * 2004-03-03 2005-09-16 Infortrend Technology Inc Enclosure service client-server architecture using I2C interface and raid controller having the functionality of the enclosure service client
TW200700966A (en) * 2004-12-29 2007-01-01 Intel Corp Method and apparatus for external processor thermal control
TWM413915U (en) * 2011-01-10 2011-10-11 Top Victory Invest Ltd Touch sensing structure with master slave configuration
EP3154317A1 (en) * 2015-10-08 2017-04-12 ESYLUX GmbH Master slave light system
TWM541609U (en) * 2017-02-08 2017-05-11 宏碁股份有限公司 Host-salve device switch control system
US20170150584A1 (en) * 2012-07-01 2017-05-25 Cree, Inc. Master/slave arrangement for lighting fixture modules

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP0964324B1 (en) * 1998-06-09 2002-06-05 Keyence Corporation Controller for plural area sensors
TW200530825A (en) * 2004-03-03 2005-09-16 Infortrend Technology Inc Enclosure service client-server architecture using I2C interface and raid controller having the functionality of the enclosure service client
TW200700966A (en) * 2004-12-29 2007-01-01 Intel Corp Method and apparatus for external processor thermal control
TWM413915U (en) * 2011-01-10 2011-10-11 Top Victory Invest Ltd Touch sensing structure with master slave configuration
US20170150584A1 (en) * 2012-07-01 2017-05-25 Cree, Inc. Master/slave arrangement for lighting fixture modules
EP3154317A1 (en) * 2015-10-08 2017-04-12 ESYLUX GmbH Master slave light system
TWM541609U (en) * 2017-02-08 2017-05-11 宏碁股份有限公司 Host-salve device switch control system

Also Published As

Publication number Publication date
TW202038085A (en) 2020-10-16

Similar Documents

Publication Publication Date Title
JP2010119105A (en) Device and method for controlling plural image sensors according to usage
WO1999060786A1 (en) Method and apparatus to control the behavior of a digital camera by detecting connectivity to a universal serial bus
US10915079B2 (en) Light sensor device controlled with dual-mode master-and-slave MCU application
TWI694376B (en) Light sensor device controlled with dual-mode master-and-slave mcu application
US9772795B2 (en) Processing apparatus to recognize peripheral component interconnect express devices during bootup
JP2010287950A (en) Electronic device
US20230353868A1 (en) Electronic apparatus and its control method, and accessory and its control method
TWI668565B (en) Method and electronic device for automatically testing and repairing camera function
CN111897758A (en) MCU master-slave application control optical sensor device with two modes
TWI405085B (en) Switching interface method for a multi-interface storage device
TWI663532B (en) Touch display driving circuit, touch computing circuit, touch display device and operation method thereof
JP6884039B2 (en) Electronics
JP3781607B2 (en) Interface selector
US20060221189A1 (en) Image photographing device and release device
US11622074B2 (en) Electronic apparatus and accessory system
US9105348B2 (en) Electronic device with a power supply circuit for controlling the operations of a non-volatile memory and a volatile memory therein
TWI413904B (en) Universal Serial Bus (USB) controller and its execution method
JP6433870B2 (en) COMMUNICATION DEVICE, COMMUNICATION METHOD, AND PROGRAM
US20180097395A1 (en) Electronic device
US11431885B2 (en) Communication apparatus including a communication device for communicating with an external apparatus, and to control in activating the communication device by the communication apparatus and method for controlling the same
US20220046181A1 (en) Processing circuitry for object detection in standby mode, electronic device, and operating method thereof
JP2013222397A (en) Microcomputer, and terminal sharing method for reset terminal
TW200842708A (en) Computer system and method for using power button to switch BIOS
US20230059207A1 (en) Computing apparatus, image capturing apparatus, control method, and storage medium
JP2011139140A (en) Electronic module control program and method for manufacturing electronic module