Captivate which rom
If the serial peripheral is available not busy these calls are non-blocking, and the packets that are generated are transmitted to the host via interrupt service routines in the serial driver. The available compile-time options are described below. It selects the interface that the communications module should be built for. Otherwise, the desired communication mode should be set. Note that 2x this size will be allocated, since ping-pong buffering is used.
This size should also be at least 2x the size of the largest packet, to allow for byte stuffing. If it seems like packets are being dropped, a good first step is to increase the size of this buffer. This buffer size should be at least as large as the maximum length I2C bus write transaction that is expected.
This buffer size should be at least as large as the maximum length I2C bus transaction that is expected. It enables MSP Captivate-equipped microcontrollers to communicate with design, debug, and tuning tools on host PCs. This guide discusses the details of the protocol itself: packet types and packet structure. The Captivate protocol is a packet-based serial messaging protocol. It includes provisions for passing real-time capacitive measurement data from a Captivate target MCU to another processor, as well as provisions for tuning parameter read and write.
Tuning capacitive touch sensors involves looking at real-time data from a touch panel and adjusting software parameters to achieve the desired response and feel from the sensors on that panel.
For example: tuning a capacitive button involves looking at the raw data coming back from the microcontroller about that button, and adjusting thresholds, debounce, and filters accordingly to create a robust user interface. Having the ability to adjust all of these software parameters in real-time while looking at sensor data, without re-compiling code, is extremely powerful and reduces development time. The Captivate protocol was designed for the Captivate Design Center specifically to meet this need.
It could also potentially be utilized as a diagnostic tool in the field when coupled with the Captivate Design Center PC tool. Most capacitive touch user interfaces involve a dedicated microcontroller driving the touch panel, which communicates up to a host processor of some kind. The Captivate protocol supports five packet types: sensor packets, cycle packets, parameter packets, general purpose packets, and trackpad packets.
In a capacitive touch system, there are two endpoints in the communication link: the target MCU itself, and the host. The host might be a PC tool or some kind of embedded processor. Sensor packets, cycle packets, general purpose packets, and trackpad packets carry information about the current state of the touch panel being driven by the target MCU. Sensor packets are unidirectional packets from the Captivate MCU to the host. They provide information about the current state of a sensor.
Cycle packets are unidirectional packets from the Captivate MCU to the host. They provide low level element information, such as element touch status, element proximity status, element count, and element long term average for all of the elements within a cycle.
These packets are typically used in the tuning phase, where it is desirable to have real-time views of count and long term average for setting thresholds and tuning filters. Trackpad packets are unidirectional packets from trackpad MCUs to the host.
They provide the X and Y coordinates of touches as well s gesture information. General purpose packets are unidirectional packets from a Captivate MCU to the host. They serve as a generic container to send any information that can be formatted as a bit unsigned integer. Up to 29 integers 58 bytes may be sent in a single packet. Parameter packets are bi-directional packets between a host and the Captivate MCU.
Parameter packets allow for the host to adjust a tuning parameter on the target at runtime. For example, the touch threshold for an element or the resolution of a slider could be adjusted by sending the appropriate parameter command. Parameters can be read or written. Parameter reads and writes from a host to a target MCU always result in a read-back of the most current value the value after the write, in the case of a write.
The packet types discussed above are transmitted via a serial interface of some kind between the target and the host. Full-duplex UART is the typical interface. To provide reliable and accurate packet transmission, a set of transmission rules is applied to all packets when being transmitted. Sensor packets have a fixed length of 6 bytes. There are two control bytes and four data payload bytes. Sensor ID on the target side is typically established by the order of sensor pointers in the global sensor pointer array.
Data Payload Bytes [] The data payload bytes contain the sensor data that is being sent. The information contained in the payload is dependent upon the sensor type. The table below describes the payload on a sensor type basis. Note - Trackpad packets are described in detail below. The sensor status byte, included in button group, slider, and wheel sensor packets, provides additional data about the state of the sensor that is often meaningful.
The status flags are all boolean flags, and are assigned to bit positions as follows:. NOTE: Reserved fields are still transmitted, but do not contain any meaningful data. Do not use or rely on any data transmitted in a reserved field. Sensor packets are generated via a call into the protocol layer. The length of the packet is returned by the function. Cycle packets have a variable length which is dependent upon the number of elements within the cycle. There are always 3 control bytes and 3 state bytes.
In addition to those 6 bytes, there are 4 bytes per element in the cycle. Cycle ID Byte [2] The cycle ID byte contains an unsigned 8-bit integer that specifies the ID of the cycle whose data is being transmitted, relative to the sensor. For example, in a sensor with 3 cycles, the first cycle would have an ID of 0, the second, an ID of 1, and the third, an ID of 2. Cycle State Bytes [] The cycle state bytes specify the touch and proximity detection flags for each element in the cycle.
Up to 12 elements per cycle are supported. Bytes 3 through 5 of the cycle packet comprise a 24 bit cycle state section, where the lower 12 bits represent the proximity state for each element in a bitwise fashion, and the upper 12 bits represent the touch state for each element in a bitwise fashion.
LTA and count are represented as 16 bit unsigned integers. The packet shall increase in size in 32 bit 4 byte increments for every additional element in the cycle, up to a maximum of 12 elements. The LTA is sent first, and the count second.
Per the protocol, when sending values greater than one byte, the transmission sequence is lowest order byte to highest order byte.
Cycle packets are generated via a call into the protocol layer. Trackpad packets have a fixed length of 8 bytes where the last 5-bytes contain the gesture and position information. The packet format can be seen below.
Gesture Status Byte [3] The trackpad gesture byte indicates whether a gesture was just detected, and what that gesture was. If no gesture was detected, the gesture byte will be set to FFh.
Touch Coordinates Bytes[] The touch coordinates indicate the presence and location of a touch on the trackpad. Touch locations are represented as two bit unsigned integers: one for the coordinate on the X axis, and one for the coordinate on the Y axis. Most applications will have a working resolution that is less than 16 bits per coordinate, but 16 bits are always sent regardless. General purpose packets are unique in that they simply serve as a data streaming mechanism for any data an application wishes to send.
Data is sent as an array of bit unsigned integers. General purpose packets have variable length that is dependent upon the number of integers being sent. There are always 2 control bytes. Following the control bytes is the data payload up to 29 entries , with 2 bytes 16 bits per entry.
Valid Data Count Byte [1] The valid data count byte indicates how many valid data entries exist in the packet. This also implies the length of the packet: each valid entry implies two bytes of payload each entry is a bit unsigned integer.
Valid values for this field are Data Payload [2-n] The data payload section contains the generic data to be transmitted, formatted as unsigned bit integers. Up to 29 payload items 58 bytes are allowed. General purpose packets are generated via a call into the protocol layer.
Parameter packets have a fixed length of 7 bytes. There are 3 control bytes and 4 data payload bytes. Command Byte [0] The command byte for parameter packets is variable, and indicates the ID of the parameter that is to be read or written to. Sensor ID Byte [2] The sensor ID byte contains an unsigned 8-bit integer that specifies the ID of the sensor whose parameter is being read from or written to.
Note that parameters for controller commands C-h commands may not use the Sensor ID field. Data Bytes [] The data bytes contain the information that is to be read or written to. The protocol layer provides several functions for framing and interpreting parameter packets. The available parameters that can be adjusted through the use of parameter packets are listed below. Sensor Timeout Threshold. Runtime Re-Calibration Enable.
Sample Capacitor Discharge. Negative Touch Threshold. Automatic Power-Down Enable. Coarse Gain Ratio. Parasitic Offset Scale. Parasitic Offset Level. Element Data Transmit Enable. Sensor Data Transmit Enable. Active Mode Scan Rate ms. Wake-on-Prox Mode Scan Rate ms. This document should be used with the following additional supporting documentation. Like any other serial interface, UART has benefits and drawbacks. Whether or not it is the best choice for an embedded interface depends on a number of factors.
The benefits and drawbacks of UART are discussed below. Ease of implementation. UART is one of the most common serial communication protocols around. UART is easily interfaced to a host PC or another microcontroller, and as such it is well suited for use as a debug console. Point-to-point simplicity. Since only two nodes exist, the interface is not a bus with multiple devices attached.
This removes the need for addressing or chip-select overhead. Full duplex communication. In this UART driver implementation, transmit and receive operations are decoupled and may occur concurrently. Each of the two connected nodes may consider itself a master, and may begin transmission to the other node at any time.
Critical bit timing. Because UART transmission is asynchronous there is no bit clock , accurate timing must be guaranteed on both sides of the interface.
Bit rate limitation. Critical ISR timing. Instead of DMA, all data transfers are handled via interrupt service routines. This means that the CPU must be available to service receive interrupts at least every byte period. A byte period is defined as the transmission time for one byte, which is equal to 10 times the bit period. Note that the byte transmission time increases if parity or more than one stop bit is used.
For example, if the bit clock is kHz, the transmission time of one byte is 4us times 10 bits, or 40us. If the CPU is not available to service receive interrupts, received bytes may be lost. The driver provides an error detection mechanism to alert the application if and when data is being lost.
UART as configured in this driver requires at least one start bit and one stop bit. As such, each 8-bit byte requires that 10 bits be sent. The core driver is implemented in UART. The sections below describe how to configure the UART driver and use it to perform transmit and receive operations. The UART driver employs a basic software state machine to manage operations. The three driver states and their interconnection are shown in the diagram below.
The UART driver has compile-time options as well as run-time configurable options. Other options, such as baud rate, may be controlled at runtime. This provides a mechanism to exclude the driver from the compilation process. Else, define it as false. This provides flexibility during design if a pin-mux change is necessary.
A valid base address must be provided. If an invalid address is selected, a compiler error is thrown. UART communications is often performed in a low power mode. The receive callback and error callback functions may trigger an active exit from a low power mode to wake the CPU for further action.
A transmit operation will exit the low power mode specified by the UART LPM Mode configuration once the full transmission is complete, to allow the application to know that the transmission was completed.
The transmit function is normally a non-blocking function. Once transmission begins, the function returns. However, in the event that a previous transmission was still in progress when the transmit function was called, there is an option to wait for the previous transmission to complete inside of a low power mode. The transmit function will know to begin transmission when the previous transmission exits active per number 2 above.
The runtime configuration options are specified by populating a tUARTPort structure in the application, and passing this structure to the driver when opening the driver. This is a result of the fact that the UART driver references this structure at runtime to find the callback functions for receive handling and error handling.
However, the driver does not modify the data in the structure at any time, and as such, the structure may be placed in a read-only memory section such as C const memory. These parameters are considered runtime adjustable because the parameters may be modified by the application if the UART driver is closed first, then re-opened.
Note that the. If no receive handling is required, initialize this member to 0 null. If no error handling is required, initialize this member to 0 null. After the port is closed, the event handlers will no longer be called, and the tUARTPort structure memory may be released to the application. Transmit operations are interrupt driven. This function is simply passed a pointer to the buffer to transmit, and the length of the buffer to transmit specified in bytes. As such, that memory must not be modified during the transmission, or the transmission will be invalid.
If an application will be re-using buffer space, it is best to employ a ping-pong buffer strategy so that a new packet may be assembled while a previous packet is being sent. The options are described below. It will block until the buffer is available.
Received data is passed to the application through the use of the receive callback. The UART driver will call a user-defined function every time a new byte is received from the UART peripheral, passing that byte to the receive callback. It is then up to the application to decide how to handle the data. It is recommended to use a ring-buffer FIFO queue to handle buffering incoming data. The data may then be extracted and processed in a background process.
The receive callback function is linked to the driver by placing its address in the pbReceiveCallback member of the tUARTPort structure. If the application does not wish to listen for receive events, the receive callback pointer in the tUARTPort structure may be initialized to null.
Receive operations are performed entirely out of the ISR. The receive operation ISR flow is shown below. Errors are checked for whenever a receive interrupt is serviced.
The two errors detected by the driver are:. This occurs when there is not enough CPU bandwidth to read out data at the rate data is coming into the peripheral. To resolve this error during development, it is necessary to either: slow down the rate at which data is received, whether through delays between bytes or a lower baud rate, or to increase the CPU availability by shortening interrupt handlers or increasing the CPU clock frequency.
This typically occurs if there is a baud rate mismatch between devices. The driver alerts the application via the error callback function.
This works similar to the receive callback, except the error code is passed rather than the received byte. If the application does not wish to listen for error events, the error callback pointer in the tUARTPort structure may be initialized to null.
When a line is received, it is echoed back. The baud rate is N1. The max line size is 64 bytes. This example outputs to the serial terminal which button was pressed, its raw count and it filtered count when a button is pressed. To enable backchannel UART communication, these pins must be connected with separate wires because the pins do not line up with each other with the onboard connector.
The data output format can also easily being customized in the application code. Upon start-up, when all of the hardware is configured correctly, the system should broadcast the data requested directly to the terminal, assuming the terminal is set up correctly.
Ensure that the baud rate, parity bits, stop bits and character encoding are correct if data transmission does not happen as expected. Based on this example, the user can customize the output of the sensor data directly to a serial terminal using UART. This guide should be used with the following additional supporting documentation. The driver enables quick development of MSP applications where the MSP itself is a slave device to some other master in a larger embedded system. The driver is structured to be flexible, enabling many different applications.
It may also be used as a bulk-transfer interface to a host. The driver is provided in C source code. It consists of 3 base driver source files, plus an additional 3 source files related to the I2C timeout detection feature which is a compile-time option. The driver operation is based upon a software state machine that keeps track of the current driver state.
There are four possible states: closed, idle, read, and write. Since the driver implements an I2C slave, it is important to be clear on the naming conventions for read and write. An I2C bus write is a receive operation from the perspective of an I2C slave, as the bus master is writing to the slave.
Similarly, an I2C bus read is a transmit operation from the perspective of the slave. The state machine implemented by the driver is depicted below. As shown, state changes between idle, read, and write are controlled solely by the I2C bus master. It is possible for the slave to close the driver at any time, however. In this state, the driver is receiving data.
Data is received into the buffer memory that was specified by the user when the driver was opened. If the bus master attempts to write data beyond the length of the receive buffer, the data is ignored and an error callback alerts the application. The write state is cleared when a stop condition or a restart condition is issued. When this happens, the driver calls a user-specified callback function for the received data to be handled. In this state, the driver is transmitting data to the master by loading data from the latest transmit buffer memory that was linked to the driver.
Note that the buffer memory must have been pre-loaded before the read state was entered. If the bus master attempts to read data before any buffer was specified or if it attempts to read out more data than was made available in the buffer, the driver will clock out an invalid byte, which may be specified as a compile-time option.
The read state is cleared when a stop condition or a restart condition is issued. When this happens, the driver wakes the CPU from any low power modes in case it was pending on the completion of a read operation. The driver provides a mechanism for alerting the bus master that it wishes to communicate.
This is helpful in many applications, as the slave has no way to initiate communication on the I2C bus. The slave request feature is implemented as an open-drain request line.
The driver controls whether the request line IO is left tri-stated Hi-Z , or whether it is pulled to a logic low sinking current to ground through the pullup resistor and the digital IO. The driver provides a timeout mechanism for preventing application lock-ups.
To enable timeouts in a low-power way, a dedicated hardware timer is used to set limits on how long specific driver operations may take. The operations that may have timeouts placed on them are:. I2C Slave Request Timeout. The slave request feature described in section 2. That slave request API function is designed to block until the master starts communication via a I2C bus read start condition.
If the timeout feature is enabled, the slave request function will time out automatically if the master does not start a read within the specified timeout period.
I2C Transaction Timeout. The transaction timeout places a limit on how long any I2C bus transaction may take. An I2C transaction time is defined between a start or restart condition until a restart or stop condition is issued. The goal of the transaction timeout is to detect scenarios where the bus master went down in the middle of transmission, or an I2C bus disconnection. The timeout feature is implemented by the Function Timer module, which is a completely independent software module.
As transaction monitoring may be a part of the application layer perhaps with a standard watchdog timer , the timeout feature may be excluded completely at compile time. The Function Timer module essentially calls a predefined function in the foreground after a defined delay in timer cycles.
That function can then take actions such as cancelling a slave request or resetting the driver. These options are described below. The I2C Slave Enable compile-time option selects whether the driver is enabled or disabled. I2C communication may be performed in a low power mode. This is a benefit of the bit clock being provided by the bus master. Receive callback functions may trigger an active exit from the I2C ISR after the completion of a receive event triggered by either a re-start or a stop condition.
If a receive callback returns true to the driver, the status register bits specified by the I2C slave LPM mode will be cleared when exiting. If a low power mode is specified via the I2C Slave LPM Mode definition, the block will take place in that low power mode- otherwise, it will block in active mode.
The invalid byte specifies the byte that is transmitted to the master during an I2C read if the master attempts to read beyond the length of the transmit buffer provided to the driver.
The slave timeout enable controls whether the timeout feature of the driver is included. The timeout feature provides the ability to set a maximum amount of time a certain I2C slave task may take before it fails. The two tasks that may be monitored with a timeout is the I2C slave request and any I2C transaction.
The I2C slave request timeout cycles specifies the timeout period for the I2C request timeout, in units of the function timer clock period. This is the amount of time the driver will wait after pulling the slave request line low before the transaction fails out. The bus master must respond to the slave request within this amount of time. The I2C slave transfer timeout cycles specifies the timeout period for any I2C transaction, in units of the function timer clock period.
I2C transactions are timed from start condition to stop condition, or start condition to re-start condition. The request enable controls whether the I2C request line feature is included in the driver build.
The I2C request line provides a mechanism for the slave to signal the master that it would like to communicate. The I2C slave request line is defined by three values- the port output register, the port direction register, and the pin mask. These do not need to be defined if the slave request enable is set to false. The function timer enable controls whether the function timer is included in the driver build.
If the I2C slave timeout feature is not used, memory is conserved when the function timer is disabled set to false. The function timer clock determines the resolution of the function timer, as well as the maximum delay. Note that if the clock source is changed, the effective function timer delay may change. The function timer clock divider divides down the source clock which was specified above.
Note that if the clock divider is changed, the effective function timer delay may change. The function timer extended divider allows an additional second divider to be added in series with the standard divider. Note that if the extended clock divider is changed, the effective function timer delay may change. The function timer LPM clear controls which LPM bits are cleared upon exit from a function called in the foreground by the function timer.
This should be set to enable CPU wake-up after a timeout event. The function timer feature will never use these bits to enter into a low power mode- it will only use them to exit.
The tI2CSlavePort structures are discussed below. When set to true, this flag configures the driver to always load the length of the transmit buffer as the first data byte read by the bus master. This is useful when variable length bulk packets are being read out by the master, and the master needs to know how many bytes to read from the slave.
If the timeout feature is included in the driver build, a function timer run-time configuration also happens- but it is handled automatically by the driver when the I2C port is opened. The function timer runtime configuration structure tFunctionTimer is outlined below for completeness, but application does not need to know any of the function timer details.
This member specifies the length of the delay in timer clock cycles before function A is called. This member specifies the length of the delay in timer clock cycles before function B is called. Opening and closing of the I2C slave driver is accomplished through the following function calls:. The tI2CSlavePort structure must be populated by the application. This structure is not modified by the driver at any time, and as such, it may be placed in read-only memory such as a C const memory section.
After the port is closed, the event handlers will no longer be called and the tI2CSlave structure memory may be released to the application.
An I2C slave cannot push data out onto the bus on its own- rather, a master must address the slave and clock out the data. Therefore, the data buffer must be made available to the driver before the bus master attempts to read it.
This function will block if a current transaction is in progress, and will return when the transmit buffer pointer and length have been updated. If no transmit buffer is provided and the bus master attempts to read from the slave, it will read out the invalid character a compile-time option.
On the flipside, it is important that the application does not overwrite the transmit buffer space until transmission is complete. This function immediately pulls the request line, then waits for the master to begin performing a read operation before it returns or times out. This function returns the current I2C Slave state.
The possible states are enumerated by tI2CSlaveStates. The possible enumerations are listed below. The driver is closed. The driver is open and the bus master is reading data. The driver loads data from the transmit buffer until all data has been sent, then it loads the invalid byte. The driver is open and the bus master is writing data.
The written data is placed into the receive buffer if there is space. At the end of this state, the receive callback in the application is called. The bus master may start a write operation at any time. The driver will buffer incoming data into the receive buffer. When the transaction is complete, the application receive callback is called. The callback is passed the size of the data received from the master in bytes.
This provides the callback function the opportunity to process any received data and update the transmit buffer before the master may continue with communication. The driver provides an error callback to alert the application if there is a problem with the driver.
The error callback, when called, passes a value indicating the error that occurred. The possible errors are listed below. This code indicates that a slave request to the bus master was not serviced within the timeout window, and the request timed out. This code indicates that an I2C transaction was taking longer than the timeout window, and the transaction timed out.
This error also results in a driver reset. This code indicates that the receive buffer was full during the last read transaction, and data from the bus master was lost. This code indicates that the bus master attempted to read data from the slave beyond the valid transmit buffer length indicating the master was reading invalid bytes.
The master may write up to bytes to the 8kB memory at a time. The master may read from any memory address until the end of the memory section at any time. At a minimum, an application will also require the following:. Therefore, when selecting the correct device it is important to consider the memory needs for the entire application and not just for CapTIvate.
The following table illustrates the typical memory requirements for several different use-cases of the CapTIvate Software Library to aid in selecting the correct device for an application.
A B call stack CapTIvate examples default to a B call stack for application safety, this may be reduced. Some optimizations are required when communications are enabled. The worst-case stack usage for most applications running only the CapTIvate Touch Library is approximately B, with 30B of additional space required for interrupt service routines. If callback functions are used, these may potentially increase the stack size requirement.
A good, conservative estimate that is safe for many applications is a B stack. Every application will have its own unique stack requirements, with interrupt service routines being the largest unknown factor. Therefore it is recommended that each designer perform a worst-case stack usage analysis to determine the required stack size. It is often of interest to understand the amount of time required to set up a measurement, perform the measurement, and process the measurement results.
This is the easiest function to use as it includes all of the required processing. In the first case, the CapTIvate peripheral was configured to turn off after each conversion. This means that before each conversion starts, there is an extra start-up time for the peripheral. Here that time measures to be approximately 0.
It takes up to 0. It does not transmit data. This is an easy function to use if you want to control when a specific sensor is measured. Sign up to join this community. The best answers are voted up and rise to the top. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Learn more. A stock rom for Samsung Captivate? Asked 7 years, 2 months ago. Active 7 years, 2 months ago. Viewed 2k times. Improve this question. My Captivate was running the 2.
The first issue I encountered was that many walk throughs require 2. The 2. After reviewing a few steps to accomplish recovery with adb an android development tool , I encountered a seemingly outdated instructional piece:. Those are the instructions I followed, the rest of my notes are simply tips and information that I used while completing the steps from theunlockr. After some cautious review, I landed on Fasty. I need this phone to work and can not afford to be using nightly builds or ROMs that could have issues with core functionality.
Originally, I was leaning heavily toward Cyanogenmod, but their Captivate support is still not ready for standard usage imo. The above procedure worked for me, but note that I was using a captivate that had not been previously updated to an alternative ROM.
After flashing clockwork recovery to the device, I copied the Fasty zip to my device. I was not having luck copying the zip to my SD card, I had to copy it to the root of the device file system.
0コメント